From d1c6afd5cd51d94af929d1357f5e66354a4e3a05 Mon Sep 17 00:00:00 2001 From: bri-prism <288398250+bri-prism@users.noreply.github.com> Date: Thu, 3 Sep 2026 08:39:32 -0700 Subject: [PATCH] vulkan: register PTQ1_0 in the selection and supports_op enumerations PTQ1_0's Vulkan pipelines are created but nothing can select them. Every PTQ1_0 reference in ggml-vulkan.cpp sits in pipeline creation (4637-5466) and none in the selection or support enumerations, so ggml_backend_vk_device_supports_op returns false, the scheduler never offers MUL_MAT to Vulkan, and the 54 generated SPIR-V shaders are unreachable. The build is green and the backend does nothing. Add `case GGML_TYPE_PTQ1_0:` alongside the existing GGML_TYPE_Q1_0 in the seven enumerations that have working PTQ1_0 pipelines behind them: ggml_vk_get_to_fp16 ggml_vk_get_mul_mat_mat_pipeline ggml_vk_get_dequantize_mul_mat_vec ggml_vk_get_mul_mat_mat_id_pipeline ggml_vk_get_dequantize_mul_mat_vec_id ggml_backend_vk_device_supports_op (MUL_MAT / MUL_MAT_ID gate) ggml_backend_vk_device_supports_op (GET_ROWS gate) There are twelve `case GGML_TYPE_Q1_0:` in this file; five are deliberately left alone. ggml_vk_get_cpy_pipeline (x2), GGML_OP_SET_ROWS and GGML_OP_DUP (x2) all depend on copy_to_quant.comp, which has no PTQ1_0 entry, so quantizing to PTQ1_0 on device is unimplemented. Advertising those paths would claim support for a shader that does not exist; a clean refusal is correct until copy_to_quant gains a PTQ1_0 entry. Measured on Intel Arc B390 (KHR_coopmat, proprietary Windows driver), test-backend-ops test -b Vulkan0 -o MUL_MAT, two runs, byte-identical: type OK not_supported FAIL q1_0 28 50 0 q2_0 28 50 0 ptq1_0 28 50 0 (was 0 OK / 78 not_supported) tq2_0 11 0 0 1037/1037 tests passed, 0 failures; total case count rises 1009 -> 1037. 28 is the full available set rather than a partial pass: the 50 declines are shape and permutation variants that q1_0 and q2_0 also decline on this device. The PTQ1_0 kernel itself needed no changes - it was correct, just unreachable. --- ggml/src/ggml-vulkan/ggml-vulkan.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ggml/src/ggml-vulkan/ggml-vulkan.cpp b/ggml/src/ggml-vulkan/ggml-vulkan.cpp index e80056009b4a..b345ae3832b6 100644 --- a/ggml/src/ggml-vulkan/ggml-vulkan.cpp +++ b/ggml/src/ggml-vulkan/ggml-vulkan.cpp @@ -7673,6 +7673,7 @@ static vk_pipeline ggml_vk_get_to_fp16(ggml_backend_vk_context * ctx, ggml_type switch (type) { case GGML_TYPE_F32: case GGML_TYPE_Q1_0: + case GGML_TYPE_PTQ1_0: case GGML_TYPE_Q2_0: case GGML_TYPE_Q4_0: case GGML_TYPE_Q4_1: @@ -7748,6 +7749,7 @@ static vk_matmul_pipeline ggml_vk_get_mul_mat_mat_pipeline(ggml_backend_vk_conte switch (src0_type) { case GGML_TYPE_Q1_0: + case GGML_TYPE_PTQ1_0: case GGML_TYPE_Q2_0: case GGML_TYPE_Q4_0: case GGML_TYPE_Q4_1: @@ -7818,6 +7820,7 @@ static vk_pipeline ggml_vk_get_dequantize_mul_mat_vec(ggml_backend_vk_context * case GGML_TYPE_F16: case GGML_TYPE_BF16: case GGML_TYPE_Q1_0: + case GGML_TYPE_PTQ1_0: case GGML_TYPE_Q2_0: case GGML_TYPE_Q4_0: case GGML_TYPE_Q4_1: @@ -7912,6 +7915,7 @@ static vk_matmul_pipeline ggml_vk_get_mul_mat_mat_id_pipeline(ggml_backend_vk_co switch (src0_type) { case GGML_TYPE_Q1_0: + case GGML_TYPE_PTQ1_0: case GGML_TYPE_Q2_0: case GGML_TYPE_Q4_0: case GGML_TYPE_Q4_1: @@ -7985,6 +7989,7 @@ static vk_pipeline ggml_vk_get_dequantize_mul_mat_vec_id(ggml_backend_vk_context case GGML_TYPE_F16: case GGML_TYPE_BF16: case GGML_TYPE_Q1_0: + case GGML_TYPE_PTQ1_0: case GGML_TYPE_Q2_0: case GGML_TYPE_Q4_0: case GGML_TYPE_Q4_1: @@ -18165,6 +18170,7 @@ static bool ggml_backend_vk_device_supports_op(ggml_backend_dev_t dev, const ggm case GGML_TYPE_F16: case GGML_TYPE_BF16: case GGML_TYPE_Q1_0: + case GGML_TYPE_PTQ1_0: case GGML_TYPE_Q2_0: case GGML_TYPE_Q4_0: case GGML_TYPE_Q4_1: @@ -18271,6 +18277,7 @@ static bool ggml_backend_vk_device_supports_op(ggml_backend_dev_t dev, const ggm case GGML_TYPE_F16: case GGML_TYPE_BF16: case GGML_TYPE_Q1_0: + case GGML_TYPE_PTQ1_0: case GGML_TYPE_Q2_0: case GGML_TYPE_Q4_0: case GGML_TYPE_Q4_1: