Skip to content

Commit 57c26b1

Browse files
committed
Support rest of i-quants
1 parent 2a3b9ee commit 57c26b1

File tree

2 files changed

+352
-9
lines changed

2 files changed

+352
-9
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[24][2];
132+
wgpu::ComputePipeline mul_mat_pipeline[30][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[18] = {
918+
webgpu_pipeline_info pipeline_infos[22] = {
919919
{ .name = "mul_mat_f32_f32",
920920
.shader_code = wgsl_mul_mat_f32_f32,
921921
.src0_type = GGML_TYPE_F32,
@@ -987,6 +987,22 @@ static void ggml_webgpu_init_mul_mat_pipeline(webgpu_context & webgpu_ctx) {
987987
{ .name = "mul_mat_iq3_s_f32",
988988
.shader_code = wgsl_mul_mat_iq3_s_f32,
989989
.src0_type = GGML_TYPE_IQ3_S,
990+
.src1_type = GGML_TYPE_F32 },
991+
{ .name = "mul_mat_iq1_s_f32",
992+
.shader_code = wgsl_mul_mat_iq1_s_f32,
993+
.src0_type = GGML_TYPE_IQ1_S,
994+
.src1_type = GGML_TYPE_F32 },
995+
{ .name = "mul_mat_iq1_m_f32",
996+
.shader_code = wgsl_mul_mat_iq1_m_f32,
997+
.src0_type = GGML_TYPE_IQ1_M,
998+
.src1_type = GGML_TYPE_F32 },
999+
{ .name = "mul_mat_iq4_nl_f32",
1000+
.shader_code = wgsl_mul_mat_iq4_nl_f32,
1001+
.src0_type = GGML_TYPE_IQ4_NL,
1002+
.src1_type = GGML_TYPE_F32 },
1003+
{ .name = "mul_mat_iq4_xs_f32",
1004+
.shader_code = wgsl_mul_mat_iq4_xs_f32,
1005+
.src0_type = GGML_TYPE_IQ4_XS,
9901006
.src1_type = GGML_TYPE_F32 }
9911007
};
9921008

@@ -1094,6 +1110,10 @@ static bool ggml_backend_webgpu_device_supports_op(ggml_backend_dev_t dev, const
10941110
case GGML_TYPE_IQ2_S:
10951111
case GGML_TYPE_IQ3_XXS:
10961112
case GGML_TYPE_IQ3_S:
1113+
case GGML_TYPE_IQ1_S:
1114+
case GGML_TYPE_IQ1_M:
1115+
case GGML_TYPE_IQ4_NL:
1116+
case GGML_TYPE_IQ4_XS:
10971117
return true;
10981118
default:
10991119
return false;

0 commit comments

Comments
 (0)