File tree 3 files changed +17
-1
lines changed 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -2195,6 +2195,7 @@ struct ggml_context {
2195
2195
bool mem_buffer_owned;
2196
2196
bool no_alloc;
2197
2197
bool no_alloc_save; // this is used to save the no_alloc state when using scratch buffers
2198
+ bool use_hwaccel;
2198
2199
2199
2200
int n_objects;
2200
2201
@@ -2754,6 +2755,7 @@ struct ggml_context * ggml_init(struct ggml_init_params params) {
2754
2755
/*.mem_buffer_owned =*/ params.mem_buffer ? false : true,
2755
2756
/*.no_alloc =*/ params.no_alloc,
2756
2757
/*.no_alloc_save =*/ params.no_alloc,
2758
+ /*.use_hwaccel =*/ params.use_hwaccel,
2757
2759
/*.n_objects =*/ 0,
2758
2760
/*.objects_begin =*/ NULL,
2759
2761
/*.objects_end =*/ NULL,
Original file line number Diff line number Diff line change @@ -657,6 +657,7 @@ extern "C" {
657
657
size_t mem_size ; // bytes
658
658
void * mem_buffer ; // if NULL, memory will be allocated internally
659
659
bool no_alloc ; // don't allocate memory for the tensor data
660
+ bool use_hwaccel ;
660
661
};
661
662
662
663
Original file line number Diff line number Diff line change @@ -4066,6 +4066,14 @@ static int whisper_has_openvino(void) {
4066
4066
#endif
4067
4067
}
4068
4068
4069
+ static int whisper_has_qnn (void ) {
4070
+ #ifdef GGML_USE_QNN
4071
+ return 1 ;
4072
+ #else
4073
+ return 0 ;
4074
+ #endif
4075
+ }
4076
+
4069
4077
const char * whisper_print_system_info (void ) {
4070
4078
static std::string s;
4071
4079
@@ -4086,7 +4094,9 @@ const char * whisper_print_system_info(void) {
4086
4094
s += " VSX = " + std::to_string (ggml_cpu_has_vsx ()) + " | " ;
4087
4095
s += " CUDA = " + std::to_string (ggml_cpu_has_cuda ()) + " | " ;
4088
4096
s += " COREML = " + std::to_string (whisper_has_coreml ()) + " | " ;
4089
- s += " OPENVINO = " + std::to_string (whisper_has_openvino ()) ;
4097
+ s += " OPENVINO = " + std::to_string (whisper_has_openvino ()) + " | " ;
4098
+ s += " QNN = " + std::to_string (whisper_has_qnn ()) ;
4099
+
4090
4100
4091
4101
return s.c_str ();
4092
4102
}
@@ -6518,6 +6528,9 @@ WHISPER_API const char * whisper_bench_ggml_mul_mat_str(int n_threads) {
6518
6528
/* .no_alloc =*/ false ,
6519
6529
};
6520
6530
6531
+ #ifdef GGML_USE_QNN
6532
+ gparams.use_hwaccel = true ;
6533
+ #endif
6521
6534
struct ggml_context * ctx0 = ggml_init (gparams);
6522
6535
6523
6536
struct ggml_tensor * a = ggml_new_tensor_2d (ctx0, wtype, N, N);
You can’t perform that action at this time.
0 commit comments