Repository navigation
vulkan: use shared-memory reduction for dequant mul_mat_vec on Imagination PowerVR - #28341
Merged
ggerganov merged 1 commit intoSep 10, 2026
Merged
Conversation
|
Hi @JulianPscheid, thanks for your contribution! Per our contribution guidelines, the automated PR checker found the following issue(s) that need your attention:
Please note that maintainers reserve the right to make final decisions on PRs. If you believe there is a mistake, please comment below. |
Contributor
Author
THanks for the feedback. I reworked it to follow the template. |
JulianPscheid
marked this pull request as ready for review
September 3, 2026 20:01
0cc4m
reviewed
Sep 4, 2026
The Imagination proprietary Vulkan compiler returns VK_ERROR_UNKNOWN from vkCreateComputePipelines for every dequant mul_mat_vec shader built with the subgroup-only reduction that requires a subgroup size >= 16. That covers the k-quants, the i-quants, TQ2_0, MXFP4 and NVFP4. ggml rethrows, so the first generated token of any such model kills the process. Reproduced on a Pixel 11 Pro (PowerVR C-Series CXTP-48-1536 MC1, driver 1.662.3024, subgroup size 128, min 32, max 128). The failure is independent of subgroup size: 32, 64 and 128 all fail, as does dropping the full-subgroups flag and the required-subgroup-size pNext. The legacy quants, which use the plain subgroup reduction, compile and run fine. The shared-memory reduction variant compiles and matches the CPU reference for q2_K, q3_K, q4_K, q5_K and q6_K. The hybrid variant also compiles but costs 27% of token throughput (3.78 vs 5.20 t/s on Qwen3.5-2B-Q4_K_M).
JulianPscheid
force-pushed
the
vulkan-powervr-dmmv-shmem
branch
from
September 4, 2026 14:09
b5299b1 to
032670a
Compare
0cc4m
approved these changes
Sep 4, 2026
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Imagination's proprietary Vulkan compiler cannot compile the subgroup-only reduction variants of the dequant
mul_mat_vecshaders.vkCreateComputePipelinesreturnsVK_ERROR_UNKNOWN,ggml_vk_create_pipeline_funcrethrows, and the process dies with an uncaughtvk::SystemErroron the first generated token. Prompt processing runs first and succeeds, so the failure looks like a hang partway into generation.This affects every type that goes through
reduc16: Q2_K through Q6_K, TQ2_0, the IQ types, MXFP4 and NVFP4. The legacy quants use the plain subgroup reduction and compile fine, so the subgroup path itself is not the problem.Falling back to the shared-memory reduction for those shaders fixes it.
Additional information
Device
Pixel 11 Pro, PowerVR C-Series CXTP-48-1536 MC1,
VK_DRIVER_ID_IMAGINATION_PROPRIETARY, driver 1.662.3024, Vulkan 1.4.317. Subgroup size 128, min 32, max 128. 32 KB shared memory, no cooperative matrix, no integer dot product.The failing pipeline is created with
require_full_subgroups=1,requiredSubgroupSize=128,wg_denoms=[2,1,1], specialization constants[128,2,1], 17320 bytes of SPIR-V.What I ruled out
None of these help; the compile still fails:
VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXTVkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXTpNextSo it is the shader body, not the pipeline flags or the subgroup width.
Why not the hybrid variant
#20565 proposed hybrid reduction for the same vendor on a Pixel 10. Hybrid does compile here and is correct, but it costs 27% of token throughput on this device:
Qwen3.5-2B-Q4_K_M,
-ngl 99 -p 128 -n 32 -r 3.Testing
test-backend-opsagainst the CPU reference, on device:Q4_K and Q6_K repeated four times each, same result every run.
llama-benchon Qwen3.5-2B-Q4_K_M runs end to end after the change; before it aborts at the first generated token.Gated on
driver_idrather thanvendor_idbecause the evidence is for the proprietary Android driver only. I have not tested Mesa's PowerVR driver.Related: #28214 (other problems on the same device, not addressed here), #20565.
Requirements