Repository navigation
Conversation
The per-head MLA weights (`attn_k_b` / `attn_v_b`) are 3D quantized tensors. Their `MUL_MAT` operations were falling back to the CPU, splitting the graph at every layer and causing GPU execution to fail. Accept these tensors in the GPU support check and address the following issues exposed by enabling GPU execution: * Quantization: Use exact zero points only for MoE expert weights. U4 weights with F16 zero points fail in batched GPU MatMul. * Dynamic VIEW dimensions: Select the correct dimension when a size-1 dimension shares its stride (e.g. `k_pe`), and match KV cache views by stride. * KV cache V view: Translate the V view of the K cache as a reshape while preserving the dynamic cell axis. * Flash Attention: Accept the MLA Q (`CONCAT`) pattern and V views derived from another view. Limitations: The GPU plugin fails on batched compressed weights with static shapes. Keep these unsupported in op tests and `GGML_OPENVINO_FORCE_STATIC`.
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
GLM-4.7-Flash (
deepseek2architecture, MLA) fails on the OpenVINO GPU backend in stateless mode with-fa on/off/auto.Its per-head MLA weights (
attn_k_bandattn_v_b) are 3D quantized tensors, which were rejected by the GPU support check. As a result, theirMUL_MAToperations fell back to the CPU (1692 CPU ops with-fa off), splitting the graph at every layer. GPU execution then failed with a shape mismatch between the model input[1,2,20,512]and the tensor shape[1,20,2,512].This PR enables GPU execution for these weights and addresses the following issues:
MUL_MATwith a 3D quantized weight when there is one weight matrix per activation batch. The existing translation already handles this as a batched MatMul.GGML_OPENVINO_EXACT_ZERO_POINTopt-in to 2D weights. MLA's 3D weights otherwise use an F16 zero point, which fails in the GPU plugin withCL_OUT_OF_RESOURCES.k_peand views of the KV cache.Static-shape limitation: The GPU plugin currently fails on MatMul with batched compressed weights when shapes are static. Dynamic shapes work correctly. Since op tests and
GGML_OPENVINO_FORCE_STATICuse static shapes, batched quantized weights remain unsupported in those paths.Additional information
Tested on Arc Pro B70 with OpenVINO 2026.4.1 using a 1024-token prompt,
-c 1382 -n 128, stateless:-fa onset_inputshape error-fa offset_inputshape error-fa autoset_inputshape error-fa on/off/auto. The top token matches the CPU backend 91% of the time in all three modes. Results are consistent across batch sizes (-ub 512/32/1).-fa on/off/auto: identical output and no new CPU ops. Rechecked on Arc B580 on the currentdev_backend_openvinotip (Llama-3.2-1B, Gemma-4-E2B): identical output.test-backend-ops -o MUL_MATon GPU shows no change from the baseline (982/982 on Arc B580).test-llama-archs -a deepseek2now executes instead of crashing. However, it fails NMSE comparison against the CPU backend, consistent with the existing behavior of MoE architectures on the OpenVINO GPU backend (deepseek,glm4moe,bailingmoe2, andqwen2moe).Requirements