Skip to content

ci : fix test-grammar-parser and test-draft-vocab after #293; explain test-qwen4exp-mtp-cache-only - #298

Merged
dzannotti merged 7 commits into
masterfrom
hb/ci-fix-2026-11-18
Nov 18, 2026
Merged

dzannotti merged 7 commits into
masterfrom
hb/ci-fix-2026-11-18

Conversation

@dzannotti

@dzannotti dzannotti commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Overview

Fixes two of the three root causes behind the red push checks on master after #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.

Check on master Failing test Root cause This PR
Behavior Check / ubuntu test-grammar-parser test still encodes the upstream 2000 repetition limit; #284 raised it to 100000 fixed (commit 1)
CI (vulkan) / ubuntu-llvmpipe test-draft-vocab Vulkan graph_optimize split ADD from RMS_NORM, so ADD+RMS_NORM partials fusion was lost in one graph only fixed (commit 2)
CI (vulkan) / ubuntu-llvmpipe test-qwen4exp-mtp-cache-only incremental-QSA catch-up graph is never reserved, so it re-plans as the KV grows not fixed
CI (cpu) / windows / x64-openblas test-qwen4exp-mtp-cache-only same as the line above. Since #293, upstream builds test-llama-archs on Windows too not fixed

1. test-grammar-parser (Behavior Check / ubuntu)

Failing since #284 (MAX_REPETITION_THRESHOLD 2000 -> 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-validator on 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 to llama-server can send such a grammar.

2. test-draft-vocab (CI (vulkan) / ubuntu-llvmpipe)

New with the sync branch: it passed on master from 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 (3d22aef4 vs 3d22aef0).

Root cause: ggml_vk_graph_optimize grabs independent nodes into the current set. The ADD -> RMS_NORM pair was not in the list of fusion pairs allowed to follow their producer. In the vocab-subset graph, the FILL nodes of the subset head were therefore put between l_out (ADD) and the final RMS_NORM. ADD_RMS_NORM_PARTIALS needs the norm right after the add. Without it, the norm goes through rms_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:

  • On the CI runner, GGML_VK_DISABLE_FUSION=1 or GGML_VK_DISABLE_GRAPH_OPTIMIZE=1 makes the test pass. This was found with a temporary workflow_dispatch probe branch, which is now deleted.
  • On this host, the failure reproduces with LP_NATIVE_VECTOR_WIDTH=512 (16-wide subgroups). Instrumenting the fusion check showed ffn_inp-0 -> node_57 (FILL) and l_out-0 -> node_70 (FILL) in the subset graph, and -> RMS_NORM in the full-head graph.

Fix: ADD -> RMS_NORM now follows its add, like ADD -> ADD and MUL_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 fixed

GGML_SCHED_DEBUG_REALLOC=1 (set by the workflows) aborts on unexpected 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 current n_kv.
  • first=1024: same structure, larger cell_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_ranges reserve with init_full() and n_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 reserving n_outputs = 0 graphs per token range. It does not help, because the reserve graph (225 scheduled nodes) still differs from the incremental one (231 nodes).

  • On llvmpipe this has failed since about 2026-11-07. It also fails on gfx1151 RADV with this tree.
  • On Windows it is new only because Merge upstream llama.cpp up to 9048bad8d (2026-11-17) #293 brought upstream's test-llama-archs refactor, so the test now builds and runs on Windows shared builds.

A proper fix needs a reserve mode in llama_memory_hybrid_idx that builds the incremental-QSA graph at worst-case sizes, or metadata inputs that do not grow with n_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-vs2026 image 20261116 ships MSVC 14.52. Its STL stops with STL1000: expected Clang 22 or newer. The job ran vcvarsall and then used the standalone LLVM 20.1.8 (C:\Program Files\LLVM), so ggml.cpp did 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 without vcvarsall. 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 main on llvmpipe (CI env vars): 35/36.
    • ctest -L main on RADV gfx1151: 35/36.
    • In both runs, only test-qwen4exp-mtp-cache-only fails.
    • test-draft-vocab passes 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_optimize used to split ADD from RMS_NORM, so outputs are not byte-identical to master in 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:

    • base f5e7a5dc8: 12.64 ± 0.05 and 12.63 ± 0.05 t/s.
    • this PR: 12.58 ± 0.09 and 12.62 ± 0.06 t/s.
    • This is a smoke check, not the full benchmarking protocol: no pp, no perplexity, no logit comparison.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YKmjzcT1LTvKtbw9EzBVGE

dzannotti and others added 2 commits November 18, 2026 11:37
…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
dzannotti and others added 4 commits November 18, 2026 13:41
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
@dzannotti
dzannotti merged commit 4032d8f into master Nov 18, 2026
22 of 29 checks passed
@dzannotti
dzannotti deleted the hb/ci-fix-2026-11-18 branch November 18, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant