@@ -1194,6 +1194,66 @@ static void mul_mat_vec_q8_0_q8_1_sycl_switch_ncols(
11941194 }
11951195}
11961196
1197+ static void mul_mat_vec_q1_0_q8_1_sycl (const void * vx, const void * vy,
1198+ float * dst, const int ncols,
1199+ const int nrows,
1200+ dpct::queue_ptr stream) {
1201+ GGML_ASSERT (ncols % QK1_0 == 0 );
1202+ const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1 ) / GGML_SYCL_MMV_Y ;
1203+ const sycl::range<3 > block_nums (1 , 1 , block_num_y);
1204+ const sycl::range<3 > block_dims (1 , GGML_SYCL_MMV_Y , WARP_SIZE );
1205+
1206+ stream->submit ([&](sycl::handler & cgh) {
1207+ cgh.parallel_for (
1208+ sycl::nd_range<3 >(block_nums * block_dims, block_dims),
1209+ [=](sycl::nd_item<3 > item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
1210+ mul_mat_vec_q<QK1_0 , QI1_0 , block_q1_0,
1211+ VDR_Q1_0_Q8_1_MMVQ , vec_dot_q1_0_q8_1>(
1212+ vx, vy, dst, ncols, nrows, item_ct1);
1213+ });
1214+ });
1215+ }
1216+
1217+ template <int ncols_dst>
1218+ static void mul_mat_vec_q1_0_q8_1_sycl_ncols (
1219+ const void * vx, const void * vy, float * dst,
1220+ const int ncols, const int nrows,
1221+ const int stride_col_y, const int stride_col_dst,
1222+ dpct::queue_ptr stream) {
1223+ GGML_ASSERT (ncols % QK1_0 == 0 );
1224+ const int block_num_y = (nrows + GGML_SYCL_MMV_Y - 1 ) / GGML_SYCL_MMV_Y ;
1225+ const sycl::range<3 > block_nums (1 , 1 , block_num_y);
1226+ const sycl::range<3 > block_dims (1 , GGML_SYCL_MMV_Y , WARP_SIZE );
1227+
1228+ stream->submit ([&](sycl::handler & cgh) {
1229+ cgh.parallel_for (
1230+ sycl::nd_range<3 >(block_nums * block_dims, block_dims),
1231+ [=](sycl::nd_item<3 > item_ct1) [[sycl::reqd_sub_group_size(WARP_SIZE)]] {
1232+ mul_mat_vec_q_ncols<QK1_0 , QI1_0 , block_q1_0,
1233+ VDR_Q1_0_Q8_1_MMVQ , vec_dot_q1_0_q8_1, ncols_dst>(
1234+ vx, vy, dst, ncols, nrows, stride_col_y, stride_col_dst, item_ct1);
1235+ });
1236+ });
1237+ }
1238+
1239+ static void mul_mat_vec_q1_0_q8_1_sycl_switch_ncols (
1240+ const void * vx, const void * vy, float * dst,
1241+ const int ncols, const int nrows, const int ncols_dst,
1242+ const int stride_col_y, const int stride_col_dst,
1243+ dpct::queue_ptr stream) {
1244+ switch (ncols_dst) {
1245+ case 1 : mul_mat_vec_q1_0_q8_1_sycl (vx, vy, dst, ncols, nrows, stream); break ;
1246+ case 2 : mul_mat_vec_q1_0_q8_1_sycl_ncols<2 >(vx, vy, dst, ncols, nrows, stride_col_y, stride_col_dst, stream); break ;
1247+ case 3 : mul_mat_vec_q1_0_q8_1_sycl_ncols<3 >(vx, vy, dst, ncols, nrows, stride_col_y, stride_col_dst, stream); break ;
1248+ case 4 : mul_mat_vec_q1_0_q8_1_sycl_ncols<4 >(vx, vy, dst, ncols, nrows, stride_col_y, stride_col_dst, stream); break ;
1249+ case 5 : mul_mat_vec_q1_0_q8_1_sycl_ncols<5 >(vx, vy, dst, ncols, nrows, stride_col_y, stride_col_dst, stream); break ;
1250+ case 6 : mul_mat_vec_q1_0_q8_1_sycl_ncols<6 >(vx, vy, dst, ncols, nrows, stride_col_y, stride_col_dst, stream); break ;
1251+ case 7 : mul_mat_vec_q1_0_q8_1_sycl_ncols<7 >(vx, vy, dst, ncols, nrows, stride_col_y, stride_col_dst, stream); break ;
1252+ case 8 : mul_mat_vec_q1_0_q8_1_sycl_ncols<8 >(vx, vy, dst, ncols, nrows, stride_col_y, stride_col_dst, stream); break ;
1253+ default : GGML_ABORT (" unsupported ncols_dst=%d for Q1_0 multi-col MMVQ" , ncols_dst);
1254+ }
1255+ }
1256+
11971257static void mul_mat_vec_q2_K_q8_1_sycl (const void *vx, const void *vy,
11981258 float *dst, const int ncols,
11991259 const int nrows,
@@ -2120,6 +2180,20 @@ void ggml_sycl_op_mul_mat_vec_q(ggml_backend_sycl_context & ctx, const ggml_tens
21202180 mul_mat_vec_q8_0_q8_1_sycl (src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
21212181 }
21222182 break ;
2183+ case GGML_TYPE_Q1_0 :
2184+ if (i == 0 && src1_ncols > 1 && src1_ncols <= 8 ) {
2185+ const int stride_col_y = src1_padded_col_size / QK8_1 ;
2186+ const int stride_col_dst = dst->ne [0 ];
2187+ GGML_SYCL_DEBUG (" Calling mul_mat_vec_q1_0_q8_1_sycl_switch_ncols ncols=%d\n " , (int )src1_ncols);
2188+ mul_mat_vec_q1_0_q8_1_sycl_switch_ncols (
2189+ src0_dd_i, src1_ddq_i, dst_dd_i, ne00, row_diff,
2190+ src1_ncols, stride_col_y, stride_col_dst, stream);
2191+ return ;
2192+ } else if (i == 0 || src1_ncols == 1 ) {
2193+ GGML_SYCL_DEBUG (" Calling mul_mat_vec_q1_0_q8_1_sycl\n " );
2194+ mul_mat_vec_q1_0_q8_1_sycl (src0_dd_i, src1_ddq_i_bs, dst_dd_i_bs, ne00, row_diff, stream);
2195+ }
2196+ break ;
21232197 case GGML_TYPE_Q2_K :
21242198 if (i == 0 && src1_ncols > 1 && src1_ncols <= 8 ) {
21252199 const int stride_col_y = src1_padded_col_size / QK8_1 ;
0 commit comments