mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2025-01-16 07:08:28 +01:00
19d8762ab6
* 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>
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
#pragma once
|
|
#include "ggml-backend-impl.h"
|
|
#include "ggml-cpu-impl.h"
|
|
#include "ggml.h"
|
|
|
|
#ifdef __cplusplus
|
|
# include <vector>
|
|
extern "C" {
|
|
#endif
|
|
|
|
// return true if op part of extra "accelerator"
|
|
bool ggml_cpu_extra_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * op);
|
|
bool ggml_cpu_extra_work_size(int n_threads, const struct ggml_tensor * op, size_t * size);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
|
|
namespace ggml::cpu {
|
|
// register in tensor->extra
|
|
class tensor_traits {
|
|
public:
|
|
virtual ~tensor_traits();
|
|
virtual bool work_size(int n_threads, const struct ggml_tensor * op, size_t & size) = 0;
|
|
virtual bool compute_forward(struct ggml_compute_params * params, struct ggml_tensor * op) = 0;
|
|
};
|
|
|
|
class extra_buffer_type {
|
|
public:
|
|
virtual ~extra_buffer_type();
|
|
virtual bool supports_op(ggml_backend_dev_t dev, const struct ggml_tensor * op) = 0;
|
|
virtual tensor_traits * get_tensor_traits(const struct ggml_tensor * op) = 0;
|
|
};
|
|
} // namespace ggml::cpu
|
|
|
|
// implemented in ggml-cpu.cpp.
|
|
std::vector<ggml_backend_buffer_type_t> & ggml_backend_cpu_get_extra_buffers_type();
|
|
|
|
#endif
|