whisper.rn 0.5.0 → 0.5.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.
- package/android/build.gradle +2 -1
- package/android/gradle.properties +1 -1
- package/cpp/ggml-alloc.c +264 -126
- package/cpp/ggml-backend-impl.h +4 -1
- package/cpp/ggml-backend-reg.cpp +13 -5
- package/cpp/ggml-backend.cpp +207 -17
- package/cpp/ggml-backend.h +17 -1
- package/cpp/ggml-cpu/amx/amx.cpp +4 -2
- package/cpp/ggml-cpu/arch/x86/repack.cpp +2 -2
- package/cpp/ggml-cpu/arch-fallback.h +0 -4
- package/cpp/ggml-cpu/common.h +14 -0
- package/cpp/ggml-cpu/ggml-cpu-impl.h +13 -6
- package/cpp/ggml-cpu/ggml-cpu.c +48 -41
- package/cpp/ggml-cpu/ggml-cpu.cpp +14 -4
- package/cpp/ggml-cpu/ops.cpp +518 -767
- package/cpp/ggml-cpu/ops.h +2 -0
- package/cpp/ggml-cpu/simd-mappings.h +88 -59
- package/cpp/ggml-cpu/vec.cpp +161 -20
- package/cpp/ggml-cpu/vec.h +400 -51
- package/cpp/ggml-cpu.h +1 -1
- package/cpp/ggml-impl.h +43 -10
- package/cpp/ggml-metal/ggml-metal-common.cpp +446 -0
- package/cpp/ggml-metal/ggml-metal-common.h +52 -0
- package/cpp/ggml-metal/ggml-metal-context.h +33 -0
- package/cpp/ggml-metal/ggml-metal-context.m +600 -0
- package/cpp/ggml-metal/ggml-metal-device.cpp +1376 -0
- package/cpp/ggml-metal/ggml-metal-device.h +226 -0
- package/cpp/ggml-metal/ggml-metal-device.m +1312 -0
- package/cpp/ggml-metal/ggml-metal-impl.h +722 -0
- package/cpp/ggml-metal/ggml-metal-ops.cpp +3158 -0
- package/cpp/ggml-metal/ggml-metal-ops.h +82 -0
- package/cpp/ggml-metal/ggml-metal.cpp +718 -0
- package/cpp/ggml-metal/ggml-whisper-sim.metallib +0 -0
- package/cpp/ggml-metal/ggml-whisper.metallib +0 -0
- package/cpp/ggml-metal-impl.h +40 -40
- package/cpp/ggml-metal.h +1 -6
- package/cpp/ggml-quants.c +1 -0
- package/cpp/ggml.c +175 -13
- package/cpp/ggml.h +84 -5
- package/cpp/jsi/RNWhisperJSI.cpp +2 -0
- package/cpp/jsi/ThreadPool.h +3 -3
- package/cpp/whisper.cpp +85 -70
- package/cpp/whisper.h +1 -0
- package/ios/CMakeLists.txt +6 -1
- package/ios/RNWhisperVadContext.mm +14 -13
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-backend-impl.h +4 -1
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-backend.h +17 -1
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-cpu.h +1 -1
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-impl.h +43 -10
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-metal-impl.h +40 -40
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml-metal.h +1 -6
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/ggml.h +84 -5
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Headers/whisper.h +1 -0
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/Info.plist +0 -0
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/ggml-whisper.metallib +0 -0
- package/ios/rnwhisper.xcframework/ios-arm64/rnwhisper.framework/rnwhisper +0 -0
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-backend-impl.h +4 -1
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-backend.h +17 -1
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-cpu.h +1 -1
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-impl.h +43 -10
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-metal-impl.h +40 -40
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-metal.h +1 -6
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml.h +84 -5
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Headers/whisper.h +1 -0
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/Info.plist +0 -0
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/_CodeSignature/CodeResources +1 -1
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/ggml-whisper-sim.metallib +0 -0
- package/ios/rnwhisper.xcframework/ios-arm64_x86_64-simulator/rnwhisper.framework/rnwhisper +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-backend-impl.h +4 -1
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-backend.h +17 -1
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-cpu.h +1 -1
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-impl.h +43 -10
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-metal-impl.h +40 -40
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml-metal.h +1 -6
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/ggml.h +84 -5
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Headers/whisper.h +1 -0
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/Info.plist +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/ggml-whisper.metallib +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64/rnwhisper.framework/rnwhisper +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-backend-impl.h +4 -1
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-backend.h +17 -1
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-cpu.h +1 -1
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-impl.h +43 -10
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-metal-impl.h +40 -40
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-metal.h +1 -6
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml.h +84 -5
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/whisper.h +1 -0
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Info.plist +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/_CodeSignature/CodeResources +1 -1
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/ggml-whisper-sim.metallib +0 -0
- package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/rnwhisper +0 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/version.json +1 -1
- package/package.json +1 -1
- package/src/version.json +1 -1
- package/whisper-rn.podspec +8 -9
- package/cpp/ggml-metal.m +0 -6779
- package/cpp/ggml-whisper-sim.metallib +0 -0
- package/cpp/ggml-whisper.metallib +0 -0
package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml-cpu.h
CHANGED
|
@@ -101,7 +101,6 @@ extern "C" {
|
|
|
101
101
|
WSP_GGML_BACKEND_API int wsp_ggml_cpu_has_riscv_v (void);
|
|
102
102
|
WSP_GGML_BACKEND_API int wsp_ggml_cpu_has_vsx (void);
|
|
103
103
|
WSP_GGML_BACKEND_API int wsp_ggml_cpu_has_vxe (void);
|
|
104
|
-
WSP_GGML_BACKEND_API int wsp_ggml_cpu_has_nnpa (void);
|
|
105
104
|
WSP_GGML_BACKEND_API int wsp_ggml_cpu_has_wasm_simd (void);
|
|
106
105
|
WSP_GGML_BACKEND_API int wsp_ggml_cpu_has_llamafile (void);
|
|
107
106
|
|
|
@@ -135,6 +134,7 @@ extern "C" {
|
|
|
135
134
|
WSP_GGML_BACKEND_API wsp_ggml_backend_reg_t wsp_ggml_backend_cpu_reg(void);
|
|
136
135
|
|
|
137
136
|
WSP_GGML_BACKEND_API void wsp_ggml_cpu_fp32_to_fp32(const float *, float *, int64_t);
|
|
137
|
+
WSP_GGML_BACKEND_API void wsp_ggml_cpu_fp32_to_i32 (const float *, int32_t *, int64_t);
|
|
138
138
|
WSP_GGML_BACKEND_API void wsp_ggml_cpu_fp32_to_fp16(const float *, wsp_ggml_fp16_t *, int64_t);
|
|
139
139
|
WSP_GGML_BACKEND_API void wsp_ggml_cpu_fp16_to_fp32(const wsp_ggml_fp16_t *, float *, int64_t);
|
|
140
140
|
WSP_GGML_BACKEND_API void wsp_ggml_cpu_fp32_to_bf16(const float *, wsp_ggml_bf16_t *, int64_t);
|
|
@@ -73,7 +73,7 @@ static inline int wsp_ggml_up(int n, int m) {
|
|
|
73
73
|
return (n + m - 1) & ~(m - 1);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
// TODO: move to ggml.h?
|
|
76
|
+
// TODO: move to ggml.h? (won't be able to inline)
|
|
77
77
|
static bool wsp_ggml_are_same_layout(const struct wsp_ggml_tensor * a, const struct wsp_ggml_tensor * b) {
|
|
78
78
|
if (a->type != b->type) {
|
|
79
79
|
return false;
|
|
@@ -89,6 +89,19 @@ static bool wsp_ggml_are_same_layout(const struct wsp_ggml_tensor * a, const str
|
|
|
89
89
|
return true;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
static bool wsp_ggml_op_is_empty(enum wsp_ggml_op op) {
|
|
93
|
+
switch (op) {
|
|
94
|
+
case WSP_GGML_OP_NONE:
|
|
95
|
+
case WSP_GGML_OP_RESHAPE:
|
|
96
|
+
case WSP_GGML_OP_TRANSPOSE:
|
|
97
|
+
case WSP_GGML_OP_VIEW:
|
|
98
|
+
case WSP_GGML_OP_PERMUTE:
|
|
99
|
+
return true;
|
|
100
|
+
default:
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
92
105
|
//
|
|
93
106
|
// logging
|
|
94
107
|
//
|
|
@@ -329,6 +342,10 @@ struct wsp_ggml_cgraph {
|
|
|
329
342
|
// if you need the gradients, get them from the original graph
|
|
330
343
|
struct wsp_ggml_cgraph wsp_ggml_graph_view(struct wsp_ggml_cgraph * cgraph, int i0, int i1);
|
|
331
344
|
|
|
345
|
+
// ggml-alloc.c: true if the operation can reuse memory from its sources
|
|
346
|
+
WSP_GGML_API bool wsp_ggml_op_can_inplace(enum wsp_ggml_op op);
|
|
347
|
+
|
|
348
|
+
|
|
332
349
|
// Memory allocation
|
|
333
350
|
|
|
334
351
|
WSP_GGML_API void * wsp_ggml_aligned_malloc(size_t size);
|
|
@@ -570,27 +587,27 @@ static inline bool wsp_ggml_node_has_n_uses(const struct wsp_ggml_cgraph * cgrap
|
|
|
570
587
|
return true;
|
|
571
588
|
}
|
|
572
589
|
|
|
573
|
-
// Returns true if nodes
|
|
590
|
+
// Returns true if nodes with indices { node_idxs } are the sequence of wsp_ggml_ops in ops[]
|
|
574
591
|
// and are fusable. Nodes are considered fusable according to this function if:
|
|
575
592
|
// - all nodes except the last have only one use and are not views/outputs (see wsp_ggml_node_has_N_uses).
|
|
576
593
|
// - all nodes except the last are a src of the following node.
|
|
577
594
|
// - all nodes are the same shape.
|
|
578
595
|
// TODO: Consider allowing WSP_GGML_OP_NONE nodes in between
|
|
579
|
-
static inline bool
|
|
580
|
-
if (node_idx + num_ops > cgraph->n_nodes) {
|
|
581
|
-
return false;
|
|
582
|
-
}
|
|
583
|
-
|
|
596
|
+
static inline bool wsp_ggml_can_fuse_ext(const struct wsp_ggml_cgraph * cgraph, const int * node_idxs, const enum wsp_ggml_op * ops, int num_ops) {
|
|
584
597
|
for (int i = 0; i < num_ops; ++i) {
|
|
585
|
-
|
|
598
|
+
if (node_idxs[i] >= cgraph->n_nodes) {
|
|
599
|
+
return false;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
struct wsp_ggml_tensor * node = cgraph->nodes[node_idxs[i]];
|
|
586
603
|
if (node->op != ops[i]) {
|
|
587
604
|
return false;
|
|
588
605
|
}
|
|
589
|
-
if (i < num_ops - 1 && !wsp_ggml_node_has_n_uses(cgraph,
|
|
606
|
+
if (i < num_ops - 1 && !wsp_ggml_node_has_n_uses(cgraph, node_idxs[i], 1)) {
|
|
590
607
|
return false;
|
|
591
608
|
}
|
|
592
609
|
if (i > 0) {
|
|
593
|
-
struct wsp_ggml_tensor * prev = cgraph->nodes[
|
|
610
|
+
struct wsp_ggml_tensor * prev = cgraph->nodes[node_idxs[i - 1]];
|
|
594
611
|
if (node->src[0] != prev && node->src[1] != prev) {
|
|
595
612
|
return false;
|
|
596
613
|
}
|
|
@@ -602,6 +619,22 @@ static inline bool wsp_ggml_can_fuse(const struct wsp_ggml_cgraph * cgraph, int
|
|
|
602
619
|
return true;
|
|
603
620
|
}
|
|
604
621
|
|
|
622
|
+
// same as above, for sequential indices starting at node_idx
|
|
623
|
+
static inline bool wsp_ggml_can_fuse(const struct wsp_ggml_cgraph * cgraph, int node_idx, const enum wsp_ggml_op * ops, int num_ops) {
|
|
624
|
+
assert(num_ops < 32);
|
|
625
|
+
|
|
626
|
+
if (node_idx + num_ops > cgraph->n_nodes) {
|
|
627
|
+
return false;
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
int idxs[32];
|
|
631
|
+
for (int i = 0; i < num_ops; ++i) {
|
|
632
|
+
idxs[i] = node_idx + i;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
return wsp_ggml_can_fuse_ext(cgraph, idxs, ops, num_ops);
|
|
636
|
+
}
|
|
637
|
+
|
|
605
638
|
#ifdef __cplusplus
|
|
606
639
|
}
|
|
607
640
|
#endif
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#ifndef
|
|
2
|
-
#define
|
|
1
|
+
#ifndef WSP_WSP_WSP_GGML_METAL_IMPL
|
|
2
|
+
#define WSP_WSP_WSP_GGML_METAL_IMPL
|
|
3
3
|
|
|
4
4
|
// kernel parameters for mat-vec threadgroups
|
|
5
5
|
//
|
|
@@ -101,7 +101,7 @@ typedef struct {
|
|
|
101
101
|
uint64_t nb2;
|
|
102
102
|
uint64_t nb3;
|
|
103
103
|
int32_t dim;
|
|
104
|
-
}
|
|
104
|
+
} wsp_wsp_wsp_ggml_metal_kargs_concat;
|
|
105
105
|
|
|
106
106
|
typedef struct {
|
|
107
107
|
int32_t ne00;
|
|
@@ -130,7 +130,7 @@ typedef struct {
|
|
|
130
130
|
uint64_t nb3;
|
|
131
131
|
uint64_t offs;
|
|
132
132
|
uint64_t o1[8];
|
|
133
|
-
}
|
|
133
|
+
} wsp_wsp_wsp_ggml_metal_kargs_bin;
|
|
134
134
|
|
|
135
135
|
typedef struct {
|
|
136
136
|
int64_t ne0;
|
|
@@ -139,7 +139,7 @@ typedef struct {
|
|
|
139
139
|
size_t nb02;
|
|
140
140
|
size_t nb11;
|
|
141
141
|
size_t nb21;
|
|
142
|
-
}
|
|
142
|
+
} wsp_wsp_wsp_ggml_metal_kargs_add_id;
|
|
143
143
|
|
|
144
144
|
typedef struct {
|
|
145
145
|
int32_t ne00;
|
|
@@ -158,7 +158,7 @@ typedef struct {
|
|
|
158
158
|
uint64_t nb1;
|
|
159
159
|
uint64_t nb2;
|
|
160
160
|
uint64_t nb3;
|
|
161
|
-
}
|
|
161
|
+
} wsp_wsp_wsp_ggml_metal_kargs_repeat;
|
|
162
162
|
|
|
163
163
|
typedef struct {
|
|
164
164
|
int64_t ne00;
|
|
@@ -177,7 +177,7 @@ typedef struct {
|
|
|
177
177
|
uint64_t nb1;
|
|
178
178
|
uint64_t nb2;
|
|
179
179
|
uint64_t nb3;
|
|
180
|
-
}
|
|
180
|
+
} wsp_wsp_wsp_ggml_metal_kargs_cpy;
|
|
181
181
|
|
|
182
182
|
typedef struct {
|
|
183
183
|
int64_t ne10;
|
|
@@ -192,7 +192,7 @@ typedef struct {
|
|
|
192
192
|
uint64_t nb3;
|
|
193
193
|
uint64_t offs;
|
|
194
194
|
bool inplace;
|
|
195
|
-
}
|
|
195
|
+
} wsp_wsp_wsp_ggml_metal_kargs_set;
|
|
196
196
|
|
|
197
197
|
typedef struct {
|
|
198
198
|
int32_t ne00;
|
|
@@ -224,7 +224,7 @@ typedef struct {
|
|
|
224
224
|
int32_t sect_1;
|
|
225
225
|
int32_t sect_2;
|
|
226
226
|
int32_t sect_3;
|
|
227
|
-
}
|
|
227
|
+
} wsp_wsp_wsp_ggml_metal_kargs_rope;
|
|
228
228
|
|
|
229
229
|
typedef struct {
|
|
230
230
|
int32_t ne01;
|
|
@@ -255,7 +255,7 @@ typedef struct {
|
|
|
255
255
|
float m1;
|
|
256
256
|
int32_t n_head_log2;
|
|
257
257
|
float logit_softcap;
|
|
258
|
-
}
|
|
258
|
+
} wsp_wsp_wsp_ggml_metal_kargs_flash_attn_ext;
|
|
259
259
|
|
|
260
260
|
typedef struct {
|
|
261
261
|
int32_t ne00;
|
|
@@ -272,7 +272,7 @@ typedef struct {
|
|
|
272
272
|
int32_t ne1;
|
|
273
273
|
int16_t r2;
|
|
274
274
|
int16_t r3;
|
|
275
|
-
}
|
|
275
|
+
} wsp_wsp_wsp_ggml_metal_kargs_mul_mm;
|
|
276
276
|
|
|
277
277
|
typedef struct {
|
|
278
278
|
int32_t ne00;
|
|
@@ -293,7 +293,7 @@ typedef struct {
|
|
|
293
293
|
int32_t ne1;
|
|
294
294
|
int16_t r2;
|
|
295
295
|
int16_t r3;
|
|
296
|
-
}
|
|
296
|
+
} wsp_wsp_wsp_ggml_metal_kargs_mul_mv;
|
|
297
297
|
|
|
298
298
|
typedef struct {
|
|
299
299
|
int32_t ne00;
|
|
@@ -317,7 +317,7 @@ typedef struct {
|
|
|
317
317
|
int16_t nsg;
|
|
318
318
|
int16_t nxpsg;
|
|
319
319
|
int16_t r1ptg;
|
|
320
|
-
}
|
|
320
|
+
} wsp_wsp_wsp_ggml_metal_kargs_mul_mv_ext;
|
|
321
321
|
|
|
322
322
|
typedef struct {
|
|
323
323
|
int32_t ne10;
|
|
@@ -328,7 +328,7 @@ typedef struct {
|
|
|
328
328
|
uint64_t nbh11;
|
|
329
329
|
int32_t ne20; // n_expert_used
|
|
330
330
|
uint64_t nb21;
|
|
331
|
-
}
|
|
331
|
+
} wsp_wsp_wsp_ggml_metal_kargs_mul_mm_id_map0;
|
|
332
332
|
|
|
333
333
|
typedef struct {
|
|
334
334
|
int32_t ne20; // n_expert_used
|
|
@@ -339,7 +339,7 @@ typedef struct {
|
|
|
339
339
|
int32_t ne0;
|
|
340
340
|
uint64_t nb1;
|
|
341
341
|
uint64_t nb2;
|
|
342
|
-
}
|
|
342
|
+
} wsp_wsp_wsp_ggml_metal_kargs_mul_mm_id_map1;
|
|
343
343
|
|
|
344
344
|
typedef struct {
|
|
345
345
|
int32_t ne00;
|
|
@@ -356,7 +356,7 @@ typedef struct {
|
|
|
356
356
|
int32_t neh1;
|
|
357
357
|
int16_t r2;
|
|
358
358
|
int16_t r3;
|
|
359
|
-
}
|
|
359
|
+
} wsp_wsp_wsp_ggml_metal_kargs_mul_mm_id;
|
|
360
360
|
|
|
361
361
|
typedef struct {
|
|
362
362
|
int32_t nei0;
|
|
@@ -378,14 +378,14 @@ typedef struct {
|
|
|
378
378
|
int32_t ne0;
|
|
379
379
|
int32_t ne1;
|
|
380
380
|
uint64_t nb1;
|
|
381
|
-
}
|
|
381
|
+
} wsp_wsp_wsp_ggml_metal_kargs_mul_mv_id;
|
|
382
382
|
|
|
383
383
|
typedef struct {
|
|
384
384
|
int32_t ne00;
|
|
385
385
|
int32_t ne00_4;
|
|
386
386
|
uint64_t nb01;
|
|
387
387
|
float eps;
|
|
388
|
-
}
|
|
388
|
+
} wsp_wsp_wsp_ggml_metal_kargs_norm;
|
|
389
389
|
|
|
390
390
|
typedef struct {
|
|
391
391
|
int32_t ne00;
|
|
@@ -400,14 +400,14 @@ typedef struct {
|
|
|
400
400
|
uint64_t nbf1[3];
|
|
401
401
|
uint64_t nbf2[3];
|
|
402
402
|
uint64_t nbf3[3];
|
|
403
|
-
}
|
|
403
|
+
} wsp_wsp_wsp_ggml_metal_kargs_rms_norm;
|
|
404
404
|
|
|
405
405
|
typedef struct {
|
|
406
406
|
int32_t ne00;
|
|
407
407
|
int32_t ne00_4;
|
|
408
408
|
uint64_t nb01;
|
|
409
409
|
float eps;
|
|
410
|
-
}
|
|
410
|
+
} wsp_wsp_wsp_ggml_metal_kargs_l2_norm;
|
|
411
411
|
|
|
412
412
|
typedef struct {
|
|
413
413
|
int64_t ne00;
|
|
@@ -418,7 +418,7 @@ typedef struct {
|
|
|
418
418
|
uint64_t nb02;
|
|
419
419
|
int32_t n_groups;
|
|
420
420
|
float eps;
|
|
421
|
-
}
|
|
421
|
+
} wsp_wsp_wsp_ggml_metal_kargs_group_norm;
|
|
422
422
|
|
|
423
423
|
typedef struct {
|
|
424
424
|
int32_t IC;
|
|
@@ -427,7 +427,7 @@ typedef struct {
|
|
|
427
427
|
int32_t s0;
|
|
428
428
|
uint64_t nb0;
|
|
429
429
|
uint64_t nb1;
|
|
430
|
-
}
|
|
430
|
+
} wsp_wsp_wsp_ggml_metal_kargs_conv_transpose_1d;
|
|
431
431
|
|
|
432
432
|
typedef struct {
|
|
433
433
|
uint64_t ofs0;
|
|
@@ -445,7 +445,7 @@ typedef struct {
|
|
|
445
445
|
int32_t KH;
|
|
446
446
|
int32_t KW;
|
|
447
447
|
int32_t KHW; // KH * KW, pre-computed on CPU to save GPU resources
|
|
448
|
-
}
|
|
448
|
+
} wsp_wsp_wsp_ggml_metal_kargs_im2col;
|
|
449
449
|
|
|
450
450
|
typedef struct{
|
|
451
451
|
int32_t ne00;
|
|
@@ -458,7 +458,7 @@ typedef struct{
|
|
|
458
458
|
int32_t i10;
|
|
459
459
|
float alpha;
|
|
460
460
|
float limit;
|
|
461
|
-
}
|
|
461
|
+
} wsp_wsp_wsp_ggml_metal_kargs_glu;
|
|
462
462
|
|
|
463
463
|
typedef struct {
|
|
464
464
|
int64_t ne00;
|
|
@@ -485,7 +485,7 @@ typedef struct {
|
|
|
485
485
|
uint64_t nb1;
|
|
486
486
|
uint64_t nb2;
|
|
487
487
|
uint64_t nb3;
|
|
488
|
-
}
|
|
488
|
+
} wsp_wsp_wsp_ggml_metal_kargs_sum_rows;
|
|
489
489
|
|
|
490
490
|
typedef struct {
|
|
491
491
|
int32_t ne00;
|
|
@@ -508,13 +508,13 @@ typedef struct {
|
|
|
508
508
|
float m0;
|
|
509
509
|
float m1;
|
|
510
510
|
int32_t n_head_log2;
|
|
511
|
-
}
|
|
511
|
+
} wsp_wsp_wsp_ggml_metal_kargs_soft_max;
|
|
512
512
|
|
|
513
513
|
typedef struct {
|
|
514
514
|
int64_t ne00;
|
|
515
515
|
int64_t ne01;
|
|
516
516
|
int n_past;
|
|
517
|
-
}
|
|
517
|
+
} wsp_wsp_wsp_ggml_metal_kargs_diag_mask_inf;
|
|
518
518
|
|
|
519
519
|
typedef struct {
|
|
520
520
|
int64_t ne00;
|
|
@@ -533,7 +533,7 @@ typedef struct {
|
|
|
533
533
|
uint64_t nb0;
|
|
534
534
|
uint64_t nb1;
|
|
535
535
|
uint64_t nb2;
|
|
536
|
-
}
|
|
536
|
+
} wsp_wsp_wsp_ggml_metal_kargs_ssm_conv;
|
|
537
537
|
|
|
538
538
|
typedef struct {
|
|
539
539
|
int64_t d_state;
|
|
@@ -558,7 +558,7 @@ typedef struct {
|
|
|
558
558
|
uint64_t nb51;
|
|
559
559
|
uint64_t nb52;
|
|
560
560
|
uint64_t nb53;
|
|
561
|
-
}
|
|
561
|
+
} wsp_wsp_wsp_ggml_metal_kargs_ssm_scan;
|
|
562
562
|
|
|
563
563
|
typedef struct {
|
|
564
564
|
int64_t ne00;
|
|
@@ -569,7 +569,7 @@ typedef struct {
|
|
|
569
569
|
uint64_t nb11;
|
|
570
570
|
uint64_t nb1;
|
|
571
571
|
uint64_t nb2;
|
|
572
|
-
}
|
|
572
|
+
} wsp_wsp_wsp_ggml_metal_kargs_get_rows;
|
|
573
573
|
|
|
574
574
|
typedef struct {
|
|
575
575
|
int32_t nk0;
|
|
@@ -585,7 +585,7 @@ typedef struct {
|
|
|
585
585
|
uint64_t nb1;
|
|
586
586
|
uint64_t nb2;
|
|
587
587
|
uint64_t nb3;
|
|
588
|
-
}
|
|
588
|
+
} wsp_wsp_wsp_ggml_metal_kargs_set_rows;
|
|
589
589
|
|
|
590
590
|
typedef struct {
|
|
591
591
|
int64_t ne00;
|
|
@@ -608,7 +608,7 @@ typedef struct {
|
|
|
608
608
|
float sf1;
|
|
609
609
|
float sf2;
|
|
610
610
|
float sf3;
|
|
611
|
-
}
|
|
611
|
+
} wsp_wsp_wsp_ggml_metal_kargs_upscale;
|
|
612
612
|
|
|
613
613
|
typedef struct {
|
|
614
614
|
int64_t ne00;
|
|
@@ -627,7 +627,7 @@ typedef struct {
|
|
|
627
627
|
uint64_t nb1;
|
|
628
628
|
uint64_t nb2;
|
|
629
629
|
uint64_t nb3;
|
|
630
|
-
}
|
|
630
|
+
} wsp_wsp_wsp_ggml_metal_kargs_pad;
|
|
631
631
|
|
|
632
632
|
typedef struct {
|
|
633
633
|
int64_t ne00;
|
|
@@ -648,28 +648,28 @@ typedef struct {
|
|
|
648
648
|
uint64_t nb3;
|
|
649
649
|
int32_t p0;
|
|
650
650
|
int32_t p1;
|
|
651
|
-
}
|
|
651
|
+
} wsp_wsp_wsp_ggml_metal_kargs_pad_reflect_1d;
|
|
652
652
|
|
|
653
653
|
typedef struct {
|
|
654
654
|
uint64_t nb1;
|
|
655
655
|
int dim;
|
|
656
656
|
int max_period;
|
|
657
|
-
}
|
|
657
|
+
} wsp_wsp_wsp_ggml_metal_kargs_timestep_embedding;
|
|
658
658
|
|
|
659
659
|
typedef struct {
|
|
660
660
|
float slope;
|
|
661
|
-
}
|
|
661
|
+
} wsp_wsp_wsp_ggml_metal_kargs_leaky_relu;
|
|
662
662
|
|
|
663
663
|
typedef struct {
|
|
664
664
|
int64_t ncols;
|
|
665
665
|
int64_t ncols_pad;
|
|
666
|
-
}
|
|
666
|
+
} wsp_wsp_wsp_ggml_metal_kargs_argsort;
|
|
667
667
|
|
|
668
668
|
typedef struct {
|
|
669
669
|
int64_t ne0;
|
|
670
670
|
float start;
|
|
671
671
|
float step;
|
|
672
|
-
}
|
|
672
|
+
} wsp_wsp_wsp_ggml_metal_kargs_arange;
|
|
673
673
|
|
|
674
674
|
typedef struct {
|
|
675
675
|
int32_t k0;
|
|
@@ -683,6 +683,6 @@ typedef struct {
|
|
|
683
683
|
int64_t OH;
|
|
684
684
|
int64_t OW;
|
|
685
685
|
int64_t parallel_elements;
|
|
686
|
-
}
|
|
686
|
+
} wsp_wsp_wsp_ggml_metal_kargs_pool_2d;
|
|
687
687
|
|
|
688
|
-
#endif //
|
|
688
|
+
#endif // WSP_WSP_WSP_GGML_METAL_IMPL
|
|
@@ -39,18 +39,13 @@ extern "C" {
|
|
|
39
39
|
// user-code should use only these functions
|
|
40
40
|
//
|
|
41
41
|
|
|
42
|
+
// TODO: remove in the future
|
|
42
43
|
WSP_GGML_BACKEND_API wsp_ggml_backend_t wsp_ggml_backend_metal_init(void);
|
|
43
44
|
|
|
44
45
|
WSP_GGML_BACKEND_API bool wsp_ggml_backend_is_metal(wsp_ggml_backend_t backend);
|
|
45
46
|
|
|
46
|
-
WSP_GGML_DEPRECATED(
|
|
47
|
-
WSP_GGML_BACKEND_API wsp_ggml_backend_buffer_t wsp_ggml_backend_metal_buffer_from_ptr(void * data, size_t size, size_t max_size),
|
|
48
|
-
"obsoleted by the new device interface - https://github.com/ggml-org/llama.cpp/pull/9713");
|
|
49
|
-
|
|
50
47
|
WSP_GGML_BACKEND_API void wsp_ggml_backend_metal_set_abort_callback(wsp_ggml_backend_t backend, wsp_ggml_abort_callback abort_callback, void * user_data);
|
|
51
48
|
|
|
52
|
-
WSP_GGML_BACKEND_API wsp_ggml_backend_buffer_type_t wsp_ggml_backend_metal_buffer_type(void);
|
|
53
|
-
|
|
54
49
|
// helper to check if the device supports a specific family
|
|
55
50
|
// ideally, the user code should be doing these checks
|
|
56
51
|
// ref: https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
|
package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/ggml.h
CHANGED
|
@@ -244,6 +244,13 @@
|
|
|
244
244
|
#define WSP_GGML_MROPE_SECTIONS 4
|
|
245
245
|
|
|
246
246
|
#define WSP_GGML_UNUSED(x) (void)(x)
|
|
247
|
+
#ifdef __CUDACC__
|
|
248
|
+
template<typename... Args>
|
|
249
|
+
__host__ __device__ constexpr inline void wsp_ggml_unused_vars_impl(Args&&...) noexcept {}
|
|
250
|
+
#define WSP_GGML_UNUSED_VARS(...) wsp_ggml_unused_vars_impl(__VA_ARGS__)
|
|
251
|
+
#else
|
|
252
|
+
#define WSP_GGML_UNUSED_VARS(...) do { (void)sizeof((__VA_ARGS__, 0)); } while(0)
|
|
253
|
+
#endif // __CUDACC__
|
|
247
254
|
|
|
248
255
|
#define WSP_GGML_PAD(x, n) (((x) + (n) - 1) & ~((n) - 1))
|
|
249
256
|
|
|
@@ -277,19 +284,19 @@
|
|
|
277
284
|
// WSP_GGML_TENSOR_LOCALS(size_t, nb1, src1, nb);
|
|
278
285
|
//
|
|
279
286
|
#define WSP_GGML_TENSOR_LOCALS_1(type, prefix, pointer, array) \
|
|
280
|
-
const type prefix##0 = (pointer)->array[0]; \
|
|
287
|
+
const type prefix##0 = (pointer) ? (pointer)->array[0] : 0; \
|
|
281
288
|
WSP_GGML_UNUSED(prefix##0);
|
|
282
289
|
#define WSP_GGML_TENSOR_LOCALS_2(type, prefix, pointer, array) \
|
|
283
290
|
WSP_GGML_TENSOR_LOCALS_1 (type, prefix, pointer, array) \
|
|
284
|
-
const type prefix##1 = (pointer)->array[1]; \
|
|
291
|
+
const type prefix##1 = (pointer) ? (pointer)->array[1] : 0; \
|
|
285
292
|
WSP_GGML_UNUSED(prefix##1);
|
|
286
293
|
#define WSP_GGML_TENSOR_LOCALS_3(type, prefix, pointer, array) \
|
|
287
294
|
WSP_GGML_TENSOR_LOCALS_2 (type, prefix, pointer, array) \
|
|
288
|
-
const type prefix##2 = (pointer)->array[2]; \
|
|
295
|
+
const type prefix##2 = (pointer) ? (pointer)->array[2] : 0; \
|
|
289
296
|
WSP_GGML_UNUSED(prefix##2);
|
|
290
297
|
#define WSP_GGML_TENSOR_LOCALS(type, prefix, pointer, array) \
|
|
291
298
|
WSP_GGML_TENSOR_LOCALS_3 (type, prefix, pointer, array) \
|
|
292
|
-
const type prefix##3 = (pointer)->array[3]; \
|
|
299
|
+
const type prefix##3 = (pointer) ? (pointer)->array[3] : 0; \
|
|
293
300
|
WSP_GGML_UNUSED(prefix##3);
|
|
294
301
|
|
|
295
302
|
#define WSP_GGML_TENSOR_UNARY_OP_LOCALS \
|
|
@@ -504,7 +511,9 @@ extern "C" {
|
|
|
504
511
|
WSP_GGML_OP_CONV_TRANSPOSE_1D,
|
|
505
512
|
WSP_GGML_OP_IM2COL,
|
|
506
513
|
WSP_GGML_OP_IM2COL_BACK,
|
|
514
|
+
WSP_GGML_OP_IM2COL_3D,
|
|
507
515
|
WSP_GGML_OP_CONV_2D,
|
|
516
|
+
WSP_GGML_OP_CONV_3D,
|
|
508
517
|
WSP_GGML_OP_CONV_2D_DW,
|
|
509
518
|
WSP_GGML_OP_CONV_TRANSPOSE_2D,
|
|
510
519
|
WSP_GGML_OP_POOL_1D,
|
|
@@ -1395,6 +1404,7 @@ extern "C" {
|
|
|
1395
1404
|
struct wsp_ggml_tensor * a,
|
|
1396
1405
|
struct wsp_ggml_tensor * b);
|
|
1397
1406
|
|
|
1407
|
+
// note: casting from f32 to i32 will discard the fractional part
|
|
1398
1408
|
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_cast(
|
|
1399
1409
|
struct wsp_ggml_context * ctx,
|
|
1400
1410
|
struct wsp_ggml_tensor * a,
|
|
@@ -1519,7 +1529,11 @@ extern "C" {
|
|
|
1519
1529
|
struct wsp_ggml_context * ctx,
|
|
1520
1530
|
struct wsp_ggml_tensor * a);
|
|
1521
1531
|
|
|
1522
|
-
// supports
|
|
1532
|
+
// supports 4D a:
|
|
1533
|
+
// a [n_embd, ne1, ne2, ne3]
|
|
1534
|
+
// b I32 [n_rows, ne2, ne3, 1]
|
|
1535
|
+
//
|
|
1536
|
+
// return [n_embd, n_rows, ne2, ne3]
|
|
1523
1537
|
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_get_rows(
|
|
1524
1538
|
struct wsp_ggml_context * ctx,
|
|
1525
1539
|
struct wsp_ggml_tensor * a, // data
|
|
@@ -1862,6 +1876,41 @@ extern "C" {
|
|
|
1862
1876
|
int d0, // dilation dimension 0
|
|
1863
1877
|
int d1); // dilation dimension 1
|
|
1864
1878
|
|
|
1879
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_im2col_3d(
|
|
1880
|
+
struct wsp_ggml_context * ctx,
|
|
1881
|
+
struct wsp_ggml_tensor * a,
|
|
1882
|
+
struct wsp_ggml_tensor * b,
|
|
1883
|
+
int64_t IC,
|
|
1884
|
+
int s0, // stride width
|
|
1885
|
+
int s1, // stride height
|
|
1886
|
+
int s2, // stride depth
|
|
1887
|
+
int p0, // padding width
|
|
1888
|
+
int p1, // padding height
|
|
1889
|
+
int p2, // padding depth
|
|
1890
|
+
int d0, // dilation width
|
|
1891
|
+
int d1, // dilation height
|
|
1892
|
+
int d2, // dilation depth
|
|
1893
|
+
enum wsp_ggml_type dst_type);
|
|
1894
|
+
|
|
1895
|
+
// a: [OC*IC, KD, KH, KW]
|
|
1896
|
+
// b: [N*IC, ID, IH, IW]
|
|
1897
|
+
// result: [N*OC, OD, OH, OW]
|
|
1898
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_conv_3d(
|
|
1899
|
+
struct wsp_ggml_context * ctx,
|
|
1900
|
+
struct wsp_ggml_tensor * a,
|
|
1901
|
+
struct wsp_ggml_tensor * b,
|
|
1902
|
+
int64_t IC,
|
|
1903
|
+
int s0, // stride width
|
|
1904
|
+
int s1, // stride height
|
|
1905
|
+
int s2, // stride depth
|
|
1906
|
+
int p0, // padding width
|
|
1907
|
+
int p1, // padding height
|
|
1908
|
+
int p2, // padding depth
|
|
1909
|
+
int d0, // dilation width
|
|
1910
|
+
int d1, // dilation height
|
|
1911
|
+
int d2 // dilation depth
|
|
1912
|
+
);
|
|
1913
|
+
|
|
1865
1914
|
// kernel size is a->ne[0] x a->ne[1]
|
|
1866
1915
|
// stride is equal to kernel size
|
|
1867
1916
|
// padding is zero
|
|
@@ -1933,6 +1982,23 @@ extern "C" {
|
|
|
1933
1982
|
int d0, // dilation dimension 0
|
|
1934
1983
|
int d1); // dilation dimension 1
|
|
1935
1984
|
|
|
1985
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_conv_3d_direct(
|
|
1986
|
+
struct wsp_ggml_context * ctx,
|
|
1987
|
+
struct wsp_ggml_tensor * a, // kernel [KW, KH, KD, IC * OC]
|
|
1988
|
+
struct wsp_ggml_tensor * b, // input [W, H, D, C * N]
|
|
1989
|
+
int s0, // stride
|
|
1990
|
+
int s1,
|
|
1991
|
+
int s2,
|
|
1992
|
+
int p0, // padding
|
|
1993
|
+
int p1,
|
|
1994
|
+
int p2,
|
|
1995
|
+
int d0, // dilation
|
|
1996
|
+
int d1,
|
|
1997
|
+
int d2,
|
|
1998
|
+
int n_channels,
|
|
1999
|
+
int n_batch,
|
|
2000
|
+
int n_channels_out);
|
|
2001
|
+
|
|
1936
2002
|
enum wsp_ggml_op_pool {
|
|
1937
2003
|
WSP_GGML_OP_POOL_MAX,
|
|
1938
2004
|
WSP_GGML_OP_POOL_AVG,
|
|
@@ -2023,6 +2089,19 @@ extern "C" {
|
|
|
2023
2089
|
int p2,
|
|
2024
2090
|
int p3);
|
|
2025
2091
|
|
|
2092
|
+
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_pad_ext(
|
|
2093
|
+
struct wsp_ggml_context * ctx,
|
|
2094
|
+
struct wsp_ggml_tensor * a,
|
|
2095
|
+
int lp0,
|
|
2096
|
+
int rp0,
|
|
2097
|
+
int lp1,
|
|
2098
|
+
int rp1,
|
|
2099
|
+
int lp2,
|
|
2100
|
+
int rp2,
|
|
2101
|
+
int lp3,
|
|
2102
|
+
int rp3
|
|
2103
|
+
);
|
|
2104
|
+
|
|
2026
2105
|
// pad each dimension with reflection: [a, b, c, d] -> [b, a, b, c, d, c]
|
|
2027
2106
|
WSP_GGML_API struct wsp_ggml_tensor * wsp_ggml_pad_reflect_1d(
|
|
2028
2107
|
struct wsp_ggml_context * ctx,
|
package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Headers/whisper.h
CHANGED
|
@@ -526,6 +526,7 @@ extern "C" {
|
|
|
526
526
|
// use whisper_tokenize() to convert text to tokens
|
|
527
527
|
// maximum of whisper_n_text_ctx()/2 tokens are used (typically 224)
|
|
528
528
|
const char * initial_prompt;
|
|
529
|
+
bool carry_initial_prompt; // if true, always prepend initial_prompt to every decode window (may reduce conditioning on previous text)
|
|
529
530
|
const whisper_token * prompt_tokens;
|
|
530
531
|
int prompt_n_tokens;
|
|
531
532
|
|
package/ios/rnwhisper.xcframework/tvos-arm64_x86_64-simulator/rnwhisper.framework/Info.plist
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.
|
|
1
|
+
{"version":"1.8.0"}
|
package/lib/module/version.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.
|
|
1
|
+
{"version":"1.8.0"}
|
package/package.json
CHANGED
package/src/version.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.
|
|
1
|
+
{"version":"1.8.0"}
|