Repository navigation
ci : fix test-grammar-parser and test-draft-vocab after #293; explain test-qwen4exp-mtp-cache-only - #298
Merged
Conversation
…imit #284 raised MAX_REPETITION_THRESHOLD from 2000 to 100000 so that agent tool schemas build their grammar. test-grammar-parser still used the upstream limit: it expected "a"{5000}, {5000,} and {5000,6000} and six nested {0,99} to be refused, and {0,5000} / {3,5000} to become unbounded. With the new limit the parser accepts them, and the test aborted at the first case (Behavior Check / ubuntu, CI llvmpipe and windows since #284). The cases now sit above 100000 (500000, nested {0,999}), so they check the same refusals at the limit the fork ships. Note: the limit itself is a policy choice. Grammars that 100000 accepts and 2000 refused can be very slow to match: (([^x]*){0,99}){0,99} did not match 100 characters in 30 s with test-gbnf-validator. Assisted-by: Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YKmjzcT1LTvKtbw9EzBVGE
graph_optimize grabs the independent nodes of the next 20 into the current set. An RMS_NORM that reads the ADD before it was not on the list of fusion pairs that may follow their producer, so independent nodes (the FILLs of the vocab-subset LM head) went in between. The ADD_RMS_NORM_PARTIALS fusion needs the norm right after the add; without it the norm takes the rms_norm_small path, which rounds differently. So a graph with the vocab-subset head normed the last hidden state with other bits than the full-head graph, and every base logit was off by an ulp: test-draft-vocab failed on llvmpipe (CI (vulkan) / ubuntu-llvmpipe, first on the 2026-11-15 sync branch). Reproduced on this host with LP_NATIVE_VECTOR_WIDTH=512 (16-wide subgroups); GGML_VK_DISABLE_FUSION=1 or GGML_VK_DISABLE_GRAPH_OPTIMIZE=1 hid it on the CI runner. ADD -> RMS_NORM now follows its add like ADD -> ADD and MUL_MAT -> ADD. Assisted-by: Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YKmjzcT1LTvKtbw9EzBVGE
…sual Studio The windows-2025-vs2026 image 20261116 brings MSVC 14.52, whose STL refuses any clang older than 22 (STL1000). The job ran vcvarsall and then used the standalone LLVM 20.1.8 in C:\Program Files\LLVM, so ggml.cpp no longer compiled, on master too. Put the clang that Visual Studio installs with its STL (VC\Tools\Llvm) first on PATH. Upstream has no fix yet: its Windows jobs still ran on image 20261103 (MSVC 14.51) at this time. Assisted-by: Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YKmjzcT1LTvKtbw9EzBVGE
The windows-2025-vs2026 image 20261116 brings MSVC 14.52, whose STL needs clang 22 (STL1000), while the image's standalone LLVM in C:\Program Files\LLVM is 20.1.8. The previous commit fixed only Behavior Check. The Windows builds in CI (cpu), CI (vulkan), Server and the Windows Vulkan release build use the same toolchain file and break the same way once they land on the new image. A composite action (windows-vs-clang) finds Visual Studio with vswhere and puts its VC\Tools\Llvm\x64\bin first on PATH if that clang exists and is 20 or newer (the fetched LLVM OpenMP needs clang 20). Otherwise the job keeps the clang it had. Behavior Check uses the action now too. Assisted-by: Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YKmjzcT1LTvKtbw9EzBVGE
The previous commit switched whenever Visual Studio had clang 20 or newer. Image 20261103 already ships clang 22.1.3 there, so the CPU and Vulkan jobs moved to clang 22 on the old image as well, and broke: GGML_OPENMP_FETCH pins LLVM OpenMP 20.1.8 (requires Clang 20), and clang 22 refuses the incompatible pointer types in ggml-cpu x86 quants.c. The action now reads the clang version that the default MSVC toolset's yvals_core.h demands (STL1000) and switches only if the clang on PATH is older. Image 20261103 (MSVC 14.51) keeps the standalone LLVM 20. Image 20261116 (MSVC 14.52) gets the Visual Studio clang 22. The release workflow checks out the action separately, because its source checkout is the built ref. Assisted-by: Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YKmjzcT1LTvKtbw9EzBVGE
The MSVC intrinsics header declares _mm_prefetch(const char *, int). Clang 22 (the Visual Studio clang that the MSVC 14.52 STL requires on the windows-2025-vs2026 image 20261116) makes -Wincompatible-pointer-types an error, so ggml_vec_dot_q4_0_q8_0 no longer compiled on Windows. Upstream has the same lines unchanged. The cast keeps the prefetched address as it was. Assisted-by: Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YKmjzcT1LTvKtbw9EzBVGE
GGML_OPENMP_FETCH pinned the LLVM OpenMP runtime to 20.1.8 and stopped with any other clang major. Clang 22, the Visual Studio clang that the MSVC 14.52 STL requires on windows-2025-vs2026 image 20261116, therefore failed CMake in the Windows x64-cpu-static and arm64 jobs. Clang 22 now takes the 22.1.3 installers (SHA-256 from the release asset digests; the 20.1.8 digests there match the existing pins). Every other clang keeps 20.1.8 and the existing version check. The openmp LICENSE.TXT is the same file in both tags. Upstream still pins 20.1.8. Assisted-by: Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YKmjzcT1LTvKtbw9EzBVGE
This was referenced Nov 18, 2026
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
Fixes two of the three root causes behind the red push checks on
masterafter #293. The third (test-qwen4exp-mtp-cache-only) is explained below but not fixed here: it needs a design change in the qwen4exp QSA reserve, not a CI patch.An agent (Claude Code) wrote this PR. What was and was not verified is listed at the end.
mastertest-grammar-parsertest-draft-vocabgraph_optimizesplit ADD from RMS_NORM, so ADD+RMS_NORM partials fusion was lost in one graph onlytest-qwen4exp-mtp-cache-onlytest-qwen4exp-mtp-cache-onlytest-llama-archson Windows too1.
test-grammar-parser(Behavior Check / ubuntu)Failing since #284 (
MAX_REPETITION_THRESHOLD2000 -> 100000), not because of #293. It also failed in CI llvmpipe/windows jobs before #293. The test expects these to be refused:"a"{5000},{5000,},{5000,6000}and six nested{0,99}. It also expects{0,5000}/{3,5000}to become unbounded. Under 100000 the parser accepts all of them. The cases now sit above 100000 (500000, nested{0,999}), so they check the same refusals at the limit this fork ships.test-grammar-*,test-llama-grammar,test-json-schema*pass.Policy note for the maintainer, not changed here: the limit is a DoS guard. With
test-gbnf-validatoron this host,(([^x]*){0,99}){0,99}gets past 100000 but not past 2000. It did not match 100 characters in 30 s;(([^x]*){0,20}){0,20}, which upstream also accepts, took 6.7 s. Any client that can send a grammar tollama-servercan send such a grammar.2.
test-draft-vocab(CI (vulkan) / ubuntu-llvmpipe)New with the sync branch: it passed on
masterfrom 2026-11-13 to 2026-11-15 and failed on every sync-branch run. Only the Q8_0 vocab-subset head with one output fails. Each base logit is about 1 ulp from the full head (3d22aef4vs3d22aef0).Root cause:
ggml_vk_graph_optimizegrabs independent nodes into the current set. TheADD -> RMS_NORMpair was not in the list of fusion pairs allowed to follow their producer. In the vocab-subset graph, theFILLnodes of the subset head were therefore put betweenl_out(ADD) and the finalRMS_NORM.ADD_RMS_NORM_PARTIALSneeds the norm right after the add. Without it, the norm goes throughrms_norm_small, which rounds differently. The full-head graph keeps the fusion. So the two contexts normed the same hidden state with different bits.Evidence:
GGML_VK_DISABLE_FUSION=1orGGML_VK_DISABLE_GRAPH_OPTIMIZE=1makes the test pass. This was found with a temporary workflow_dispatch probe branch, which is now deleted.LP_NATIVE_VECTOR_WIDTH=512(16-wide subgroups). Instrumenting the fusion check showedffn_inp-0 -> node_57 (FILL)andl_out-0 -> node_70 (FILL)in the subset graph, and-> RMS_NORMin the full-head graph.Fix:
ADD -> RMS_NORMnow follows its add, likeADD -> ADDandMUL_MAT -> ADD. This is a general Vulkan change. It only keeps a pair adjacent that a fusion already expects, and it can only make that fusion fire more often.3.
test-qwen4exp-mtp-cache-only(llvmpipe + windows/x64-openblas) - not fixedGGML_SCHED_DEBUG_REALLOC=1(set by the workflows) aborts onunexpected graph reallocation. Sequence in the test (Vulkan; the same on Windows CPU+BLAS):first=0: a new graph structure is planned (silent: backend ids changed).first=512: the incremental-QSA path (qsa_prefix_matches/qsa_fast) builds another structure. It is planned at the currentn_kv.first=1024: same structure, largercell_blk/bias/blk_*(n_kv-sized). The plan is too small, so it re-plans with an unchanged graph size, and the debug check aborts.sched_reserve/reserve_token_rangesreserve withinit_full()andn_outputs >= 1. They never build the incremental-QSA graph, so no reserve covers its worst case. A CPU-only build has one buffer, and ggml-alloc re-plans it silently. Multi-buffer schedulers (Vulkan, HIP, CPU+BLAS) cannot. This is real: every MTP catch-up ubatch on Vulkan re-plans and syncs. I also tried reservingn_outputs = 0graphs per token range. It does not help, because the reserve graph (225 scheduled nodes) still differs from the incremental one (231 nodes).test-llama-archsrefactor, so the test now builds and runs on Windows shared builds.A proper fix needs a reserve mode in
llama_memory_hybrid_idxthat builds the incremental-QSA graph at worst-case sizes, or metadata inputs that do not grow withn_kv. That is a qwen4exp design change and needs gfx1151 HIP/Vulkan logits checks, so it is out of scope here. I did not disable or relax the test or the realloc check.4. Behavior Check / windows: build error on runner image 20261116
windows-2025-vs2026image 20261116 ships MSVC 14.52. Its STL stops withSTL1000: expected Clang 22 or newer. The job ranvcvarsalland then used the standalone LLVM 20.1.8 (C:\Program Files\LLVM), soggml.cppdid not compile. This happens on master too. Fix: put the clang that Visual Studio installs with its STL (%VCINSTALLDIR%Tools\Llvm\x64\bin) first on PATH. There is no upstream fix to cherry-pick: upstream Windows jobs still run on image 20261103 (MSVC 14.51). Verified on this PR on image 20261116.315.1: clang 22.1.3, build OK, behavior tests 33/33 pass. The other Windows jobs (CI (cpu), CI (vulkan)) use LLVM 20 from PATH withoutvcvarsall. They will probably hit the same error when they get the new image. Not changed here.Verification
Local (gfx1151 host, Vulkan SDK 1.4.363.1 = CI's,
GGML_SCHED_DEBUG_REALLOC=1):ctest -L mainon llvmpipe (CI env vars): 35/36.ctest -L mainon RADV gfx1151: 35/36.test-qwen4exp-mtp-cache-onlyfails.test-draft-vocabpasses on llvmpipe at 256- and 512-bit vector width (it failed at 512 before).test-backend-ops -b Vulkan0 -o RMS_NORM|ADD|RMS_NORM_MUL_ADD|ADD_RMS_NORM: OK on RADV.Not verified: Windows (no local build), HIP, and full-model outputs. Commit 2 can change the rounding of the final norm in graphs where
graph_optimizeused to split ADD from RMS_NORM, so outputs are not byte-identical tomasterin that case.gfx1151 RADV,
llama-bench -m Qwen3.8-27B-UD-Q4_K_XL.gguf -ngl 99 -p 0 -n 64 -r 3, both built with the same SDK and flags, interleaved:f5e7a5dc8: 12.64 ± 0.05 and 12.63 ± 0.05 t/s.🤖 Generated with Claude Code
https://claude.ai/code/session_01YKmjzcT1LTvKtbw9EzBVGE