llama.cpp
51fc2f90 - ggml-openvino: CI fixes, new model support, fixes and improvements. (#32861)

Commit
11 hours ago
ggml-openvino: CI fixes, new model support, fixes and improvements. (#32861) * ggml-openvino: keep the rope angle in f32 under the f16 inference hint * ggml-openvino: add a GGML_OP_ARGMAX translator * ggml-openvino: keep the token dim dynamic for a 2-D activation graph input * ggml-openvino: tolerate graph inputs and outputs with no backing storage * ggml-openvino: invalidate a cached graph when its output set changes * ggml-openvino: bound the compiled-model cache to N shapes instead of 1 * ggml-openvino: add GGML_OPENVINO_LOG_SUPPORTS_OP diagnostic * ggml-openvino: honour a node's dynamic-dim classification on non-split graphs too * ggml-openvino: fold consecutive SET_ROWS column writes into one scatter * ggml-openvino: keep the speculative decoding feature buffers in device memory * ggml-openvino: keep the fixed token count of static graph inputs for npu GDN In a static (NPU) graph that overwrites the fixed token count that get_graph_input_shape set just before, for example of inp_tokens, so the NPU graph got a dynamic token dimension. GATED_DELTA_NET models (Qwen3.5, Qwen3.6) then fail to translate: "GATED_DELTA_NET pad masking requires a static token dimension". Keep the change for dynamic graphs and the previous behaviour for static ones. * ggml-openvino: one output in the decode model of a static NPU pair The decode model of a static prefill/decode pair copied the compute params of the prefill graph, including output_len. With llama-perplexity the prefill graph has many outputs (128 at -c 256), so the decode model gathered 128 rows from its one token in the last layer. For a MoE model that layer then differs from the others and NPUW fails to lower its experts ("could not lower the isolated expert partition"). A decode step outputs one token; the model cache key already assumes it (decode_signature out=1). * ggml-openvino: fix gated delta net when v is a view with padded heads The GDN translator assumed v is a view of the fused qkv conv output with the heads packed in each row, and sliced H_v * S_v elements off that row. test-backend-ops now has padded_v cases, where v views a wider tensor and each head row is padded (nb[1] > S_v * nb[0]). The slice then read the padding, and the results were wrong on CPU and GPU. Take the packed path only when nb[1] == S_v * nb[0]. Any other view goes through the generic view resolution, which already returns [B, T, H_v, S_v], so the reshape of the packed case is skipped too. Model graphs build v with packed heads and keep the packed path. * ggml-openvino: make the f32 rope angle opt-in GGML_OPENVINO_ROPE_F32_ANGLE was on by default. It changes the RoPE of every model on every device, and it was validated on one model on the GPU only. On the CPU device, which computes in f32, its f16 round trip rounds cos and sin, and ROPE cases of test-backend-ops fail against the CPU backend. Turn it off by default; GGML_OPENVINO_ROPE_F32_ANGLE=1 turns it on. Fix the comment that called the round trip a no-op on f32 paths. Document the variable, and the two diagnostics added with it (GGML_OPENVINO_LOG_SUPPORTS_OP, GGML_OPENVINO_DIAG_GRAPH_IO), in the dev_doc. * docs : add the Muse-Glimmer-30B DFlash memory limit and env var samples Muse-Glimmer-30B with a DFlash draft peaks at about 45 GB of RAM on an integrated GPU. Add it to the GPU limitations as a runnable sample, and add samples for GGML_OPENVINO_LOG_SUPPORTS_OP and GGML_OPENVINO_DIAG_GRAPH_IO to the dev_doc. * ggml-openvino: fix weight zero points, buffer extras and cache-key gaps A code review of ggml/src/ggml-openvino found these bugs: - Q4_1 weights: `extract_q4_1_data` packs two zero points per byte from a `parallel_for` over blocks, so two threads can write the same byte. - Zero points out of the u4/u8 range wrap around instead of saturating. gemma-4-E2B has 6 Q4_K sub-blocks with a zero point of 16 or more; 16 wrapped to 0. - `set_tensor` overwrote the extra that `init_tensor` created for a weight without deleting it. - The two buffer constructors had separate id counters, and the buffer id is part of the shared graph key. - A freed weight buffer stayed in the release registry, so a later release could madvise memory it no longer owned. - `GGML_OPENVINO_ROPE_F32_ANGLE` changes the graph but was not in the compiled-model cache key. - On NPU, group-128 requantization ignored the row width. A model whose rows are not a multiple of 128 failed to load its weights (SmolLM2-360M). - The static Split cache held a strong reference to the Split on its own input (a reference cycle) and ignored the output port. - `rms_norm` took op_case 3 for both a direct and a packed pre-scaled GDN output, so the packed one was not sliced. - Smaller items: static decode read `out_ids` even when it is empty; the static path aborted where the dynamic path returns an error; a damaged weights `.meta` hash threw from `std::stoull`; `extract_layer_from_name` threw on a non-numeric suffix; `GGML_OP_FILL` was registered twice. - ggml-quants.cpp: one `parallel_for` iteration per zero point byte for Q4_1; clamp zero points to [0, 15] (u4) and [0, 255] (u8). - ggml-openvino.cpp: `ggml_openvino_set_extra` replaces and deletes the old extra at every site; one id counter; `ggml_openvino_unregister_weight_buffer` in the buffer destructor; a failed KV re-allocation returns `GGML_STATUS_ALLOC_FAILED`. - model-cache.cpp: hash `GGML_OPENVINO_ROPE_F32_ANGLE`, cache version 9; `strtoull` for the `.meta` hash. - npu_quant_policy.cpp: Q4_0_128 falls back to Q4_0_C when `ne[0] % 128 != 0`. ggml-openvino-extra.cpp: the group-64 requant targets fall back to Q8_0_C when `ne[0] % 64 != 0`. - openvino/utils.cpp: the static Split cache uses a weak reference and the output port in its key, like the dynamic one. - rms_norm.cpp, ggml-decoder.cpp: op_case 5 for a packed pre-scaled GDN output. - utils.cpp: static decode writes 0 to `out_ids`; a compile after a weight release returns `GGML_STATUS_FAILED`. - ggml-decoder.cpp: `extract_layer_from_name` returns nullopt for a non-numeric suffix. - op_table.cpp/.h: remove the duplicate `GGML_OP_FILL`. * ggml-openvino: copy the decoder once per graph conversion `GgmlOvDecoder::visit_subgraph` made a full copy of the decoder for every node it visited. Translators only read the decoder, so one copy per walk is enough. Graph conversion time drops 12-24x (Qwen3.5-0.8B: 4.1 s to 0.17 s over the six graphs of a short run). - ggml-decoder.cpp: make one decoder copy before the node loop. - utils.cpp: `get_static_attention_size` takes the decoder by const reference and does not copy the compute params. * ggml-openvino: remove dead code and fix stale comments Code that nothing calls or registers, and comments that no longer match the code. No behavior change. - Remove `translate_gated_delta_net_ref`, `translate_solve_tri` (not registered), the unused `FuseToSDPA` pass, `add_rope_sin_cos`, `checksum`, `save_ggml_tensor_data_to_txt`, `non_cont_dim`, the unused templates in openvino/utils.h and the undefined `getCurrentTime` declaration. - ggml-decoder.cpp: drop the VIEW op_case tail that only ever set 0. - utils.cpp: drop a duplicate `entry->ptr` store and the always-false `!model_leafs.empty() == false` term. - `ggml_openvino_manual_gqa_enabled()` replaces two copies of the GGML_OPENVINO_MANUAL_GQA_ATTN default (flash_attn_ext.cpp and the cache key). - ggml-openvino.cpp: remove the SSM_CONV case whose comment said it stays on CPU (it runs on OpenVINO); fix the gemma3n reason text (not GPU-only) and two typos. * ggml-openvino: track dynamic dims through bailingmoe3's GDN views and conv state bailingmoe3 uses GATED_DELTA_NET views to expose its attention and state outputs. Preserve their dynamic dimensions in the decoder. - Assign the dynamic dimensions of the translated attention and state outputs to the corresponding GATED_DELTA_NET result VIEWs. - Count the convolution state slots using the rows spanned by the destination view. bailingmoe3 packs the q/k/v convolution states into a single row. - Preserve the tracked dynamic dimension in RESHAPE op case 0 when the reshape only adds a trailing size-1 dimension. * ggml-openvino: translate the per-key gate of GATED_DELTA_NET Ling-3.0-tiny (bailingmoe3) uses a gate per key dimension (kda), which the backend previously rejected, causing these layers to fall back to the CPU. - Use the fused GatedDeltaNet when the OpenVINO runtime and target device support a rank-4 gate. - Detect support once by compiling a one-node GatedDeltaNet with a rank-4 gate and checking the target device with query_model. Older runtimes reject this gate, and the CPU plugin does not support it. - Fall back to the reference loop when the fused path is unavailable. - Support a dynamic token count in the reference loop by using dynamic reshapes and deriving the trip count from the input shape. - Reject unsupported cases with a reason: padded chunks, recurrent caches, state snapshots, and the native state layout. The loop currently handles one state in the ggml layout. * ggml-openvino: Fix issue highlighted by tests * ggml-openvino: reject a padded permuted v in gated delta net supports_op rejected a permuted v only when src2 was the PERMUTE itself. With padded heads, v is a VIEW of the PERMUTE, so the check missed it and the per-key gate reference loop ran on a v layout it does not handle. Look through the VIEW so this case falls back like the other permuted v inputs. * ggml-openvino: write back intermediate nodes of op-test graphs The ADD_RMS_NORM_MUL op test checks the intermediate sum of its graph as well as the final output. compute_model_outputs() made a node a model output only when the graph does not consume all of it, so the sum was never written back and the test read uninitialised memory (28 failures on GPU and CPU). MUL_MAT_ID_SHARED, which checks its routed and shared results, failed the same way on CPU. Op-test graphs (the naive path) can read any node, so make every non-in-place node a model output there. Model graphs are unchanged. --------- Co-authored-by: Mustafa Cavus <mustafa.cavus@intel.com> Co-authored-by: yzhou51 <yaowei.zhou@intel.com> Co-authored-by: Sabnis, Omkar <omkar.sabnis@intel.com>
Author
Parents
Loading