cui-llama.rn 1.3.6 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +22 -1
  2. package/android/src/main/CMakeLists.txt +25 -26
  3. package/android/src/main/java/com/rnllama/LlamaContext.java +31 -9
  4. package/android/src/main/java/com/rnllama/RNLlama.java +98 -0
  5. package/android/src/main/jni-utils.h +94 -0
  6. package/android/src/main/jni.cpp +133 -63
  7. package/android/src/newarch/java/com/rnllama/RNLlamaModule.java +15 -0
  8. package/android/src/oldarch/java/com/rnllama/RNLlamaModule.java +15 -0
  9. package/cpp/common.cpp +2085 -1982
  10. package/cpp/common.h +696 -664
  11. package/cpp/ggml-alloc.c +1042 -1037
  12. package/cpp/ggml-backend-impl.h +255 -256
  13. package/cpp/ggml-backend-reg.cpp +582 -582
  14. package/cpp/ggml-backend.cpp +2002 -2002
  15. package/cpp/ggml-backend.h +354 -352
  16. package/cpp/ggml-common.h +1853 -1853
  17. package/cpp/ggml-cpp.h +39 -39
  18. package/cpp/ggml-cpu-aarch64.cpp +4247 -4247
  19. package/cpp/ggml-cpu-aarch64.h +8 -8
  20. package/cpp/ggml-cpu-impl.h +386 -386
  21. package/cpp/ggml-cpu-quants.c +10920 -10839
  22. package/cpp/ggml-cpu-traits.cpp +36 -36
  23. package/cpp/ggml-cpu-traits.h +38 -38
  24. package/cpp/ggml-cpu.c +14391 -14122
  25. package/cpp/ggml-cpu.cpp +635 -627
  26. package/cpp/ggml-cpu.h +135 -135
  27. package/cpp/ggml-impl.h +567 -567
  28. package/cpp/ggml-metal-impl.h +288 -0
  29. package/cpp/ggml-metal.m +4884 -4884
  30. package/cpp/ggml-opt.cpp +854 -0
  31. package/cpp/ggml-opt.h +216 -0
  32. package/cpp/ggml-quants.c +5238 -5238
  33. package/cpp/ggml-threading.h +14 -14
  34. package/cpp/ggml.c +6514 -6448
  35. package/cpp/ggml.h +2194 -2163
  36. package/cpp/gguf.cpp +1329 -1325
  37. package/cpp/gguf.h +202 -202
  38. package/cpp/json-schema-to-grammar.cpp +1045 -1045
  39. package/cpp/json-schema-to-grammar.h +8 -8
  40. package/cpp/json.hpp +24766 -24766
  41. package/cpp/llama-adapter.cpp +347 -346
  42. package/cpp/llama-adapter.h +74 -73
  43. package/cpp/llama-arch.cpp +1487 -1434
  44. package/cpp/llama-arch.h +400 -395
  45. package/cpp/llama-batch.cpp +368 -368
  46. package/cpp/llama-batch.h +88 -88
  47. package/cpp/llama-chat.cpp +578 -567
  48. package/cpp/llama-chat.h +52 -51
  49. package/cpp/llama-context.cpp +1775 -1771
  50. package/cpp/llama-context.h +128 -128
  51. package/cpp/llama-cparams.cpp +1 -1
  52. package/cpp/llama-cparams.h +37 -37
  53. package/cpp/llama-cpp.h +30 -30
  54. package/cpp/llama-grammar.cpp +1139 -1139
  55. package/cpp/llama-grammar.h +143 -143
  56. package/cpp/llama-hparams.cpp +71 -71
  57. package/cpp/llama-hparams.h +139 -140
  58. package/cpp/llama-impl.cpp +167 -167
  59. package/cpp/llama-impl.h +61 -61
  60. package/cpp/llama-kv-cache.cpp +718 -718
  61. package/cpp/llama-kv-cache.h +218 -218
  62. package/cpp/llama-mmap.cpp +590 -589
  63. package/cpp/llama-mmap.h +67 -67
  64. package/cpp/llama-model-loader.cpp +1124 -1011
  65. package/cpp/llama-model-loader.h +167 -158
  66. package/cpp/llama-model.cpp +3997 -2202
  67. package/cpp/llama-model.h +370 -391
  68. package/cpp/llama-sampling.cpp +2408 -2406
  69. package/cpp/llama-sampling.h +32 -48
  70. package/cpp/llama-vocab.cpp +3247 -1982
  71. package/cpp/llama-vocab.h +125 -182
  72. package/cpp/llama.cpp +10077 -12544
  73. package/cpp/llama.h +1323 -1285
  74. package/cpp/log.cpp +401 -401
  75. package/cpp/log.h +121 -121
  76. package/cpp/rn-llama.hpp +123 -116
  77. package/cpp/sampling.cpp +505 -500
  78. package/cpp/sgemm.cpp +2597 -2597
  79. package/cpp/sgemm.h +14 -14
  80. package/cpp/speculative.cpp +277 -274
  81. package/cpp/speculative.h +28 -28
  82. package/cpp/unicode.cpp +2 -3
  83. package/ios/RNLlama.mm +47 -0
  84. package/ios/RNLlamaContext.h +3 -1
  85. package/ios/RNLlamaContext.mm +71 -14
  86. package/jest/mock.js +15 -3
  87. package/lib/commonjs/NativeRNLlama.js.map +1 -1
  88. package/lib/commonjs/index.js +33 -37
  89. package/lib/commonjs/index.js.map +1 -1
  90. package/lib/module/NativeRNLlama.js.map +1 -1
  91. package/lib/module/index.js +31 -35
  92. package/lib/module/index.js.map +1 -1
  93. package/lib/typescript/NativeRNLlama.d.ts +26 -6
  94. package/lib/typescript/NativeRNLlama.d.ts.map +1 -1
  95. package/lib/typescript/index.d.ts +21 -36
  96. package/lib/typescript/index.d.ts.map +1 -1
  97. package/llama-rn.podspec +4 -18
  98. package/package.json +2 -3
  99. package/src/NativeRNLlama.ts +32 -13
  100. package/src/index.ts +52 -47
  101. package/cpp/llama.cpp.rej +0 -23
package/cpp/ggml-cpu.h CHANGED
@@ -1,135 +1,135 @@
1
- #pragma once
2
-
3
- #include "ggml.h"
4
- #include "ggml-backend.h"
5
-
6
- #ifdef __cplusplus
7
- extern "C" {
8
- #endif
9
-
10
- // the compute plan that needs to be prepared for lm_ggml_graph_compute()
11
- // since https://github.com/ggerganov/ggml/issues/287
12
- struct lm_ggml_cplan {
13
- size_t work_size; // size of work buffer, calculated by `lm_ggml_graph_plan()`
14
- uint8_t * work_data; // work buffer, to be allocated by caller before calling to `lm_ggml_graph_compute()`
15
-
16
- int n_threads;
17
- struct lm_ggml_threadpool * threadpool;
18
-
19
- // abort lm_ggml_graph_compute when true
20
- lm_ggml_abort_callback abort_callback;
21
- void * abort_callback_data;
22
- };
23
-
24
- // numa strategies
25
- enum lm_ggml_numa_strategy {
26
- LM_GGML_NUMA_STRATEGY_DISABLED = 0,
27
- LM_GGML_NUMA_STRATEGY_DISTRIBUTE = 1,
28
- LM_GGML_NUMA_STRATEGY_ISOLATE = 2,
29
- LM_GGML_NUMA_STRATEGY_NUMACTL = 3,
30
- LM_GGML_NUMA_STRATEGY_MIRROR = 4,
31
- LM_GGML_NUMA_STRATEGY_COUNT
32
- };
33
-
34
- LM_GGML_BACKEND_API void lm_ggml_numa_init(enum lm_ggml_numa_strategy numa); // call once for better performance on NUMA systems
35
- LM_GGML_BACKEND_API bool lm_ggml_is_numa(void); // true if init detected that system has >1 NUMA node
36
-
37
- LM_GGML_BACKEND_API struct lm_ggml_tensor * lm_ggml_new_i32(struct lm_ggml_context * ctx, int32_t value);
38
- LM_GGML_BACKEND_API struct lm_ggml_tensor * lm_ggml_new_f32(struct lm_ggml_context * ctx, float value);
39
-
40
- LM_GGML_BACKEND_API struct lm_ggml_tensor * lm_ggml_set_i32 (struct lm_ggml_tensor * tensor, int32_t value);
41
- LM_GGML_BACKEND_API struct lm_ggml_tensor * lm_ggml_set_f32 (struct lm_ggml_tensor * tensor, float value);
42
-
43
- LM_GGML_BACKEND_API int32_t lm_ggml_get_i32_1d(const struct lm_ggml_tensor * tensor, int i);
44
- LM_GGML_BACKEND_API void lm_ggml_set_i32_1d(const struct lm_ggml_tensor * tensor, int i, int32_t value);
45
-
46
- LM_GGML_BACKEND_API int32_t lm_ggml_get_i32_nd(const struct lm_ggml_tensor * tensor, int i0, int i1, int i2, int i3);
47
- LM_GGML_BACKEND_API void lm_ggml_set_i32_nd(const struct lm_ggml_tensor * tensor, int i0, int i1, int i2, int i3, int32_t value);
48
-
49
- LM_GGML_BACKEND_API float lm_ggml_get_f32_1d(const struct lm_ggml_tensor * tensor, int i);
50
- LM_GGML_BACKEND_API void lm_ggml_set_f32_1d(const struct lm_ggml_tensor * tensor, int i, float value);
51
-
52
- LM_GGML_BACKEND_API float lm_ggml_get_f32_nd(const struct lm_ggml_tensor * tensor, int i0, int i1, int i2, int i3);
53
- LM_GGML_BACKEND_API void lm_ggml_set_f32_nd(const struct lm_ggml_tensor * tensor, int i0, int i1, int i2, int i3, float value);
54
-
55
- LM_GGML_BACKEND_API struct lm_ggml_threadpool * lm_ggml_threadpool_new (struct lm_ggml_threadpool_params * params);
56
- LM_GGML_BACKEND_API void lm_ggml_threadpool_free (struct lm_ggml_threadpool * threadpool);
57
- LM_GGML_BACKEND_API int lm_ggml_threadpool_get_n_threads (struct lm_ggml_threadpool * threadpool);
58
- LM_GGML_BACKEND_API void lm_ggml_threadpool_pause (struct lm_ggml_threadpool * threadpool);
59
- LM_GGML_BACKEND_API void lm_ggml_threadpool_resume (struct lm_ggml_threadpool * threadpool);
60
-
61
- // lm_ggml_graph_plan() has to be called before lm_ggml_graph_compute()
62
- // when plan.work_size > 0, caller must allocate memory for plan.work_data
63
- LM_GGML_BACKEND_API struct lm_ggml_cplan lm_ggml_graph_plan(
64
- const struct lm_ggml_cgraph * cgraph,
65
- int n_threads, /* = LM_GGML_DEFAULT_N_THREADS */
66
- struct lm_ggml_threadpool * threadpool /* = NULL */ );
67
- LM_GGML_BACKEND_API enum lm_ggml_status lm_ggml_graph_compute(struct lm_ggml_cgraph * cgraph, struct lm_ggml_cplan * cplan);
68
-
69
- // same as lm_ggml_graph_compute() but the work data is allocated as a part of the context
70
- // note: the drawback of this API is that you must have ensured that the context has enough memory for the work data
71
- LM_GGML_BACKEND_API enum lm_ggml_status lm_ggml_graph_compute_with_ctx(struct lm_ggml_context * ctx, struct lm_ggml_cgraph * cgraph, int n_threads);
72
-
73
- //
74
- // system info
75
- //
76
-
77
- // x86
78
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_sse3 (void);
79
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_ssse3 (void);
80
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_avx (void);
81
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_avx_vnni (void);
82
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_avx2 (void);
83
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_f16c (void);
84
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_fma (void);
85
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_avx512 (void);
86
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_avx512_vbmi(void);
87
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_avx512_vnni(void);
88
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_avx512_bf16(void);
89
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_amx_int8 (void);
90
- // ARM
91
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_neon (void);
92
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_arm_fma (void);
93
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_fp16_va (void);
94
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_dotprod (void);
95
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_matmul_int8(void);
96
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_sve (void);
97
- LM_GGML_BACKEND_API int lm_ggml_cpu_get_sve_cnt (void); // sve vector length in bytes
98
- // other
99
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_riscv_v (void);
100
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_vsx (void);
101
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_wasm_simd (void);
102
- LM_GGML_BACKEND_API int lm_ggml_cpu_has_llamafile (void);
103
-
104
- // Internal types and functions exposed for tests and benchmarks
105
-
106
- typedef void (*lm_ggml_vec_dot_t) (int n, float * LM_GGML_RESTRICT s, size_t bs, const void * LM_GGML_RESTRICT x, size_t bx,
107
- const void * LM_GGML_RESTRICT y, size_t by, int nrc);
108
-
109
- struct lm_ggml_type_traits_cpu {
110
- lm_ggml_from_float_t from_float;
111
- lm_ggml_vec_dot_t vec_dot;
112
- enum lm_ggml_type vec_dot_type;
113
- int64_t nrows; // number of rows to process simultaneously
114
- };
115
-
116
- LM_GGML_BACKEND_API const struct lm_ggml_type_traits_cpu * lm_ggml_get_type_traits_cpu(enum lm_ggml_type type);
117
-
118
- LM_GGML_BACKEND_API void lm_ggml_cpu_init(void);
119
-
120
- //
121
- // CPU backend
122
- //
123
-
124
- LM_GGML_BACKEND_API lm_ggml_backend_t lm_ggml_backend_cpu_init(void);
125
-
126
- LM_GGML_BACKEND_API bool lm_ggml_backend_is_cpu (lm_ggml_backend_t backend);
127
- LM_GGML_BACKEND_API void lm_ggml_backend_cpu_set_n_threads (lm_ggml_backend_t backend_cpu, int n_threads);
128
- LM_GGML_BACKEND_API void lm_ggml_backend_cpu_set_threadpool (lm_ggml_backend_t backend_cpu, lm_ggml_threadpool_t threadpool);
129
- LM_GGML_BACKEND_API void lm_ggml_backend_cpu_set_abort_callback(lm_ggml_backend_t backend_cpu, lm_ggml_abort_callback abort_callback, void * abort_callback_data);
130
-
131
- LM_GGML_BACKEND_API lm_ggml_backend_reg_t lm_ggml_backend_cpu_reg(void);
132
-
133
- #ifdef __cplusplus
134
- }
135
- #endif
1
+ #pragma once
2
+
3
+ #include "ggml.h"
4
+ #include "ggml-backend.h"
5
+
6
+ #ifdef __cplusplus
7
+ extern "C" {
8
+ #endif
9
+
10
+ // the compute plan that needs to be prepared for lm_ggml_graph_compute()
11
+ // since https://github.com/ggerganov/ggml/issues/287
12
+ struct lm_ggml_cplan {
13
+ size_t work_size; // size of work buffer, calculated by `lm_ggml_graph_plan()`
14
+ uint8_t * work_data; // work buffer, to be allocated by caller before calling to `lm_ggml_graph_compute()`
15
+
16
+ int n_threads;
17
+ struct lm_ggml_threadpool * threadpool;
18
+
19
+ // abort lm_ggml_graph_compute when true
20
+ lm_ggml_abort_callback abort_callback;
21
+ void * abort_callback_data;
22
+ };
23
+
24
+ // numa strategies
25
+ enum lm_ggml_numa_strategy {
26
+ LM_GGML_NUMA_STRATEGY_DISABLED = 0,
27
+ LM_GGML_NUMA_STRATEGY_DISTRIBUTE = 1,
28
+ LM_GGML_NUMA_STRATEGY_ISOLATE = 2,
29
+ LM_GGML_NUMA_STRATEGY_NUMACTL = 3,
30
+ LM_GGML_NUMA_STRATEGY_MIRROR = 4,
31
+ LM_GGML_NUMA_STRATEGY_COUNT
32
+ };
33
+
34
+ LM_GGML_BACKEND_API void lm_ggml_numa_init(enum lm_ggml_numa_strategy numa); // call once for better performance on NUMA systems
35
+ LM_GGML_BACKEND_API bool lm_ggml_is_numa(void); // true if init detected that system has >1 NUMA node
36
+
37
+ LM_GGML_BACKEND_API struct lm_ggml_tensor * lm_ggml_new_i32(struct lm_ggml_context * ctx, int32_t value);
38
+ LM_GGML_BACKEND_API struct lm_ggml_tensor * lm_ggml_new_f32(struct lm_ggml_context * ctx, float value);
39
+
40
+ LM_GGML_BACKEND_API struct lm_ggml_tensor * lm_ggml_set_i32 (struct lm_ggml_tensor * tensor, int32_t value);
41
+ LM_GGML_BACKEND_API struct lm_ggml_tensor * lm_ggml_set_f32 (struct lm_ggml_tensor * tensor, float value);
42
+
43
+ LM_GGML_BACKEND_API int32_t lm_ggml_get_i32_1d(const struct lm_ggml_tensor * tensor, int i);
44
+ LM_GGML_BACKEND_API void lm_ggml_set_i32_1d(const struct lm_ggml_tensor * tensor, int i, int32_t value);
45
+
46
+ LM_GGML_BACKEND_API int32_t lm_ggml_get_i32_nd(const struct lm_ggml_tensor * tensor, int i0, int i1, int i2, int i3);
47
+ LM_GGML_BACKEND_API void lm_ggml_set_i32_nd(const struct lm_ggml_tensor * tensor, int i0, int i1, int i2, int i3, int32_t value);
48
+
49
+ LM_GGML_BACKEND_API float lm_ggml_get_f32_1d(const struct lm_ggml_tensor * tensor, int i);
50
+ LM_GGML_BACKEND_API void lm_ggml_set_f32_1d(const struct lm_ggml_tensor * tensor, int i, float value);
51
+
52
+ LM_GGML_BACKEND_API float lm_ggml_get_f32_nd(const struct lm_ggml_tensor * tensor, int i0, int i1, int i2, int i3);
53
+ LM_GGML_BACKEND_API void lm_ggml_set_f32_nd(const struct lm_ggml_tensor * tensor, int i0, int i1, int i2, int i3, float value);
54
+
55
+ LM_GGML_BACKEND_API struct lm_ggml_threadpool * lm_ggml_threadpool_new (struct lm_ggml_threadpool_params * params);
56
+ LM_GGML_BACKEND_API void lm_ggml_threadpool_free (struct lm_ggml_threadpool * threadpool);
57
+ LM_GGML_BACKEND_API int lm_ggml_threadpool_get_n_threads (struct lm_ggml_threadpool * threadpool);
58
+ LM_GGML_BACKEND_API void lm_ggml_threadpool_pause (struct lm_ggml_threadpool * threadpool);
59
+ LM_GGML_BACKEND_API void lm_ggml_threadpool_resume (struct lm_ggml_threadpool * threadpool);
60
+
61
+ // lm_ggml_graph_plan() has to be called before lm_ggml_graph_compute()
62
+ // when plan.work_size > 0, caller must allocate memory for plan.work_data
63
+ LM_GGML_BACKEND_API struct lm_ggml_cplan lm_ggml_graph_plan(
64
+ const struct lm_ggml_cgraph * cgraph,
65
+ int n_threads, /* = LM_GGML_DEFAULT_N_THREADS */
66
+ struct lm_ggml_threadpool * threadpool /* = NULL */ );
67
+ LM_GGML_BACKEND_API enum lm_ggml_status lm_ggml_graph_compute(struct lm_ggml_cgraph * cgraph, struct lm_ggml_cplan * cplan);
68
+
69
+ // same as lm_ggml_graph_compute() but the work data is allocated as a part of the context
70
+ // note: the drawback of this API is that you must have ensured that the context has enough memory for the work data
71
+ LM_GGML_BACKEND_API enum lm_ggml_status lm_ggml_graph_compute_with_ctx(struct lm_ggml_context * ctx, struct lm_ggml_cgraph * cgraph, int n_threads);
72
+
73
+ //
74
+ // system info
75
+ //
76
+
77
+ // x86
78
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_sse3 (void);
79
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_ssse3 (void);
80
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_avx (void);
81
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_avx_vnni (void);
82
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_avx2 (void);
83
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_f16c (void);
84
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_fma (void);
85
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_avx512 (void);
86
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_avx512_vbmi(void);
87
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_avx512_vnni(void);
88
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_avx512_bf16(void);
89
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_amx_int8 (void);
90
+ // ARM
91
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_neon (void);
92
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_arm_fma (void);
93
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_fp16_va (void);
94
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_dotprod (void);
95
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_matmul_int8(void);
96
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_sve (void);
97
+ LM_GGML_BACKEND_API int lm_ggml_cpu_get_sve_cnt (void); // sve vector length in bytes
98
+ // other
99
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_riscv_v (void);
100
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_vsx (void);
101
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_wasm_simd (void);
102
+ LM_GGML_BACKEND_API int lm_ggml_cpu_has_llamafile (void);
103
+
104
+ // Internal types and functions exposed for tests and benchmarks
105
+
106
+ typedef void (*lm_ggml_vec_dot_t) (int n, float * LM_GGML_RESTRICT s, size_t bs, const void * LM_GGML_RESTRICT x, size_t bx,
107
+ const void * LM_GGML_RESTRICT y, size_t by, int nrc);
108
+
109
+ struct lm_ggml_type_traits_cpu {
110
+ lm_ggml_from_float_t from_float;
111
+ lm_ggml_vec_dot_t vec_dot;
112
+ enum lm_ggml_type vec_dot_type;
113
+ int64_t nrows; // number of rows to process simultaneously
114
+ };
115
+
116
+ LM_GGML_BACKEND_API const struct lm_ggml_type_traits_cpu * lm_ggml_get_type_traits_cpu(enum lm_ggml_type type);
117
+
118
+ LM_GGML_BACKEND_API void lm_ggml_cpu_init(void);
119
+
120
+ //
121
+ // CPU backend
122
+ //
123
+
124
+ LM_GGML_BACKEND_API lm_ggml_backend_t lm_ggml_backend_cpu_init(void);
125
+
126
+ LM_GGML_BACKEND_API bool lm_ggml_backend_is_cpu (lm_ggml_backend_t backend);
127
+ LM_GGML_BACKEND_API void lm_ggml_backend_cpu_set_n_threads (lm_ggml_backend_t backend_cpu, int n_threads);
128
+ LM_GGML_BACKEND_API void lm_ggml_backend_cpu_set_threadpool (lm_ggml_backend_t backend_cpu, lm_ggml_threadpool_t threadpool);
129
+ LM_GGML_BACKEND_API void lm_ggml_backend_cpu_set_abort_callback(lm_ggml_backend_t backend_cpu, lm_ggml_abort_callback abort_callback, void * abort_callback_data);
130
+
131
+ LM_GGML_BACKEND_API lm_ggml_backend_reg_t lm_ggml_backend_cpu_reg(void);
132
+
133
+ #ifdef __cplusplus
134
+ }
135
+ #endif