@@ -115,10 +115,10 @@ void quantize_row_q8_1(const float * GGML_RESTRICT x, void * GGML_RESTRICT vy, i
115115
116116void quantize_row_q8_K (const float * GGML_RESTRICT x , void * GGML_RESTRICT y , int64_t k ) {
117117 assert (k % QK_K == 0 );
118- block_q8_K * y_blocks = (block_q8_K * )y ;
119118 size_t nb = k / QK_K ;
120119
121120#if defined(__riscv_v_intrinsic )
121+ block_q8_K * y_blocks = (block_q8_K * )y ;
122122 const size_t vlmax_f32m8 = __riscv_vsetvlmax_e32m8 ();
123123
124124 for (size_t i = 0 ; i < nb ; i ++ ) {
@@ -2052,6 +2052,7 @@ void ggml_vec_dot_q6_K_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const voi
20522052#endif
20532053}
20542054
2055+ #if defined __riscv_v_intrinsic
20552056static void ggml_vec_dot_iq1_s_q8_K_vl256 (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
20562057 assert (n % QK_K == 0 );
20572058 assert (nrc == 1 );
@@ -2147,6 +2148,7 @@ static void ggml_vec_dot_iq1_s_q8_K_vl256(int n, float * GGML_RESTRICT s, size_t
21472148
21482149 * s = sumf ;
21492150}
2151+ #endif
21502152
21512153void ggml_vec_dot_iq1_s_q8_K (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
21522154#if defined __riscv_v_intrinsic
@@ -2163,6 +2165,7 @@ void ggml_vec_dot_iq1_s_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const vo
21632165#endif
21642166}
21652167
2168+ #if defined __riscv_v_intrinsic
21662169static void ggml_vec_dot_iq1_m_q8_K_vl256 (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
21672170 assert (n % QK_K == 0 );
21682171 assert (nrc == 1 );
@@ -2269,6 +2272,7 @@ static void ggml_vec_dot_iq1_m_q8_K_vl256(int n, float * GGML_RESTRICT s, size_t
22692272
22702273 * s = sumf ;
22712274}
2275+ #endif
22722276
22732277void ggml_vec_dot_iq1_m_q8_K (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
22742278#if defined __riscv_v_intrinsic
@@ -2285,6 +2289,7 @@ void ggml_vec_dot_iq1_m_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const vo
22852289#endif
22862290}
22872291
2292+ #if defined __riscv_v_intrinsic
22882293static const uint8_t sign_gather_indices_arr [64 ] = {
22892294 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , 1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 , 2 ,2 ,2 ,2 ,2 ,2 ,2 ,2 , 3 ,3 ,3 ,3 ,3 ,3 ,3 ,3 ,
22902295 4 ,4 ,4 ,4 ,4 ,4 ,4 ,4 , 5 ,5 ,5 ,5 ,5 ,5 ,5 ,5 , 6 ,6 ,6 ,6 ,6 ,6 ,6 ,6 , 7 ,7 ,7 ,7 ,7 ,7 ,7 ,7
@@ -2488,6 +2493,7 @@ static void ggml_vec_dot_iq2_s_q8_K_vl256(int n, float * GGML_RESTRICT s, size_t
24882493 }
24892494 * s = 0.125f * sumf ;
24902495}
2496+ #endif
24912497
24922498void ggml_vec_dot_iq2_s_q8_K (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
24932499#if defined __riscv_v_intrinsic
@@ -2507,7 +2513,7 @@ void ggml_vec_dot_iq2_s_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const vo
25072513#endif
25082514}
25092515
2510- #if defined(__riscv_v )
2516+ #if defined(__riscv_v_intrinsic )
25112517static const int8_t keven_signs_q2xs [1024 ] = {
25122518 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , -1 , 1 , 1 , 1 , 1 , 1 , 1 , -1 , 1 , -1 , 1 , 1 , 1 , 1 , 1 , -1 , -1 , -1 , 1 , 1 , 1 , 1 , 1 , 1 ,
25132519 1 , 1 , -1 , 1 , 1 , 1 , 1 , -1 , -1 , 1 , -1 , 1 , 1 , 1 , 1 , 1 , 1 , -1 , -1 , 1 , 1 , 1 , 1 , 1 , -1 , -1 , -1 , 1 , 1 , 1 , 1 , -1 ,
@@ -2542,7 +2548,6 @@ static const int8_t keven_signs_q2xs[1024] = {
25422548 1 , 1 , 1 , -1 , -1 , -1 , -1 , 1 , -1 , 1 , 1 , -1 , -1 , -1 , -1 , -1 , 1 , -1 , 1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , 1 , -1 , -1 , -1 , -1 , 1 ,
25432549 1 , 1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , 1 , -1 , -1 , -1 , -1 , -1 , 1 , 1 , -1 , -1 , -1 , -1 , -1 , -1 , 1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
25442550};
2545- #endif
25462551
25472552static void ggml_vec_dot_iq2_xs_q8_K_vl256 (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
25482553 assert (n % QK_K == 0 );
@@ -2618,6 +2623,7 @@ static void ggml_vec_dot_iq2_xs_q8_K_vl256(int n, float * GGML_RESTRICT s, size_
26182623 }
26192624 * s = 0.125f * sumf ;
26202625}
2626+ #endif
26212627
26222628void ggml_vec_dot_iq2_xs_q8_K (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
26232629#if defined __riscv_v_intrinsic
@@ -2634,6 +2640,7 @@ void ggml_vec_dot_iq2_xs_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const v
26342640#endif
26352641}
26362642
2643+ #if defined __riscv_v_intrinsic
26372644static void ggml_vec_dot_iq2_xxs_q8_K_vl128 (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
26382645 assert (n % QK_K == 0 );
26392646 assert (nrc == 1 );
@@ -2818,6 +2825,7 @@ static void ggml_vec_dot_iq2_xxs_q8_K_vl256(int n, float * GGML_RESTRICT s, size
28182825 }
28192826 * s = 0.125f * sumf ;
28202827}
2828+ #endif
28212829
28222830void ggml_vec_dot_iq2_xxs_q8_K (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
28232831#if defined __riscv_v_intrinsic
@@ -2830,10 +2838,11 @@ void ggml_vec_dot_iq2_xxs_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const
28302838 break ;
28312839 }
28322840#else
2833- ggml_vec_dot_iq2_xxs_q8_K (n , s , bs , vx , bx , vy , by , nrc );
2841+ ggml_vec_dot_iq2_xxs_q8_K_generic (n , s , bs , vx , bx , vy , by , nrc );
28342842#endif
28352843}
28362844
2845+ #if defined __riscv_v_intrinsic
28372846static void ggml_vec_dot_iq3_s_q8_K_vl256 (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
28382847 assert (n % QK_K == 0 );
28392848 UNUSED (nrc );
@@ -2928,6 +2937,7 @@ static void ggml_vec_dot_iq3_s_q8_K_vl256(int n, float * GGML_RESTRICT s, size_t
29282937 }
29292938 * s = sumf ;
29302939}
2940+ #endif
29312941
29322942void ggml_vec_dot_iq3_s_q8_K (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
29332943#if defined __riscv_v_intrinsic
@@ -2944,6 +2954,7 @@ void ggml_vec_dot_iq3_s_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const vo
29442954#endif
29452955}
29462956
2957+ #if defined __riscv_v_intrinsic
29472958static void ggml_vec_dot_iq3_xxs_q8_K_vl256 (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
29482959 assert (n % QK_K == 0 );
29492960 assert (nrc == 1 );
@@ -3036,6 +3047,7 @@ static void ggml_vec_dot_iq3_xxs_q8_K_vl256(int n, float * GGML_RESTRICT s, size
30363047 }
30373048 * s = 0.25f * sumf ;
30383049}
3050+ #endif
30393051
30403052void ggml_vec_dot_iq3_xxs_q8_K (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
30413053#if defined __riscv_v_intrinsic
@@ -3052,6 +3064,7 @@ void ggml_vec_dot_iq3_xxs_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const
30523064#endif
30533065}
30543066
3067+ #if defined __riscv_v_intrinsic
30553068static void ggml_vec_dot_iq4_nl_q8_0_vl128 (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
30563069 assert (nrc == 1 );
30573070 UNUSED (nrc );
@@ -3161,6 +3174,7 @@ static void ggml_vec_dot_iq4_nl_q8_0_vl256(int n, float * GGML_RESTRICT s, size_
31613174
31623175 * s = sumf ;
31633176}
3177+ #endif
31643178
31653179void ggml_vec_dot_iq4_nl_q8_0 (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
31663180#if defined __riscv_v_intrinsic
@@ -3177,6 +3191,7 @@ void ggml_vec_dot_iq4_nl_q8_0(int n, float * GGML_RESTRICT s, size_t bs, const v
31773191#endif
31783192}
31793193
3194+ #if defined __riscv_v_intrinsic
31803195static void ggml_vec_dot_iq4_xs_q8_K_vl256 (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
31813196 assert (nrc == 1 );
31823197 UNUSED (nrc );
@@ -3190,7 +3205,6 @@ static void ggml_vec_dot_iq4_xs_q8_K_vl256(int n, float * GGML_RESTRICT s, size_
31903205
31913206 const int nb = n / QK_K ;
31923207
3193- #if defined __riscv_v_intrinsic
31943208 const vint8m4_t values = __riscv_vle8_v_i8m4 (kvalues_iq4nl , 16 );
31953209 float sumf = 0 ;
31963210 int acc [4 ];
@@ -3252,14 +3266,8 @@ static void ggml_vec_dot_iq4_xs_q8_K_vl256(int n, float * GGML_RESTRICT s, size_
32523266 }
32533267
32543268 * s = sumf ;
3255-
3256- #else
3257- UNUSED (x );
3258- UNUSED (y );
3259- UNUSED (nb );
3260- ggml_vec_dot_iq4_xs_q8_K_generic (n , s , bs , vx , bx , vy , by , nrc );
3261- #endif
32623269}
3270+ #endif
32633271
32643272void ggml_vec_dot_iq4_xs_q8_K (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
32653273#if defined __riscv_v_intrinsic
@@ -3276,6 +3284,7 @@ void ggml_vec_dot_iq4_xs_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const v
32763284#endif
32773285}
32783286
3287+ #if defined __riscv_v_intrinsic
32793288static void ggml_vec_dot_tq1_0_q8_K_vl256 (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
32803289 assert (nrc == 1 );
32813290 UNUSED (nrc );
@@ -3381,6 +3390,7 @@ static void ggml_vec_dot_tq1_0_q8_K_vl256(int n, float * GGML_RESTRICT s, size_t
33813390
33823391 * s = sumf ;
33833392}
3393+ #endif
33843394
33853395void ggml_vec_dot_tq1_0_q8_K (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
33863396#if defined __riscv_v_intrinsic
@@ -3397,6 +3407,7 @@ void ggml_vec_dot_tq1_0_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const vo
33973407#endif
33983408}
33993409
3410+ #if defined __riscv_v_intrinsic
34003411static void ggml_vec_dot_tq2_0_q8_K_vl256 (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
34013412 assert (n % QK_K == 0 );
34023413 assert (nrc == 1 );
@@ -3467,6 +3478,7 @@ static void ggml_vec_dot_tq2_0_q8_K_vl256(int n, float * GGML_RESTRICT s, size_t
34673478
34683479 * s = sumf ;
34693480}
3481+ #endif
34703482
34713483void ggml_vec_dot_tq2_0_q8_K (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
34723484#if defined __riscv_v_intrinsic
@@ -3483,6 +3495,7 @@ void ggml_vec_dot_tq2_0_q8_K(int n, float * GGML_RESTRICT s, size_t bs, const vo
34833495#endif
34843496}
34853497
3498+ #if defined __riscv_v_intrinsic
34863499static void ggml_vec_dot_mxfp4_q8_0_vl128 (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
34873500 assert (nrc == 1 );
34883501 UNUSED (nrc );
@@ -3592,6 +3605,7 @@ static void ggml_vec_dot_mxfp4_q8_0_vl256(int n, float * GGML_RESTRICT s, size_t
35923605
35933606 * s = sumf ;
35943607}
3608+ #endif
35953609
35963610void ggml_vec_dot_mxfp4_q8_0 (int n , float * GGML_RESTRICT s , size_t bs , const void * GGML_RESTRICT vx , size_t bx , const void * GGML_RESTRICT vy , size_t by , int nrc ) {
35973611#if defined __riscv_v_intrinsic
@@ -3604,6 +3618,6 @@ void ggml_vec_dot_mxfp4_q8_0(int n, float * GGML_RESTRICT s, size_t bs, const vo
36043618 break ;
36053619 }
36063620#else
3607- return ggml_vec_dot_mxfp4_q8_0_generic (n , s , bs , vx , bx , vy , by , nrc );
3621+ ggml_vec_dot_mxfp4_q8_0_generic (n , s , bs , vx , bx , vy , by , nrc );
36083622#endif
36093623}
0 commit comments