whisper.rn 0.4.0-rc.10 → 0.4.0-rc.12

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 (46) hide show
  1. package/android/src/main/CMakeLists.txt +9 -3
  2. package/cpp/amx/amx.cpp +220 -0
  3. package/cpp/amx/amx.h +8 -0
  4. package/cpp/amx/common.h +91 -0
  5. package/cpp/amx/mmq.cpp +2511 -0
  6. package/cpp/amx/mmq.h +10 -0
  7. package/cpp/ggml-alloc.c +6 -14
  8. package/cpp/ggml-backend-impl.h +50 -11
  9. package/cpp/ggml-backend-reg.cpp +409 -31
  10. package/cpp/ggml-backend.cpp +9 -3
  11. package/cpp/ggml-backend.h +18 -0
  12. package/cpp/ggml-common.h +41 -43
  13. package/cpp/ggml-cpp.h +1 -0
  14. package/cpp/{ggml-cpu-aarch64.c → ggml-cpu-aarch64.cpp} +941 -254
  15. package/cpp/ggml-cpu-aarch64.h +2 -24
  16. package/cpp/ggml-cpu-impl.h +171 -11
  17. package/cpp/ggml-cpu-quants.c +1812 -389
  18. package/cpp/ggml-cpu-traits.cpp +36 -0
  19. package/cpp/ggml-cpu-traits.h +38 -0
  20. package/cpp/ggml-cpu.c +1432 -610
  21. package/cpp/ggml-cpu.cpp +131 -141
  22. package/cpp/ggml-cpu.h +10 -50
  23. package/cpp/ggml-impl.h +27 -11
  24. package/cpp/ggml-metal-impl.h +39 -0
  25. package/cpp/ggml-metal.h +1 -1
  26. package/cpp/ggml-metal.m +1031 -359
  27. package/cpp/ggml-opt.cpp +854 -0
  28. package/cpp/ggml-opt.h +216 -0
  29. package/cpp/ggml-quants.c +0 -9
  30. package/cpp/ggml-threading.h +4 -2
  31. package/cpp/ggml-whisper.metallib +0 -0
  32. package/cpp/ggml.c +501 -1537
  33. package/cpp/ggml.h +144 -171
  34. package/cpp/gguf.cpp +1329 -0
  35. package/cpp/gguf.h +202 -0
  36. package/cpp/whisper.cpp +254 -114
  37. package/cpp/whisper.h +6 -3
  38. package/lib/commonjs/version.json +1 -1
  39. package/lib/module/version.json +1 -1
  40. package/package.json +2 -1
  41. package/src/version.json +1 -1
  42. package/whisper-rn.podspec +2 -2
  43. package/cpp/README.md +0 -4
  44. package/cpp/ggml-aarch64.c +0 -129
  45. package/cpp/ggml-aarch64.h +0 -19
  46. package/cpp/ggml-backend.cpp.rej +0 -12
@@ -0,0 +1,36 @@
1
+ #include "ggml-cpu-traits.h"
2
+
3
+ #include "ggml-backend-impl.h"
4
+ #include "ggml-backend.h"
5
+
6
+ namespace ggml::cpu {
7
+ tensor_traits::~tensor_traits() {}
8
+
9
+ extra_buffer_type::~extra_buffer_type() {}
10
+ } // namespace ggml::cpu
11
+
12
+ bool wsp_ggml_cpu_extra_compute_forward(struct wsp_ggml_compute_params * params, struct wsp_ggml_tensor * op) {
13
+ for (auto extra : wsp_ggml_backend_cpu_get_extra_buffers_type()) {
14
+ if (extra && extra->context) {
15
+ auto buf_extra = (ggml::cpu::extra_buffer_type *) extra->context;
16
+ auto tensor_traits = buf_extra->get_tensor_traits(op);
17
+ if (tensor_traits && tensor_traits->compute_forward(params, op)) {
18
+ return true;
19
+ }
20
+ }
21
+ }
22
+ return false;
23
+ }
24
+
25
+ bool wsp_ggml_cpu_extra_work_size(int n_threads, const struct wsp_ggml_tensor * op, size_t * size) {
26
+ for (auto extra : wsp_ggml_backend_cpu_get_extra_buffers_type()) {
27
+ if (extra && extra->context) {
28
+ auto buf_extra = (ggml::cpu::extra_buffer_type *) extra->context;
29
+ auto tensor_traits = buf_extra->get_tensor_traits(op);
30
+ if (tensor_traits && tensor_traits->work_size(n_threads, op, *size)) {
31
+ return true;
32
+ }
33
+ }
34
+ }
35
+ return false;
36
+ }
@@ -0,0 +1,38 @@
1
+ #pragma once
2
+ #include "ggml-backend-impl.h"
3
+ #include "ggml-cpu-impl.h"
4
+ #include "ggml.h"
5
+
6
+ #ifdef __cplusplus
7
+ # include <vector>
8
+ extern "C" {
9
+ #endif
10
+
11
+ // return true if op part of extra "accelerator"
12
+ bool wsp_ggml_cpu_extra_compute_forward(struct wsp_ggml_compute_params * params, struct wsp_ggml_tensor * op);
13
+ bool wsp_ggml_cpu_extra_work_size(int n_threads, const struct wsp_ggml_tensor * op, size_t * size);
14
+
15
+ #ifdef __cplusplus
16
+ }
17
+
18
+ namespace ggml::cpu {
19
+ // register in tensor->extra
20
+ class tensor_traits {
21
+ public:
22
+ virtual ~tensor_traits();
23
+ virtual bool work_size(int n_threads, const struct wsp_ggml_tensor * op, size_t & size) = 0;
24
+ virtual bool compute_forward(struct wsp_ggml_compute_params * params, struct wsp_ggml_tensor * op) = 0;
25
+ };
26
+
27
+ class extra_buffer_type {
28
+ public:
29
+ virtual ~extra_buffer_type();
30
+ virtual bool supports_op(wsp_ggml_backend_dev_t dev, const struct wsp_ggml_tensor * op) = 0;
31
+ virtual tensor_traits * get_tensor_traits(const struct wsp_ggml_tensor * op) = 0;
32
+ };
33
+ } // namespace ggml::cpu
34
+
35
+ // implemented in ggml-cpu.cpp.
36
+ std::vector<wsp_ggml_backend_buffer_type_t> & wsp_ggml_backend_cpu_get_extra_buffers_type();
37
+
38
+ #endif