File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
ggml/src/ggml-hexagon/htp Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -405,6 +405,23 @@ static inline HVX_Vector hvx_vec_qf32_reduce_sum(HVX_Vector in) {
405405 return hvx_vec_qf32_reduce_sum_n (in , 32 );
406406}
407407
408+ static inline HVX_Vector hvx_vec_fp32_reduce_sum_n (HVX_Vector in , unsigned int n ) {
409+ unsigned int total = n * 4 ; // total vec nbytes
410+ unsigned int width = 4 ; // fp32 nbytes
411+
412+ HVX_Vector sum = in , sum_t ;
413+ while (width < total ) {
414+ sum_t = Q6_V_vror_VR (sum , width ); // rotate right
415+ sum = Q6_Vsf_equals_Vqf32 (Q6_Vqf32_vadd_VsfVsf (sum , sum_t )); // elementwise sum
416+ width = width << 1 ;
417+ }
418+ return sum ;
419+ }
420+
421+ static inline HVX_Vector hvx_vec_fp32_reduce_sum (HVX_Vector in ) {
422+ return hvx_vec_fp32_reduce_sum_n (in , 32 );
423+ }
424+
408425static inline HVX_Vector hvx_vec_reduce_max_fp16 (HVX_Vector in ) {
409426 unsigned total = 128 ; // total vec nbytes
410427 unsigned width = 2 ; // fp16 nbytes
You can’t perform that action at this time.
0 commit comments