Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/ggml/blob/master/src/ggml-cpu/traits.h # ggml [Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685) Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `master` Branches Tags History `ggml / src / ggml-cpu / traits.h` 38 lines ยท 1157 bytes Raw Blame History 1 #pragma once 2 #include "ggml-backend-impl.h" 3 #include "ggml-cpu-impl.h" 4 #include "ggml.h" 5 6 #ifdef __cplusplus 7 # include 8 extern "C" { 9 #endif 10 11 // return true if op part of extra "accelerator" 12 bool ggml_cpu_extra_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * op); 13 bool ggml_cpu_extra_work_size(int n_threads, const struct ggml_tensor * op, size_t * size); 14 15 #ifdef __cplusplus 16 } 17 18 namespace ggml::cpu { 19 // register in tensor->extra 20 class tensor_traits { 21 public: 22 virtual ~tensor_traits(); 23 virtual bool work_size(int n_threads, const struct ggml_tensor * op, size_t & size) = 0; 24 virtual bool compute_forward(struct ggml_compute_params * params, struct ggml_tensor * op) = 0; 25 }; 26 27 class extra_buffer_type { 28 public: 29 virtual ~extra_buffer_type(); 30 virtual bool supports_op(ggml_backend_dev_t dev, const struct ggml_tensor * op) = 0; 31 virtual tensor_traits * get_tensor_traits(const struct ggml_tensor * op) = 0; 32 }; 33 } // namespace ggml::cpu 34 35 // implemented in ggml-cpu.cpp. 36 std::vector & ggml_backend_cpu_get_extra_buffer_types(); 37 38 #endif