Skip to content

fix(DEBTFIX): bound the glue tensor's rank, and let quant_repack see the device - #2541

Merged
mudler merged 12 commits into
mainfrom
row/DEBTFIX-oob-and-repack
Sep 2, 2026
Merged

fix(DEBTFIX): bound the glue tensor's rank, and let quant_repack see the device#2541
mudler merged 12 commits into
mainfrom
row/DEBTFIX-oob-and-repack

Conversation

@localai-org-maint-bot

@localai-org-maint-bot localai-org-maint-bot commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Two standing defects, each already filed, neither owned by a roadmap row, and
both invisible to every gate that runs today. Spec:
.agents/specs/debtfix-glue-rank-bound-and-repack-device.md.

#2435dense_attn::MakeTensor writes past vt::Tensor's fixed arrays

MakeTensor walked i from rank - 1 to 0 writing t.shape[i] and
t.stride[i], over two int64_t[4] arrays, with no bound. A rank-5 shape wrote
eight bytes past each. shape[4] lands on stride[0], which the last iteration
rewrites correctly, so the shape damage heals itself; stride[4] lands on the
three storage markers and the first iteration writes 1 there, setting
Tensor::repacked on a tensor nothing ever repacked. That is the flag
kMatmulBTQuant reads to choose the i8mm interleaved gemm over the plain one —
a wrong kernel choice waiting for a weight, not a fault, which is why no value
gate could see it.

vt::Tensor::Contiguous — the only other writer of those arrays — has carried
this bound since it was written. This closes the parallel path: one CheckRank,
called by MakeTensor and by DBuf's constructor, which needs it before
pool_->Get because a constructor that throws never runs its own destructor.

The thirteen callers are all paged-KV fixtures spelling
{2, num_blocks, block_size, num_kv_heads, head_size}. Every one takes only
.data from the buffer and carries the five extents to PagedKvCache as
separate scalars, so folding the leading K/V axis into the block axis is the same
bytes, the same element count and the same truth at a rank the type can hold.

What was red. Under this lane's -fno-sanitize-recover=all the finding
ABORTS: test_qwen4_exp_layer_loop printed one UBSan line, ran zero
assertions, and exited 1. It now runs 341 assertions and exits 0 with zero
findings. That abort is what has reddened sanitize-cpu (address,undefined).

The "384 byte leak in 4 allocations" IS a leak, and an earlier revision of this
branch said it was not.
sanitize-cpu on this branch's own head named it:
test_glm_moe_dsa_schedule prints Status: SUCCESS! over 533 passing assertions
and then exits nonzero on 384 byte(s) leaked in 4 allocation(s) — under
VT_POOL_BYPASS=1, with the pool not involved. The case declares
std::vector<void*> owned, pushes all four allocations into it (128 + 128 for the
bf16 operands, 64 + 64 for the outputs) and never frees them; the same file's
Harness collects into owned_ and frees from ~Harness. Fixed with a
scope-exit guard, not a trailing loop, because RequireFinite and the REQUIREs
in that body throw and doctest unwinds. The earlier measurement was true (every
DevicePool::Get retention stack disappears under VT_POOL_BYPASS=1) and the
inference from it was not: that mechanism explains 53696 bytes in 114 allocations, never 384 in 4. The sweep that supported it was scoped to the
fifteen dense_device_glue.h includers and the leaking binary is not one.

#2406quant_repack was the last device-blind flag in the load policy

GgufLoadPolicy::FromEnv resolved it from vt::cpu::QuantRepackActive(), a pure
host-ISA probe. On an aarch64 i8mm host with a GPU — dgx GB10 and Jetson Thor,
both fleet devices — a --device cuda load repacked Q8_0 weights into the ARM
block_q8_0x4 interleave and staged them to a card whose quant kernels read
plain block_q8_0. Its sibling elem_kn_repack has carried dev == kCPU for
exactly this reason since it landed.

The device gate, not the dequant, and the reasons are in the spec. #2406 also
records dequantizing the qwen4_exp hyper-connection weights at load, which
mirrors vLLM and would remove all 194 repack-hazard tensors of the released
artifact at once. Rejected here because: the defect is in the policy line, not in
one architecture's tensors, and the gate fixes it for qwen3_5, glm5_next,
glm_moe_dsa, deepseek_v4 and laguna too; on dev == kCPU the gated
expression is character-for-character the old one, so the released artifact's
--device cpu control cannot move, while a dequant replaces kMatmulBTQuant
with a bf16 GEMM on 194 weights and would have to re-earn it on a box no wave
here has a lease for; and the upstream evidence for the dequant is a forward
reference 1,465 commits past the parity pin that states no position on the GGUF
arm, because vLLM loads safetensors and never meets a Q8_0 HC weight. The dequant
is recorded as owed, not refused.

QuantRepackForDevice takes the ISA answer as a parameter rather than
calling it, because QuantRepackActive() is a compile-time false off aarch64:
an assertion routed through FromEnv would pass on x86 whether the device term
existed or not. That is the move RouteGgufTensor already made for dev.

Four comments that asserted the defect away are corrected in place, including
"measured harmless on the target checkpoint (one Q8_0 tensor ... quant_repack = 0)" — docs/USAGE.md records the released UD-IQ1_S artifact carrying 194
Q8_0 hyper-connection weights.

THIS DOES NOT TURN sanitize-cpu GREEN ON ITS OWN

The sweep below built and ran every test file that can construct a DBuf or
call MakeTensor — the fifteen that include dense_device_glue.h or
dense_attn_block.h. No rank-5 caller survived, and no binary reports a leak.
Two of them still abort, on a finding that is not this one and that this branch
touches none of the files for:

src/vt/cpu/cpu_matmul_elem.cpp:577:61: runtime error: load of misaligned address
0x782f0e901907 for type 'const uint16_t', which requires 2 byte alignment
    #0 vt::cpu::WidenRowToF32   cpu_matmul_elem.cpp:577
    #1 RmsNormKernel            cpu_ops.cpp:557   <- the RMSNorm GAMMA
    ...
    #9 vllm::ModelRegistry::Forward   model_registry.cpp:646

test_dots3_note_attn and test_muse_glimmer_text, both through
ModelRegistry::Forward. It was hidden behind #2435 because the lane compiles
-fno-sanitize-recover=all and aborts at the first finding, and
test_qwen4_exp_layer_loop sorts earlier. Filed as #2540 and listed under
this spec's ## Owed. git diff --name-only against the base and the nine files
in those two stacks have an empty intersection.

Gates

Debug + -fsanitize=address,undefined, VT_POOL_BYPASS=1,
ASAN_OPTIONS=detect_leaks=1, re-measured on this merged head:

binary rc UBSan leaks assertions
test_qwen4_exp_layer_loop 0 0 0 341 / 341
test_device_pool 0 0 0 42 / 42
test_glm_moe_dsa_schedule 0 0 0 533 / 533, leak 384 → 0
test_gguf_keep_quant 0 0 0 10311 / 10311
test_glm5_next_bridge 0 0 0 32563 / 32563
test_glm5_next_moe 0 0 0 12731 / 12731
test_qwen4_exp_qsa_block 0 0 0 5937 / 5937
test_kv_cache_fp8_wiring 0 0 0 487 / 487
test_qwen3_dflash2_draft 0 0 0 449 / 449
test_qwen4_exp_forward 0 0 0 429 / 429
test_load_direct_upload 0 0 0 203 / 203
test_resident_weight_host_addressable 0 0 0 85 / 85
test_qwen3_5_gdn_spec_routing 0 0 0 82 / 82
test_qwen4_exp_inject_residency 0 0 0 8 / 8
test_qwen4_exp_matmul_bt_dtype 0 0 0 2 / 2
test_mistral_paged_engine 0 0 0 0 / 0, a self-declared skip: "mistral-7B-v0.3 checkpoint absent (dgx-only)"
test_dots3_note_attn 1 1 0 #2540, not this branch
test_muse_glimmer_text 1 1 0 #2540, not this branch

scripts/agent-preflight.sh --staged and scripts/agent-ready.py: no gate
failed
. check-tree-compiles 805 / 805 TUs. agent-ready exits 1 only on its
--fail-on-skip rule, for the same five gates that skip on this host with no
change applied (check-arm-isa-build, check-cpu-isa-build,
check-cuda-fat-gencode, check-pr-size, check-triton-aot-multiarch).

Mutations

# mutation result
M1 delete CheckRank from MakeTensor rc 1, UBSan index 4 out of bounds at the CHECK_THROWS line
M2 delete CheckRank from DBuf's constructor rc 1, CHECK(a.allocs() == 0) reads 1 == 0 — the block really is stranded
M3 make CheckRank throw unconditionally rc 1, ModelRegistry::Forward reaches it on a loaded qwen4exp GGUF THREW — the reachability evidence
M4 revert the FromEnv wire rc 0, 9987/9987 — SURVIVED
M5 drop && dev == kCPU from the predicate rc 1, the kCUDA, kROCM and kXPU rows read true == false

M4 survived and it is reported as a finding. No x86 host can tell the wired
predicate from the expression it replaced, because the ISA probe is a
compile-time false here. M5 gates the rule; the wire is gated only on an
aarch64 i8mm box, where the case's VT_GGUF_KEEP_QUANT=1 arm becomes
discriminating. Behind it stand the two runtime tripwires that already existed
and that ARE gated everywhere (test_resident_weight_host_addressable, 85/85),
so a reverted wire refuses by name rather than emitting wrong tokens.

What is not proved

The CPU control 11751 13 15767 411 2029 11 1092 369 was not re-run: thor:gpu0
belongs to another wave. It is unchanged by construction, not by measurement.
The aarch64 CUDA measurement of the repack trade that #2406 asks for is still
owed and is recorded under the spec's ## Owed.

Closes #2435
Closes #2406

Refs #2540

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: claude-code:claude-opus-5 [Claude Code]

… cannot see the device

Two standing defects, each already filed and neither owned by a roadmap row.
#2435 is an unbounded write in dense_attn::MakeTensor: it walks i to rank-1 over
two int64_t[4] arrays and a rank-5 shape sets Tensor::repacked as a side effect,
which is why every value gate reads SUCCESS! while the process exits 1 under
UBSan. #2406 resolves quant_repack from a host-ISA probe with no device term,
so an aarch64 i8mm host loading --device cuda stages ARM-interleaved Q8_0 bytes
to a kernel that reads plain block_q8_0.

The spec records why #2406 takes the device gate rather than the dequant option
the issue also lists: the defect is in the policy line and not in one
architecture's tensors, the gate cannot move the released artifact's CPU control
by construction while the dequant would have to re-earn it, and the upstream
evidence for the dequant is a forward reference 1,465 commits past the pin that
states no position on the GGUF arm at all. The dequant is recorded as owed, not
refused.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: claude-code:claude-opus-5 [Claude Code]
…the device

Two defects, both invisible to every gate that runs today.

dense_attn::MakeTensor walked i to rank-1 over vt::Tensor's int64_t[4] shape and
stride, with no bound. A rank-5 shape wrote eight bytes past each: shape[4] onto
stride[0], which the last iteration then rewrote correctly, and stride[4] onto
the three storage markers, setting Tensor::repacked on a tensor nothing ever
repacked. The thirteen callers are all paged-KV fixtures that take only the data
pointer, so folding the leading K/V axis into the block axis is the same bytes at
a rank the type can hold. vt::Tensor::Contiguous has always carried this bound;
this closes the parallel path. Under -fno-sanitize-recover=all the finding aborts
the process at once, so test_qwen4_exp_layer_loop produced one UBSan line and no
assertion at all -- that abort is what reddened sanitize-cpu (address,undefined).
It now runs 341 assertions and exits 0, with zero findings (#2435).

quant_repack was the one device-dependent flag in GgufLoadPolicy::FromEnv still
resolved from a pure host-ISA probe. On an aarch64 i8mm host a --device cuda load
repacked Q8_0 weights into the ARM block_q8_0x4 interleave and staged them to a
card whose kernels read plain block_q8_0; QuantRepackForDevice now takes the
resolved device, gated dev == kCPU exactly as its sibling elem_kn_repack always
was. The predicate takes the ISA answer as a parameter rather than calling it,
because QuantRepackActive() is a compile-time false off aarch64 and an assertion
routed through FromEnv would pass on x86 whether the device term existed or not.
On kCPU the expression is character-for-character the old one, so a CPU load is
unchanged by construction (#2406).

Four comments that asserted the second defect away are corrected in place,
including the claim that it was "measured harmless on the target checkpoint (one
Q8_0 tensor)" -- docs/USAGE.md records the released artifact carrying 194.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: claude-code:claude-opus-5 [Claude Code]
…wed item #2406 closed

The spec now carries what was measured rather than what was expected. Two
corrections to the issues it closes. #2435 describes its red as three UBSan
lines beside `309/309, SUCCESS!`; this lane compiles -fno-sanitize-recover=all,
so the first finding aborts and the test reports no assertion at all -- the
sanitizer lane was never saying the test passes, only that it started. And the
"384 byte leak in 4 allocations" is not a leak: every stack is DevicePool::Get,
the retention the CI job's own VT_POOL_BYPASS=1 exists to switch off, and under
that variable LeakSanitizer reports nothing on any of the seven binaries.

M4 SURVIVED and is recorded as a finding: reverting the FromEnv wire is
invisible on x86, because QuantRepackActive() is a compile-time false here.
M5 shows the rule is gated everywhere; the wire is gated only on an aarch64
i8mm box, and the runtime tripwires that are gated everywhere stand behind it.

ENG-GGUF-RESIDENCY-RESOLVED-DEVICE's `## Owed` entry for #2406 is struck
through with what closed it, and its F5 review finding points at the closure.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: claude-code:claude-opus-5 [Claude Code]
dense_attn::KvSlice builds a rank-4 strided view of the same page, carrying the
K/V axis as a byte offset rather than a dimension. That is the evidence that the
thirteen rank-5 fixture shapes were a spelling and not a lost dimension.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: claude-code:claude-opus-5 [Claude Code]
Line anchors go stale inside the pull request that writes them. Four in this
spec are replaced by the symbol or the test-case name they meant.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: claude-code:claude-opus-5 [Claude Code]
…o overlap

origin/main gained seven commits, all of them UPSTREAM-SYNC-PINPORT records
under .agents/sync/, .agents/specs/upstream-sync-pinport.md and
.agents/porting-inventory.md. This branch touches none of those paths and no
source file on either side moved, so the merge is textual only and no claim in
this branch's spec, tests or evidence is falsified by it. The seven sanitizer
binaries measured on 6388944 therefore still describe this head.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: claude-code:claude-opus-5 [Claude Code]
…t is not ours

Every test file that can construct a DBuf or call MakeTensor -- the fifteen that
include dense_device_glue.h or dense_attn_block.h -- was built and run under
address,undefined. Ten are clean and no rank-5 caller survived the static scan.
Two are not: test_dots3_note_attn and test_muse_glimmer_text both abort on a
misaligned bf16 load of an RMSNorm gamma in WidenRowToF32, reached from
ModelRegistry::Forward on both models. This branch touches none of the nine files
in either stack.

It was hidden behind #2435 because the lane compiles -fno-sanitize-recover=all
and aborts at the first finding, and test_qwen4_exp_layer_loop sorts earlier.
Filed as #2540 and listed under this spec's ## Owed. The spec's scope now says
plainly that this wave does not turn the lane green by itself.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: claude-code:claude-opus-5 [Claude Code]
…d the pin hold

Twenty commits, and unlike the first merge this one moves source: QUANT-IQ3S adds
a ggml IQ3_S reader across vt::DType, the CPU and CUDA dequant tiers and the GGUF
loaders, BACKEND-ROCM-GFX1151-HANG and BENCH-ROCM-STRIX-QWEN38 land records and a
grouped-GEMM change, and UPSTREAM-SYNC-PINPORT holds the pin.

Two of the files this branch edits moved on main and auto-merged cleanly:
tests/vllm/test_gguf_keep_quant.cpp gained IQ3_S encodings and this branch's
QuantRepackForDevice case and mirror both survive it, and
tests/vllm/models/test_glm5_next_bridge.cpp gained IQ3_S rows beside this
branch's corrected quote of the quant_repack expression. Neither of this branch's
two subjects -- dense_attn::MakeTensor and the quant_repack policy line -- is
touched by any of the twenty, so no claim in the spec is falsified. The sanitizer
evidence is re-measured on this head rather than carried across, because IQ3_S
edits the same binary two of those tables name.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: claude-code:claude-opus-5 [Claude Code]
origin/main moved twenty commits and QUANT-IQ3S edits two of the binaries this
spec tabulates, so the sanitizer numbers were re-taken rather than carried
across the merge: test_gguf_keep_quant 9987 -> 10311 and test_glm5_next_bridge
32562 -> 32563 assertions, both still rc=0 with zero findings. #2540 still reds
the same two binaries and nothing else moved.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: claude-code:claude-opus-5 [Claude Code]
CI ran the whole 701-test suite under address,undefined on this branch's own head
and named it: test_glm_moe_dsa_schedule reports `Status: SUCCESS!` over 533
passing assertions and then exits nonzero on `384 byte(s) leaked in 4
allocation(s)` -- #2435's figure exactly, under VT_POOL_BYPASS=1, with the pool
not involved at all. The case declares `std::vector<void*> owned` and pushes
every allocation into it, and nothing ever frees them: 128 + 128 for the two bf16
operands, 64 + 64 for the two outputs. The same file's Harness collects into
owned_ and frees from ~Harness; this case duplicated the vector and dropped the
destructor.

The fix is a scope-exit guard rather than a trailing free loop, because
RequireFinite and the REQUIREs in that body throw and doctest unwinds.

An earlier pass of this branch concluded the leak did not exist. That was wrong
and the spec now carries the correction rather than the conclusion: the earlier
measurement (every DevicePool retention stack disappears under VT_POOL_BYPASS=1)
was true, and the inference from it was not, because the figure it explained was
53696 bytes in 114 allocations and never 384 in 4. The sweep that supported it
was scoped to the fifteen dense_device_glue.h includers, and the leaking binary
is not one of them.

Also folded in: build-test-cpu-arm64 does not gate the #2406 wire. It builds four
targets and runs no ctest, so it never reaches GgufLoadPolicy::FromEnv; the only
aarch64 job that builds the suite fires on schedule or workflow_dispatch alone.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: claude-code:claude-opus-5 [Claude Code]
…OCm f16 codec

Twenty-nine commits. The source half is QUANT-EXL3 (a native EXL3 loader plus CPU,
CUDA and ROCm dequant arms), LTX-2.5 pipeline and video work, and a ROCm f16
codec that edits src/vt/ops.cpp and include/vt/ops.h. One file overlaps this
branch, qwen3_5.cpp, and it auto-merged: main's change is elsewhere in the file
and this branch's correction of the quant_repack tripwire comment is intact and
reads correctly.

Two claims were re-verified against this head rather than carried across it. The
rank-5 scan re-run over the merged tree finds exactly two brace-literal tensor
constructions above vt::kMaxRank, and both are this branch's own deliberate
CHECK_THROWS arms in test_device_pool -- main introduced no new caller for the
bound to refuse. The sanitizer tables are re-measured below rather than inherited,
because ops.cpp and vt/ops.h are in the dependency of every binary they name.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: claude-code:claude-opus-5 [Claude Code]
test_glm_moe_dsa_schedule joins the re-measured table at 533/533, rc 0, and its
LeakSanitizer summary goes 384 bytes in 4 allocations to nothing. Sixteen
binaries re-measured on the head that carries both origin/main merges.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: claude-code:claude-opus-5 [Claude Code]
@mudler
mudler merged commit a99b9c6 into main Sep 2, 2026
22 of 26 checks passed
mudler added a commit that referenced this pull request Sep 2, 2026
…nd and repairing a red main brought with it

TWO CONFLICTS, RESOLVED ON THE RULE AND NOT BY A THREE-WAY MERGE. AGENTS.md
"Records" requires taking the complete target-branch version and re-applying the
scoped edit, then verifying unrelated keys are byte-for-byte equal. Both were
done that way and both were VERIFIED that way rather than eyeballed:

`scripts/env-doc-allowlist.txt` -- took main's 244-line file and inserted the one
key `VT_Q4EXP_LAYER_FP` in sorted position. Diff against the target is exactly
one added line and zero removed, and the file with that one line stripped is
byte-identical to the target. #2550's `VT_Q4EXP_STATE_FP` survives; a take-both
would have dropped one of the two.

`.agents/specs/qwen4-exp-flash-next.md` -- this row's spec is written by several
waves at once, so a take-both can apply two contradictory edits silently. This
wave's change is PURE INSERTION, zero removals: 24 lines under `## Owed` and 191
lines before `## Now`. Took main's 9064-line file and re-applied both blocks at
their anchors. Result is target + exactly 215 lines, 0 removed, and removing
precisely those two blocks reproduces the target byte for byte. #2550's
`## DECODEDIV (#2496)` section and its two `## Owed` bullets are intact.

AND THE MERGE SURFACED A RED THAT IS MAIN'S, NOT THIS BRANCH'S (#2559).
`tests/test_qwen4_exp_layer_loop` throws in THREE cases on the merged tree, and
only one of them is this wave's. #2541 added `kMaxRank` to
`dense_attn::MakeTensor` -- absent at `28b3786ed`, present at `35116605b` -- and
#2550 and #2538 then landed rank-5 paged-KV buffers on top of it, conflicting
with nothing and red on arrival. Every `ci` run on main since is `cancelled`, so
no verdict was ever rendered. The header under test and both non-PREFILLDIV case
bodies are byte-identical to main's, which is what makes the observation a
measurement of main rather than of this merge.

Repaired in flow, in main's own convention and as a pure spelling change: the
vestigial unit axis `{2, 1, T, kKvHeads, kHeadDim}` becomes
`{2, T, kKvHeads, kHeadDim}` beside its `num_blocks = 1; block_size = T`, and
the paged form `{2, kBlocks0, kPage, kKvHeads, kHeadDim}` becomes
`{2 * kBlocks0, kPage, kKvHeads, kHeadDim}`, whose element count is already
spelled on the line above it. Same elements, same contiguous layout.

`assertions: 352 | 352 passed | 0 failed` beside `3 failed` cases is the
signature worth keeping: these cases throw BEFORE asserting, so an assertion
count alone reads as a clean run.

Gate on the MERGED result, every rc read literally: build rc=0,
`test_qwen4_exp_layer_loop` rc=0 with 13/13 cases and 426/426 assertions,
`test_qwen4_exp_forward` rc=0 with 429/429, and the fingerprint case still
counts 41 == 41 taps.

Refs #2547. Refs #2559.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:claude-opus-5-1m [claude-code]
mudler pushed a commit that referenced this pull request Sep 2, 2026
…vergence is upstream's own algorithm, and main was red

A per-layer fingerprint over 437 taps per step puts the first divergent tensor at
decoder layer 0's Gated DeltaNet block output, rel 3.525e-04, from an input that
is bit-identical on both arms. VT_GDN_CHUNKED=0 collapses that tap 332x, naming
the chunked prefill decomposition -- which matches vLLM's vendored FLA precision
map at all five anchors. The CUDA arm mirrors the oracle; our CPU arm's exact
sequential f32 recurrence is the outlier, more accurate than vLLM rather than
more correct. #2547's only named candidate is cleared by measurement.

Token agreement is not monotone in numerical distance: the sequential arm is 2.8x
closer on the hidden state and agrees on three of eight ids against five, because
decode is an argmax over near-ties. No CPU-vs-CUDA token-exactness gate is
proposed.

This merge also repairs a break main was already carrying. #2541 added the
kMaxRank bound to dense_attn::MakeTensor, and #2538 and #2550 then landed rank-5
paged-KV buffers on top of it. Neither conflicts textually with the bound, so
both merged clean and both were red, and every ci run on main since has been
cancelled, so no verdict was rendered. The repair is a pure spelling change with
the same element count and the same contiguous layout.

Worth keeping from that diagnosis: the failing binary printed
'assertions: 352 | 352 passed | 0 failed' beside three failed cases, because they
throw before asserting. An assertion count alone reads as a clean run.
FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: claude-code:claude-opus-5 [Claude Code]
mudler added a commit that referenced this pull request Sep 2, 2026
… this wave's spec section onto the target

`build-test-cpu` was red on #2556 and the failure was not this wave's:
`test_qwen4_exp_layer_loop`, the rank-5 fixture break `main` was already carrying
after #2541 bounded `dense_attn::MakeTensor` at `kMaxRank = 4` and #2538 and
#2550 landed rank-5 paged-KV fixtures on top of it. Neither conflicted textually
with the bound, so both merged clean and both were red, and every `ci` run on
`main` is cancelled by the next push, so no verdict was ever rendered. #2554
repaired it as #2559. This branch pre-dated that repair; merging `main` is what
clears the red, and it does: `test_qwen4_exp_layer_loop` rc=0 at
`assertions: 426 | 426 passed | 0 failed`.

The spec conflicted exactly where this wave predicted it would. #2554 added
`## Wave PREFILLDIV` at the same anchor above `## Now` that this branch adds
`## Wave MOEDIV` to. It is resolved on the keyed-record rule rather than by
accepting a three-way merge: the complete target-branch file was taken and this
wave's one contiguous block re-applied to it, and the result is proven
numerically rather than eyeballed. Against the target, 0 lines removed and
exactly 167 added, which is the block's own line count; deleting precisely those
167 lines reproduces the target BYTE FOR BYTE
(`dd1d7ef61cedc14e61fa01f92e01a96797c4599a3e0c53d0ad9ad6396be68d3c` either side);
and the re-applied block is byte-identical to the one this branch already
carried. All three sibling sections survive whole and in landing order:
`## DECODEDIV` (#2496), `## Wave PREFILLDIV` (#2547), `## Wave MOEDIV` (#2552).

The conflict-free hunks were re-checked too, because a clean merge has falsified
this tree's prose repeatedly. `scripts/env-doc-allowlist.txt` carries BOTH keys
rather than one clobbering the other (`VT_MOE_SEL_FP` and #2554's
`VT_Q4EXP_LAYER_FP`); the tap's definition and its one production call site (2),
its switch read once (1) and its ctest entry (2) all survive; and #2554's
`docs/USAGE.md` correction — that `--device cuda` NOW SERVES this artifact — is
still on the merged tree rather than reverted by a branch that deliberately never
touched that file.

This wave's result is unchanged by the merge and is not re-derived here: it was
measured on `a99b9c69a` and nothing merged since touches the sparse-MoE seam, the
router or the keep-quant grouped GEMM.

Read literally on the merge result: CMAKE rc=0, BUILD rc=0,
`test_qwen4_exp_layer_loop` rc=0 (426/426), `test_qwen4_exp_moe` rc=0 at
`121 | 121 passed` switch unset and rc=0 at `172 | 172 passed` switch set.

Refs #2547.
Refs #2559.
Refs #2552.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:claude-opus-5-1m [claude-code]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants