Skip to content

Commit 2a3b9ee

Browse files
committed
Closer to supporting all i-quants
1 parent e2380e2 commit 2a3b9ee

File tree

2 files changed

+740
-27
lines changed

2 files changed

+740
-27
lines changed

ggml/src/ggml-webgpu/ggml-webgpu.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ struct webgpu_context_struct {
129129
webgpu_buf_pool set_rows_error_buf_pool;
130130

131131
wgpu::ComputePipeline memset_pipeline;
132-
wgpu::ComputePipeline mul_mat_pipeline[17][2];
132+
wgpu::ComputePipeline mul_mat_pipeline[24][2];
133133
wgpu::ComputePipeline set_rows_pipeline;
134134
wgpu::ComputePipeline cpy_pipeline;
135135

@@ -915,7 +915,7 @@ static void ggml_webgpu_init_memset_pipeline(webgpu_context & webgpu_ctx) {
915915
}
916916

917917
static void ggml_webgpu_init_mul_mat_pipeline(webgpu_context & webgpu_ctx) {
918-
webgpu_pipeline_info pipeline_infos[14] = {
918+
webgpu_pipeline_info pipeline_infos[18] = {
919919
{ .name = "mul_mat_f32_f32",
920920
.shader_code = wgsl_mul_mat_f32_f32,
921921
.src0_type = GGML_TYPE_F32,
@@ -971,6 +971,22 @@ static void ggml_webgpu_init_mul_mat_pipeline(webgpu_context & webgpu_ctx) {
971971
{ .name = "mul_mat_iq2_xxs_f32",
972972
.shader_code = wgsl_mul_mat_iq2_xxs_f32,
973973
.src0_type = GGML_TYPE_IQ2_XXS,
974+
.src1_type = GGML_TYPE_F32 },
975+
{ .name = "mul_mat_iq2_xs_f32",
976+
.shader_code = wgsl_mul_mat_iq2_xs_f32,
977+
.src0_type = GGML_TYPE_IQ2_XS,
978+
.src1_type = GGML_TYPE_F32 },
979+
{ .name = "mul_mat_iq2_s_f32",
980+
.shader_code = wgsl_mul_mat_iq2_s_f32,
981+
.src0_type = GGML_TYPE_IQ2_S,
982+
.src1_type = GGML_TYPE_F32 },
983+
{ .name = "mul_mat_iq3_xxs_f32",
984+
.shader_code = wgsl_mul_mat_iq3_xxs_f32,
985+
.src0_type = GGML_TYPE_IQ3_XXS,
986+
.src1_type = GGML_TYPE_F32 },
987+
{ .name = "mul_mat_iq3_s_f32",
988+
.shader_code = wgsl_mul_mat_iq3_s_f32,
989+
.src0_type = GGML_TYPE_IQ3_S,
974990
.src1_type = GGML_TYPE_F32 }
975991
};
976992

@@ -1074,6 +1090,10 @@ static bool ggml_backend_webgpu_device_supports_op(ggml_backend_dev_t dev, const
10741090
case GGML_TYPE_Q5_K:
10751091
case GGML_TYPE_Q6_K:
10761092
case GGML_TYPE_IQ2_XXS:
1093+
case GGML_TYPE_IQ2_XS:
1094+
case GGML_TYPE_IQ2_S:
1095+
case GGML_TYPE_IQ3_XXS:
1096+
case GGML_TYPE_IQ3_S:
10771097
return true;
10781098
default:
10791099
return false;

0 commit comments

Comments
 (0)