llama_cpp 0.12.2 → 0.12.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +2 -2
- data/ext/llama_cpp/extconf.rb +1 -0
- data/ext/llama_cpp/llama_cpp.cpp +68 -6
- data/lib/llama_cpp/version.rb +2 -2
- data/sig/llama_cpp.rbs +6 -2
- data/vendor/tmp/llama.cpp/Makefile +25 -3
- data/vendor/tmp/llama.cpp/ggml-alloc.c +87 -27
- data/vendor/tmp/llama.cpp/ggml-backend-impl.h +6 -0
- data/vendor/tmp/llama.cpp/ggml-backend.c +176 -18
- data/vendor/tmp/llama.cpp/ggml-backend.h +14 -0
- data/vendor/tmp/llama.cpp/ggml-kompute.cpp +1990 -0
- data/vendor/tmp/llama.cpp/ggml-kompute.h +46 -0
- data/vendor/tmp/llama.cpp/ggml-metal.h +3 -0
- data/vendor/tmp/llama.cpp/ggml-metal.m +144 -113
- data/vendor/tmp/llama.cpp/ggml-metal.metal +303 -4
- data/vendor/tmp/llama.cpp/ggml-opencl.cpp +95 -3
- data/vendor/tmp/llama.cpp/ggml-opencl.h +1 -0
- data/vendor/tmp/llama.cpp/ggml-quants.c +736 -59
- data/vendor/tmp/llama.cpp/ggml-quants.h +20 -1
- data/vendor/tmp/llama.cpp/ggml-sycl.cpp +15255 -0
- data/vendor/tmp/llama.cpp/ggml-sycl.h +29 -0
- data/vendor/tmp/llama.cpp/ggml-vulkan-shaders.hpp +60854 -0
- data/vendor/tmp/llama.cpp/ggml-vulkan.cpp +5270 -0
- data/vendor/tmp/llama.cpp/ggml-vulkan.h +34 -0
- data/vendor/tmp/llama.cpp/ggml.c +664 -117
- data/vendor/tmp/llama.cpp/ggml.h +46 -11
- data/vendor/tmp/llama.cpp/llama.cpp +1426 -341
- data/vendor/tmp/llama.cpp/llama.h +24 -15
- data/vendor/tmp/llama.cpp/unicode.h +2 -1
- metadata +10 -3
@@ -166,7 +166,7 @@ typedef struct {
|
|
166
166
|
static_assert(sizeof(block_q8_K) == sizeof(float) + QK_K + QK_K/16*sizeof(int16_t), "wrong q8_K block size/padding");
|
167
167
|
|
168
168
|
// (Almost) "true" 2-bit quantization.
|
169
|
-
// Due to the need to use blocks as per ggml
|
169
|
+
// Due to the need to use blocks as per ggml design, it ends up using
|
170
170
|
// 2.0625 bpw because of the 16-bit scale for each block of 256.
|
171
171
|
typedef struct {
|
172
172
|
ggml_fp16_t d;
|
@@ -182,6 +182,15 @@ typedef struct {
|
|
182
182
|
} block_iq2_xs;
|
183
183
|
static_assert(sizeof(block_iq2_xs) == sizeof(ggml_fp16_t) + QK_K/8*sizeof(uint16_t) + QK_K/32, "wrong iq2_xs block size/padding");
|
184
184
|
|
185
|
+
// (Almost) "true" 3-bit quantization.
|
186
|
+
// Due to the need to use blocks as per ggml design, it ends up using
|
187
|
+
// 3.0625 bpw because of the 16-bit scale for each block of 256.
|
188
|
+
typedef struct {
|
189
|
+
ggml_fp16_t d;
|
190
|
+
uint8_t qs[3*QK_K/8];
|
191
|
+
} block_iq3_xxs;
|
192
|
+
static_assert(sizeof(block_iq3_xxs) == sizeof(ggml_fp16_t) + 3*(QK_K/8), "wrong iq3_xxs block size/padding");
|
193
|
+
|
185
194
|
// Quantization
|
186
195
|
void quantize_row_q4_0_reference(const float * restrict x, block_q4_0 * restrict y, int k);
|
187
196
|
void quantize_row_q4_1_reference(const float * restrict x, block_q4_1 * restrict y, int k);
|
@@ -196,6 +205,7 @@ void quantize_row_q4_K_reference(const float * restrict x, block_q4_K * restrict
|
|
196
205
|
void quantize_row_q5_K_reference(const float * restrict x, block_q5_K * restrict y, int k);
|
197
206
|
void quantize_row_q6_K_reference(const float * restrict x, block_q6_K * restrict y, int k);
|
198
207
|
void quantize_row_q8_K_reference(const float * restrict x, block_q8_K * restrict y, int k);
|
208
|
+
void quantize_row_iq3_xxs_reference(const float * restrict x, block_iq3_xxs * restrict y, int k);
|
199
209
|
|
200
210
|
void quantize_row_q4_0(const float * restrict x, void * restrict y, int k);
|
201
211
|
void quantize_row_q4_1(const float * restrict x, void * restrict y, int k);
|
@@ -210,6 +220,7 @@ void quantize_row_q4_K(const float * restrict x, void * restrict y, int k);
|
|
210
220
|
void quantize_row_q5_K(const float * restrict x, void * restrict y, int k);
|
211
221
|
void quantize_row_q6_K(const float * restrict x, void * restrict y, int k);
|
212
222
|
void quantize_row_q8_K(const float * restrict x, void * restrict y, int k);
|
223
|
+
void quantize_row_iq3_xxs(const float * restrict x, void * restrict y, int k);
|
213
224
|
|
214
225
|
// Dequantization
|
215
226
|
void dequantize_row_q4_0(const block_q4_0 * restrict x, float * restrict y, int k);
|
@@ -227,6 +238,7 @@ void dequantize_row_q6_K(const block_q6_K * restrict x, float * restrict y, int
|
|
227
238
|
void dequantize_row_q8_K(const block_q8_K * restrict x, float * restrict y, int k);
|
228
239
|
void dequantize_row_iq2_xxs(const block_iq2_xxs * restrict x, float * restrict y, int k);
|
229
240
|
void dequantize_row_iq2_xs (const block_iq2_xs * restrict x, float * restrict y, int k);
|
241
|
+
void dequantize_row_iq3_xxs(const block_iq3_xxs * restrict x, float * restrict y, int k);
|
230
242
|
|
231
243
|
// Dot product
|
232
244
|
void ggml_vec_dot_q4_0_q8_0(int n, float * restrict s, const void * restrict vx, const void * restrict vy);
|
@@ -242,12 +254,14 @@ void ggml_vec_dot_q5_K_q8_K(int n, float * restrict s, const void * restrict vx,
|
|
242
254
|
void ggml_vec_dot_q6_K_q8_K(int n, float * restrict s, const void * restrict vx, const void * restrict vy);
|
243
255
|
void ggml_vec_dot_iq2_xxs_q8_K(int n, float * restrict s, const void * restrict vx, const void * restrict vy);
|
244
256
|
void ggml_vec_dot_iq2_xs_q8_K (int n, float * restrict s, const void * restrict vx, const void * restrict vy);
|
257
|
+
void ggml_vec_dot_iq3_xxs_q8_K(int n, float * restrict s, const void * restrict vx, const void * restrict vy);
|
245
258
|
|
246
259
|
//
|
247
260
|
// Quantization utilizing an importance matrix (a.k.a. "Activation aWare Quantization")
|
248
261
|
//
|
249
262
|
size_t quantize_iq2_xxs(const float * src, void * dst, int nrows, int n_per_row, int64_t * hist, const float * imatrix);
|
250
263
|
size_t quantize_iq2_xs (const float * src, void * dst, int nrows, int n_per_row, int64_t * hist, const float * imatrix);
|
264
|
+
size_t quantize_iq3_xxs(const float * src, void * dst, int nrows, int n_per_row, int64_t * hist, const float * imatrix);
|
251
265
|
size_t quantize_q2_K (const float * src, void * dst, int nrows, int n_per_row, int64_t * hist, const float * imatrix);
|
252
266
|
size_t quantize_q3_K (const float * src, void * dst, int nrows, int n_per_row, int64_t * hist, const float * imatrix);
|
253
267
|
size_t quantize_q4_K (const float * src, void * dst, int nrows, int n_per_row, int64_t * hist, const float * imatrix);
|
@@ -257,3 +271,8 @@ size_t quantize_q4_0 (const float * src, void * dst, int nrows, int n_per_row,
|
|
257
271
|
size_t quantize_q4_1 (const float * src, void * dst, int nrows, int n_per_row, int64_t * hist, const float * imatrix);
|
258
272
|
size_t quantize_q5_0 (const float * src, void * dst, int nrows, int n_per_row, int64_t * hist, const float * imatrix);
|
259
273
|
size_t quantize_q5_1 (const float * src, void * dst, int nrows, int n_per_row, int64_t * hist, const float * imatrix);
|
274
|
+
|
275
|
+
void iq2xs_init_impl(int grid_size);
|
276
|
+
void iq2xs_free_impl(int grid_size);
|
277
|
+
void iq3xs_init_impl(int grid_size);
|
278
|
+
void iq3xs_free_impl(int grid_size);
|