Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6b84473

Browse files
authored
[CANN] Adapt to dynamically loadable backends mechanism (ggml-org#9970)
* [CANN] Adapt to dynamically loadable backends mechanism * Fix the Bug: inference running result is garbled in debug running model for LM models who's type is Q4_0 class * Handle the review comments of this pull request
1 parent 674804a commit 6b84473

File tree

4 files changed

+267
-149
lines changed

4 files changed

+267
-149
lines changed

ggml/include/ggml-cann.h

+2
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ extern "C" {
3434
*/
3535
#define GGML_CANN_MAX_DEVICES 16
3636

37+
GGML_API ggml_backend_reg_t ggml_backend_cann_reg(void);
38+
3739
/**
3840
* @brief Initializes the CANN backend for a specified device.
3941
*

ggml/src/ggml-backend.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,10 @@ void * ggml_backend_reg_get_proc_address(ggml_backend_reg_t reg, const char * na
561561
# include "ggml-amx.h"
562562
#endif
563563

564+
#ifdef GGML_USE_CANN
565+
#include "ggml-cann.h"
566+
#endif
567+
564568
struct ggml_backend_registry {
565569
std::vector<ggml_backend_reg_t> backends;
566570
std::vector<ggml_backend_dev_t> devices;
@@ -587,8 +591,11 @@ struct ggml_backend_registry {
587591
#ifdef GGML_USE_AMX
588592
register_backend(ggml_backend_amx_reg());
589593
#endif
594+
#ifdef GGML_USE_CANN
595+
register_backend(ggml_backend_cann_reg());
596+
#endif
590597

591-
// TODO: kompute, cann
598+
// TODO: kompute
592599

593600
register_backend(ggml_backend_cpu_reg());
594601
}

0 commit comments

Comments
 (0)