mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2025-11-21 12:16:57 +00:00
* rename ggml-cpu-aarch64.c to .cpp
* reformat extra cpu backend.
- clean Q4_0_N_M and IQ4_0_N_M
- remove from "file" tensor type
- allow only with dynamic repack
- extract cpu extra bufts and convert to C++
- hbm
- "aarch64"
- more generic use of extra buffer
- generalise extra_supports_op
- new API for "cpu-accel":
- amx
- aarch64
* clang-format
* Clean Q4_0_N_M ref
Enable restrict on C++
* add op GGML_OP_MUL_MAT_ID for Q4_0_N_M with runtime repack
* added/corrected control on tensor size for Q4 repacking.
* Update ggml/src/ggml-cpu/ggml-cpu-aarch64.cpp
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
* Update ggml/src/ggml-cpu/ggml-cpu-aarch64.cpp
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
* add debug logs on repacks.
---------
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
#include "ggml-cpu-traits.h"
|
|
|
|
#include "ggml-backend-impl.h"
|
|
#include "ggml-backend.h"
|
|
|
|
namespace ggml::cpu {
|
|
tensor_traits::~tensor_traits() {}
|
|
|
|
extra_buffer_type::~extra_buffer_type() {}
|
|
} // namespace ggml::cpu
|
|
|
|
bool ggml_cpu_extra_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * op) {
|
|
for (auto extra : ggml_backend_cpu_get_extra_buffers_type()) {
|
|
if (extra && extra->context) {
|
|
auto buf_extra = (ggml::cpu::extra_buffer_type *) extra->context;
|
|
auto tensor_traits = buf_extra->get_tensor_traits(op);
|
|
if (tensor_traits && tensor_traits->compute_forward(params, op)) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool ggml_cpu_extra_work_size(int n_threads, const struct ggml_tensor * op, size_t * size) {
|
|
for (auto extra : ggml_backend_cpu_get_extra_buffers_type()) {
|
|
if (extra && extra->context) {
|
|
auto buf_extra = (ggml::cpu::extra_buffer_type *) extra->context;
|
|
auto tensor_traits = buf_extra->get_tensor_traits(op);
|
|
if (tensor_traits && tensor_traits->work_size(n_threads, op, *size)) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|