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.cpp # 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.cpp` 36 lines ยท 1231 bytes Raw Blame History 1 #include "traits.h" 2 3 #include "ggml-backend-impl.h" 4 #include "ggml-backend.h" 5 6 namespace ggml::cpu { 7 tensor_traits::~tensor_traits() {} 8 9 extra_buffer_type::~extra_buffer_type() {} 10 } // namespace ggml::cpu 11 12 bool ggml_cpu_extra_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * op) { 13 for (auto extra : ggml_backend_cpu_get_extra_buffer_types()) { 14 if (extra && extra->context) { 15 auto buf_extra = (ggml::cpu::extra_buffer_type *) extra->context; 16 auto tensor_traits = buf_extra->get_tensor_traits(op); 17 if (tensor_traits && tensor_traits->compute_forward(params, op)) { 18 return true; 19 } 20 } 21 } 22 return false; 23 } 24 25 bool ggml_cpu_extra_work_size(int n_threads, const struct ggml_tensor * op, size_t * size) { 26 for (auto extra : ggml_backend_cpu_get_extra_buffer_types()) { 27 if (extra && extra->context) { 28 auto buf_extra = (ggml::cpu::extra_buffer_type *) extra->context; 29 auto tensor_traits = buf_extra->get_tensor_traits(op); 30 if (tensor_traits && tensor_traits->work_size(n_threads, op, *size)) { 31 return true; 32 } 33 } 34 } 35 return false; 36 }