You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
hrx: router_common_matmul.experts128.tokens512 faults the device, and resets the GPU inside a full sweep #2861
router_common_matmul.experts128.tokens512 is a single-case reproducer for an AMDGPU memory access fault. Found while sweeping hrx-ops-test for #2774; filed separately because it is a device bug, not a suite bug, and because 512 tokens × 128 experts is a production shape for the 27B MoE.
Reproducer
Strix Halo (gfx1151), the fleet bench tree ~/.cache/hrx-build/bench, one gpu-hold ticket:
execute_prepared_command_program: wait for direct HRX command program failed:
hrx-system/runtime/src/iree/hal/drivers/amdgpu/system_event.c:122: ABORTED;
AMDGPU memory access fault at device address 0x00007f58c22d2000 (reason mask 0x00000001)
graph_compute: execute uncached HRX command program failed
ggml-hrx.cpp:1018: ggml::hrx::stream_synchronize_sleeping(context->stream, synchronize_wait_history) failed: ... ABORTED
tests/hrx-ops-test.cpp:4956: requirement failed: ggml_backend_graph_compute(backend, graph) == GGML_STATUS_SUCCESS
Aborted (core dumped)
4 s in, exit 134, every time.
Two severities from the same case
Alone: the fault above, the process aborts, the device stays usable.
In a full sweep (hrx-ops-test --hrx-test-jobs 1 --hrx-test-output failed, case 353 of 394): three amdgpu 0000:c5:00.0: [gfxhub] page fault lines, then
amdgpu 0000:c5:00.0: GPU reset succeeded, trying to resume
amdgpu 0000:c5:00.0: GPU reset(1) succeeded!
amdgpu 0000:c5:00.0: GPU reset: queues of 1 process(es) are no longer usable
which resets the GPU for the whole box and makes gpu-hold refuse new tickets for 10 minutes. The sweep cannot finish past this case, so a green hrx-ops-test run is currently impossible.
Why it matters beyond the suite
The fault is in the experts-route matmul at tokens=512, experts=128 — a shape the 27B MoE actually runs. The reason mask 0x1 and the address are identical across runs, so the bad offset is deterministic: worth checking whether the route/index table for that many tokens is sized off the token count rather than the expert count (or vice versa) in the dispatch the case selects.
Related: #2494 (closed) describes the same fault signature without a minimal case; #2774 tracks the suite side.
Plan: run the reproducer alone under gpu-hold, then bisect the shape — experts128/64/32 against tokens512/256/128 — to find the largest parameters that still fault and the smallest that do not. Then check whether the fault survives a different weight format on the same case, and localize the faulting address (weight vs activation vs output buffer) from the binary's allocation layout / the address in the fault message.
Will post the boundary table and what I ruled out in one comment here. Rules I am following: every run wrapped in gpu-hold -t N -l <label> -w SECONDS --, and the 10-minute refusal window after any fault is respected (no retries inside it). PRs only, nothing on main.
Narrowed: it is a routing-table packing mismatch, not a size limit
I reproduced the case with a standalone harness that mirrors run_router_common_matmul_case
(same graph, same failure site ggml-hrx.cpp:1018) so expert count, token count and weight format
could be varied freely — hrx-ops-test only registers experts 128/256/512 x tokens 1/2/512, so experts64/experts32/tokens256/tokens128 are not cases the binary can run as shipped.
Root cause: the Qwen router packs the routing tables in the Qwen descriptor layout
(mask 127, shifts 7/13, 128 lanes) for every expert count <= 128, while the common ggml_mul_mat_id_f32_f32_wmma kernel that consumes them here decodes the common layout
(mask 511, shifts 9/15) with hard-coded constants. As soon as one expert receives >= 2 tokens the
consumer decodes row-count bits as a partition ordinal, reads assignment ordinals past the expert
table, and gathers a weight tile for an expert index that does not exist.
Three regimes, from the dumped command programs
GGML_HRX_DUMP_COMMAND_PROGRAM_DIR on the pass/fault shapes (experts32, experts64, experts128, experts256 at 16 tokens, and experts128/tokens64) shows three different programs for the same graph:
experts32/tokens16 — the Qwen router is not dispatched, the graph falls back to generic top-k ops
and the tables carry the common layout, which the consumer matches. Result exact (maxdiff 6e-8):
experts64|128 — the Qwen router is dispatched (dispatch-moe-router.cpp:83-90, expert_count >= 64 && % 64 == 0) and emits the Qwen layout, which the common consumer mis-decodes:
0 qwen3_moe:qwen3_moe_router_top8_f32
1 ggml_moe_build_expert_table descriptor_expert_mask=127 partition_shift=7 row_count_shift=13 wg=128
2 ggml_moe_build_expert_partition_table descriptor_expert_mask=127 partition_shift=7 row_count_shift=13 wg=128
3 ggml_mul_mat_id_f32_f32_wmma (no descriptor_* parameters at all -> hard-coded 511/9/15 in the .loom core)
4 ggml_binary_bc_f32
experts256 — same Qwen router, but moe_router_descriptor_layout returns the common layout above
128 experts (that was the fix for the earlier >128-expert fault), so it is exact (3.7e-9):
So this is the same bug as the >128-expert one, still present on the other side of the same if:
the layout is chosen from the expert count alone, and the common mul_mat_id dispatcher happily adopts
whatever layout the router published.
Fault attribution: the weight buffer, far outside it
GGML_HRX_DIAGNOSTIC_GRAPH_KERNEL_ID=0 (one command at a time) on experts128/tokens64:
i.e. the fault is in the gather (ggml_mul_mat_id_f32_f32_wmma, ordinal 3), not in the two table
builders. Device VAs of the same run:
experts (weight) f16 [256,128,128] va=0x7f7b95c29200..0x7f7b964291ff (8 MiB, 65536 B per expert)
fault 0x7f7b96baa000 = weight + 0xf80e00 = expert slot 248 + 2560 B
and the same arithmetic on the other faults:
case
weight VA
fault VA
offset into weight
virtual expert slot
128 experts x 64 tok, f16
0x7f7b95c29200
0x7f7b96baa000
0xf80e00
248 of 128
128 experts x 64 tok, bf16
0x7f01e9629200
0x7f01ea5ab000
0xf81e00
248 of 128
128 experts x 48 tok, f16
0x7fe9ac61ee00
0x7fe9ad617000
0xff8200
255 of 128
64 experts x 64 tok, f16
0x7f6a1d81d200
0x7f6a1e40d000
0xbefe00
190 of 64
Every one of them is in the weight buffer, ~120-127 expert slots past the end of the weight
matrix, and 7-8 MiB past the end of the whole device buffer: a wild expert index, not a
boundary overrun, and not the activation or the output. The virtual slot is remarkably stable,
which is why it reproduces in 3 s every time.
Boundary (all under gpu-hold)
experts
tokens
format
result
32
9, 16
f16
pass, exact (6e-8) — generic top-k path, common layout
64
16, 32
f16
pass, wrong values (maxdiff 0.63)
64
64
f16
FAULT (rc 134, 3 s)
128
1, 2, 8
f16
pass, exact — decode path (T*R <= 64), routing tables not built at all
128
9, 16, 20, 24, 32
f16
pass, wrong values (maxdiff 0.63)
128
48
f16
FAULT (rc 134, 3 s)
128
64
f16 / bf16 / q8_0
FAULT in all three (rc 134, 3 s)
256, 512
16
f16
pass, exact (3.7e-9)
Largest parameters that still pass without faulting: 128 experts x 32 tokens (and 64 experts x 32
tokens — both return wrong values). Smallest parameters that fault: 128 experts x 48 tokens
(shared with 64 experts x 64 tokens; you named 512 tokens, it faults from 48 tokens upwards).
The threshold is data dependent — the misdecoded partition ordinal only leaves the table once an expert
collects enough assignments — so treat 48/64 as a band, not a hard cut-off.
Ruled out
Not tokens=512: faults at 48 and 64 tokens; 32 tokens does not.
Not experts=128 as a size: 512 experts are exact, 32 experts are exact, 64 experts already
returns wrong values. What changes across those rows is (a) whether the Qwen router is dispatched
(>= 64 and a multiple of 64) and (b) which descriptor layout it publishes (Qwen only <= 128).
Not the weight format: at experts128/tokens64 f16, bf16 and q8_0 all fault identically in 3 s,
bf16 landing on the same virtual expert slot as f16. The garbage index comes from the routing tables,
not from the weight bytes.
Not the table sizes (the hypothesis in the issue body): both tables are sized off both counts and
builder and consumer agree byte for byte — expert table (128 + 128*64)*4 = 33280, partition table (1 + (64*8+31)/32 + 128)*4 = 580. They disagree on packing, not on size.
Not a grid / descriptor-count mismatch: launch_partition_count = max(ceil(T*R/32), E) does cover
the descriptors the builder writes. (There is a latent disagreement worth a separate issue — the
builder can write ceil(T*R/32) + E descriptors while the grid launches max(ceil(T*R/32), E) workgroups — but it is not what fires here.)
Not a one-row overrun of the expert table: the wild read is 8 MiB out, in the weight buffer.
Code pointers
dispatch_registration/common/dispatch-moe-routing-layout.h:52-57 — the selector keys only on expert_count; the header's own comment already states that the Qwen layout's consumers are the
qwen3_moe routed kernels and the common layout's consumer is ggml_moe_unpack_expert_partition_descriptor.
dispatch_registration/qwen/dispatch-moe-router.cpp:379-385 — where that layout is chosen; :83-90 — the expert_count >= 64 && % 64 == 0 gate that decides whether the router runs at all.
dispatch/command-plan-metadata.h:111-122 — CommandPlanMoeRoutingBundle carries no layout field,
so a consumer cannot tell which packing it was handed.
dispatch_registration/common/dispatch-mul-mat-id-common.h:192-204
(common_mul_mat_id_bundle_matches, used at :271) — matches value ids, byte counts, counts and route_stride, not the packing, so a Qwen-packed bundle is adopted by the common dispatcher as-is.
kernel-corpus/kernels/loom-libs/motifs/mul_mat_id_f32_f32_wmma_core.loom:22-38
(ggml_moe_unpack_expert_partition_descriptor) — hard-coded 511 / 9 / 15 / 63 / 31, the common
layout, with the comment "Common descriptor packing uses a 9-bit expert ordinal…" right above it.
Suggested fix (happy to send a PR)
Minimal, in the spirit of the >128 fix: make the layout selector (or common_mul_mat_id_bundle_matches) require the common packing unless the consumer really is a
qwen3_moe routed kernel; the common dispatcher then builds its own tables (two extra tiny kernels)
instead of mis-decoding the router's. Cleaner long term: record the descriptor layout in CommandPlanMoeRoutingBundle and derive the consumer / decode constants from it, so the layout stops
depending on which dispatch claimed the value first.
Worth stressing that the crash is the loud half of it: every <= 128-expert, >= 64-expert case with
two or more tokens per expert already returns wrong values (maxdiff 0.63 on the whole router output)
without faulting, so this silently corrupts MoE routing as well.
One more observation, since the issue says the device survives when run alone: on this box (gfx1151)
the single reproducer also wedges the GPU — amdgpu: GPU reset(3) succeeded! / GPU reset: queues of 2 process(es) are no longer usable / [drm] device wedged. A full sweep is not needed for that, only
for it to be obvious.
Harness (drop-in mirror of run_router_common_matmul_case, ~700 lines with a CLI for --experts/--tokens/--wtype/--constant-ids and device-VA printing) and all raw logs are available if
you want them attached here or as a PR.
This case does not just fault the device — on strixhalo it wedges the machine. Reproduced 2026-11-19 while A/B-ing GPU firmware.
Sequence (boot 259451f2, kernel 7.4.0-rc1-1bit, GC 11.5.2 firmware from linux-firmware afa73dfc, i.e. the August blobs):
03:24:40 amdgpu 0000:c5:00.0: [gfxhub] page fault (src_id:0 ring:24 vmid:10 pasid:25) ×4
03:24:40 amdgpu 0000:c5:00.0: in page starting at address 0x00007f2754aac000 from client 10
03:24:41 kernel: [UFW BLOCK] …
<- then nothing: no GPU reset attempt, no "MES unrecoverable", ssh stops answering
Ten fault/reset lines in that boot, all at the moment the case ran; the box had been up ~11 minutes and idle. Recovery needed a physical power cycle.
Command (gate tree, add-on enabled, one gpu-hold ticket):
cd ~/.cache/hw-gate/build-685489b587
export LD_LIBRARY_PATH=$PWD
export IREE_HAL_AMDGPU_LIBHSA_PATH=/opt/rocm-therock/lib/python3.14/site-packages/_rocm_sdk_core/lib/libhsa-runtime64.so.1
./bin/test-hrx-ops --hrx-ops-test-test-case router_common_matmul.experts128.tokens512
Two consequences worth recording:
Severity: a single failing test case can take the whole box down, so this cannot be run in a loop or in a CI sweep without a physical-access plan. It is a reason the ops suite is not a good gate input for this row.
The fault does not require the old firmware — it reproduces on the August GC 11.5.2 blobs as well as the June ones. So firmware is not the only cause, and any theory that blamed MES alone is incomplete.
Also relevant to #2478 and #2542: this is the first case in the tracker where a fault reliably escalates to a hang instead of a GPU reset(1) succeeded, which is what those issues see. The difference in the fault line here is ring:24 vmid:10 pasid:25 and client 10; the earlier sweeps reported [gfxhub] page fault followed by a successful reset.
Cause: the router writes a different descriptor layout than the mul_mat_id consumer reads, and the bundle check compares only sizes
The deterministic address and reason mask 0x1 are explained by a wrong expert index, not by a wrong tensor size: the partition table is built with the Qwen layout and decoded with the common layout, and the partition field lands inside the common expert field.
Three facts, each checkable in the source at the fork pin:
The reader does not — the common ggml_mul_mat_id dispatch hard-codes the common layout for every expert count it accepts (common_mul_mat_id_supported_expert_count = 1..512, dispatch-mul-mat-id-common.h:89), passing kMoePartitionExpertMask/Shift/RowCountShift = 511/9/15 (command-plan-metadata.h:29-31).
Nothing compares the two.common_mul_mat_id_ensure_moe_routing_bundle() reuses the router's bundle when common_mul_mat_id_bundle_matches() says yes, and that function (dispatch-mul-mat-id-common.h:192-203) compares token_count, route_count, expert_count, route_stride and the two byte counts — never the layout. The byte counts do match, because expert_table_size/partition_table_size in dispatch-moe-router.cpp:121-129 are byte-identical to the common formulas. So the Qwen-laid table passes the check and is decoded as common.
Why this shape and not the neighbours
v = expert | (partition << 7) | ((rows-1) << 13) written by the router; expert = v & 511 read by the consumer. When an expert's partition index reaches 1, partition << 7 sets bit 7, which is inside the consumer's 9-bit expert field:
experts=128 tokens=512 router wrote expert=127 partition=1 -> v=0x03e0ff
consumer decodes expert=255 (127 + 1*128)
router wrote expert=127 partition=2 -> v=0x03e17f
consumer decodes expert=383
router wrote expert=127 partition=3 -> v=0x03e1ff
consumer decodes expert=511 -> 24 MiB past the 8 MiB weight tensor
The gather runs off the end of the expert weight tensor and the address is fixed, because the partition indices are fixed by the routing. partition >= 1 needs some expert to own more than 32 rows, which is exactly why the small siblings pass:
experts
layout written
tokens 1, 2, 32
tokens 33
tokens 512
128
qwen 127/7/13
no escape
8 descriptors escape, expert 255
96 escape, expert up to 511
256
common 511/9/15
no escape
no escape
no escape
512
common 511/9/15
no escape
no escape
no escape
(the sweep never reached experts256/512.tokens512, so their safety is a prediction, not a measurement)
Two consequences worth acting on:
The minimal repro shape is experts=128, tokens=33, not 512 — the first case where one expert owns 33 rows. If it faults, the cause is the layout boundary and nothing else; if it does not, this analysis is wrong and I will say so.
experts=256/512, tokens=512 should pass. If either faults, there is a second, unrelated bug, and the shape table above is the cheapest way to tell the two apart.
Guard
The consumer must refuse a bundle whose descriptor layout is not its own, and build the table with its own layout instead (has_routing_bundle = false path already exists and produces the correct table). That is a two-file change — carry the layout in CommandPlanMoeRoutingBundle and compare it in common_mul_mat_id_bundle_matches() — and it holds for the >128 direction too, where the current code is correct only by coincidence of both sides agreeing. The longer-term fix is for the router to choose the layout from its consumer rather than from the expert count; the guard is what makes that safe to do later.
I have not run the device yet: the box has reset five times since 11-16 and the last one was 11-19 21:16Z (MES might be in unrecoverable state), so the first run goes inside one gpu-hold ticket with the shape matrix above, and I will stop rather than retry if the take is refused.
Guard PR: 1bit-MONSTER/llama.cpp#436 — the bundle now carries the descriptor layout it was written with, and common_mul_mat_id_bundle_matches() refuses a bundle that was written with a different one (falling back to the existing "build my own table" path). Header-only test pins the boundary, the guard, and the 12-of-16-partitions arithmetic, with tokens=33 as the minimal repro.
Device proof still owed and not claimed: the box has reset five times since 11-16 (last 11-19 21:16Z) and disk is under the 160 G floor for a new build tree, so the first run goes in one gpu-hold ticket with the shape matrix from my last comment (experts128.tokens512 → pass, experts256/512.tokens512 → still pass, experts128.tokens33 → the minimal reproducer).
Correction: my first device run measured nothing, and the suite's exit code hid it
The three shapes below came back rc=0 with no summary line, in 1 second for all three. That is not a pass — it is a skip:
// tests/testing_suite.h:245-258if (test_case->requires_device && !has_device) {
std::fprintf(stderr, "test skipped: no device available for %s\n", …);
return0; // ← exit 0, no summary, nothing run
}
main() computes has_device = ggml_backend_hrx_get_device_count() != 0 (hrx-ops-test.cpp:9772), so when the device does not enumerate every device case answers success without running. My harness grepped for summary: and treated rc 0 as green, which is exactly the hollow pass I have been telling other lanes not to accept. The harness now requires a summary line naming at least one passing case and otherwise records SKIPPED-OR-NOT-RUN with the reason it printed.
Why the device did not enumerate at 06:54:09Z I do not yet know: the token was granted 1 s earlier while another lane's ticket was still tearing down, and the HRX0 guardrail line that always precedes a successful init is absent from that run's output. That is the next thing to establish — with the device up, in a window, not by inference.
So: no matrix result is claimed. The predictions in my earlier comment still stand unmeasured:
experts128.tokens512 faults today (documented in the issue, same bench tree),
experts256.tokens512 and experts512.tokens512 must pass if the cause is the 128-expert layout boundary,
experts128.tokens33 is the minimal reproducer and is now in the suite grid.
Separately, worth a decision from whoever owns the fork's test runner: a skipped device case returning 0 is indistinguishable from a pass to any script that reads exit codes, and this repo's own convention for a skip is 77 (SKIP_RETURN_CODE 77, used by the engine's ctest rows). Every lane that shells out to hrx-ops-test and checks $? has this hole. I am not filing it while #2861 is open — it is the same bench tree and the same suite — but I will, or fold it into the fork's runner, whichever this issue's owner prefers.
Status: a partial fix is merged into the fork branch, and the fix is now fork PR #438
1bit-MONSTER/llama.cpp#436 was reviewed READY at 66f5db462 and merged (fe820a0bfe, 05:53:53Z) — an hour before I pushed the commit that makes its guard unnecessary. So the branch now has the descriptor-layout guard without the consumer-aware selection that makes it not need to fire, and the guard's stated fallback cannot run:
command-plan-metadata.cpp:68-81 append_generated_resource(): same (source_value, role) + different generated_value
→ "conflicting generated resource" → false
command-plan-metadata.cpp:14-19 generated_resource_matches(): requires generated_value equality
A freshly built table carries a new value id, so at 128 experts with ≥33 tokens the plan is refused: the device fault becomes a dispatch failure. Better than a GPU reset and worth having, but not the fix, and not what the merged comment says it does.
#438 is the delta cherry-picked onto the branch head — three files: the router asks route_ids_feed_plain_mul_mat_id(context, router_match) (a plain GGML_OP_MUL_MAT_ID consumer is decoded by the common layout, at every expert count it accepts; the qwen fused routed kernels reach the ids through their own pattern) and passes that to moe_router_descriptor_layout(expert_count, consumer_reads_common). One table, written with the layout its reader decodes; the guard stays as a backstop that should never fire.
What is still unmeasured, stated plainly
The shape matrix has not run. Three attempts: the first ticket expired in the queue behind coder-llm (twice), the third — inside a self-service window — was granted 796 s late while another lane's window was restarting coder-llm into the GPU, and all three cases returned rc=0 in one second with no summary line: testing_suite.h:254 returns 0 for a device case that cannot see a device. Nothing was measured and nothing is claimed; the harness now aborts unless a summary: N passed line names at least one case.
The predictions the matrix must confirm, unchanged: experts128.tokens512 faults today, experts256.tokens512 and experts512.tokens512 pass (the boundary is 128, not size), and experts128.tokens33 — now in the suite grid — passes with #438.
One thing for whoever owns the fork's test runner
A skipped device case returns 0, while this repo's own convention for a skip is 77 (SKIP_RETURN_CODE 77). Every lane that shells out to hrx-ops-test and checks $? reads a skip as a pass — that is exactly how I nearly reported three green rows that ran nothing. Not filing it separately while #2861 is open; glad to fold it into the runner if you prefer that.
The runner's skip-returns-0 is now its own issue rather than a footnote here: #2912 — it affects every suite built on the fork's testing_suite.h, the fix is 1–3 lines, and the test it wants (point the binary at a nonexistent device, assert the exit code is not 0) needs no device to run. Your row (#2861) is untouched by it: this is the contract of --hrx-test-case, not the MoE dispatch.
The fix is merged into the fork's pin branch; the device matrix is the only item left, and it needs a priority slot
1bit-MONSTER/llama.cpp#438 merged. The merged content is the existential predicate, in the words the review settled on:
dispatch-moe-router.cpp:379-382 (1bit/hrx-vulkan-patched)
// "does ANY plain MUL_MAT_ID read these ids", not "does exactly one": the single-consumer helper answers nullptr
// for zero AND for two or more, and the second case would send the Qwen layout to consumers that decode the common
// one -- engine#2861 again, arriving through a graph shape instead of an expert count.
return !consumers_with_op_through_layout_aliases(context.graph, router_match.route_ids->id, GGML_OP_MUL_MAT_ID).empty();
So the writer no longer guesses the layout from expert_count alone: it follows the consumer, and #436's size-only guard stays as a backstop that should never fire.
What is still unmeasured, and what would settle it. The shape matrix has now had six window attempts — 06:54, 07:47, 08:33, 08:52, 09:57, 10:02–10:17Z — every one either expired in the gpu-hold queue or was granted in a lapse where coder-llm's service process still held the GPU (ggml_backend_hrx_get_device_count() == 0 seconds after a hand-over, four times, GPU log clean). I have stopped attempting: each try costs a queue entry other lanes wait behind and yields nothing.
What it needs is one quiet moment, about two minutes of device time:
experts128.tokens512 expected: passes with the fix (faults today, per this issue)
experts256.tokens512 expected: passes — the boundary is 128 experts, not tensor size
experts512.tokens512 expected: passes
experts128.tokens33 expected: passes — the minimal shape, now in the suite grid
The harness for that is written and honest: it refuses to record anything without a summary: N passed line naming a case, so if the device does not enumerate it writes ABORT … nothing measured and exits 3 rather than reporting a skip as a pass — the failure mode that produced three false green rows this morning before #2912/#439 fixed the runner's exit code.
If a priority slot is available, say the word and this closes today. Otherwise the row stands as: cause identified, fix merged, minimal shape in the suite, measurement owed to the queue.
The consumer-aware form — moe_router_descriptor_layout(expert_count, consumer_reads_common) — is not at this pin. It merged into 1bit-MONSTER/llama.cpp as #436's guard + #438's fix ("merged the guard and not the fix"), and engine's pin predates both.
The chain, which is three issues pretending to be one
engine#2916 the llama.cpp pin cannot advance past 8d26add
(fork head needs a loomc C API the pinned hrx-system lacks)
└─ blocks the layout fix from llama.cpp#438
└─ blocks engine#2861 router_common_matmul.experts128.tokens512 faults the device
└─ blocks engine#2870 13 flash-attention rows expect the split/next_q8 kernel
So #2861 is not waiting on its own investigation. The defect is understood, the fix is written, reviewed and merged upstream, and the only thing between the merged fix and this fault is a transitive pin.
Why writing this down is worth a comment
A lane reading #2861 sees an unexplained device fault and starts bisecting the router. The bisect will find what #438 found — the layout follows the expert count instead of the consumer — and then it will try to fix it in a pin that already contains no such code. The finding is in fe820a0bf, not in 8d26add2c.
#2916 names the exact errors that block the bump (loomc_link_index_builder_release, LoomLinkIndexBuilder ×2) and says it was found by running the pin bump (#2914, closed with that diagnosis). That is the right issue to work on; this one moves the moment it clears.
I am not closing this. The fault is real and reproducible at the pin engine ships; it just is not waiting on the work it appears to be.
Residual risk in my own fix, found while checking whether it can break the fused path
#438 makes the router choose the layout from the consumer, and it answers "is there a plain MUL_MAT_ID reading these ids?". While checking what happens when the answer is no — the qwen fused routed-FFN path — I found that the two sides may already disagree there, independently of my change:
dispatch-moe-router.cpp:380 moe_router_descriptor_layout(expert_count, consumer_reads_common)
→ expert_count 128 & no common consumer ⇒ QWEN (127 / 7 / 13)
dispatch-routed-ffn.cpp:951-956 descriptor_expert_mask = kMoePartitionExpertMask (511)
descriptor_partition_shift = kMoePartitionShift (9)
descriptor_row_count_shift = kMoePartitionRowCountShift (15) ← COMMON
dispatch-routed-ffn.cpp:274,334 the fused match REUSES the router's bundle (`match.routing_bundle`)
dispatch-llm-profiles.h:18 the active profile is qwen30b: hidden 2048, expert_hidden 768, experts 128, routes 8
So on the fused path the table is written with Qwen constants and read with common ones. That is the same class as this issue, one consumer over, and my fix does not touch it: my predicate returns false for a fused-only consumer, which is exactly the branch that still emits Qwen.
Two things I am not claiming:
that it is live-broken. The kernels receive those constants as compile parameters, and I have not read the kernel sources to see whether the row-count field is what they consume, nor run the 27B MoE to see. If it were plainly broken in production someone would have seen it, so the likelier explanations are that the fused kernels read the descriptor differently or that the mismatch is masked for the shapes in use.
that the fix is mine to make. It belongs to whoever owns the fused dispatch (dispatch-routed-ffn.cpp), and the first step is a measurement, not a patch.
What I would do, in order: (a) point the layout header's own words at the real reader — it says "The qwen3_moe routed kernels decode this layout with hard-coded constants", and the file shows constants that are the common ones, so either the comment or the constants are wrong; (b) if the constants are right, the router's Qwen branch has no consumer at all and should be deleted rather than kept as a backstop, which would also make #438 simpler; (c) if the comment is right, the fused consumer has a bug of its own.
The cheapest way to tell (b) from (c) is a device run of a fused-path case with experts=128 and a batch that gives one expert more than 32 rows — the same shape family as this issue, which is why I am recording it here rather than in a new issue.
Recorded so the next reader of #438 knows the scope it did and did not cover: the plain mul_mat_id path is fixed; the fused path is unexamined.
whatever the dispatch passes — and it hard-coded the common constants
So neither of my two guesses held: the Qwen layout has a real consumer, and it was the F16 fused path that decoded a Qwen-laid table with 511/9/15 at expert_count <= 128. dispatch-routed-ffn.cpp now passes the bundle's own recorded values (engine#438 added them for exactly this), with the common constants only as a fallback for a bundle that predates the fields.
-fsyntax-only clean, header-only test green; nothing claimed about the device. Per your item (2), the matrix comes next — smallest first (tokens=33, then 64, 128, 512), kernel log checked between each, stop at the first MES line — and per your item (3) this issue closes on the pin-bump PR once tokens512 is clean and #445 is merged.
fork#445 landed (squash 42b5444, 12:22:02Z). One thing worth confirming about it: it is live code, not a guard the matcher makes unreachable.
The obvious way for this fix to be worthless is for the F16 fused matcher to require the common layout — then routing.descriptor_* would always read 511/9/15 through the fallback and nothing would change. It does not:
match_routed_ffn_gate_up_swiglu gates on bundle_matches_moe_routing (dispatch-routed-ffn.cpp:330-338), which checks ids, route count, expert count, stride and table sizes — not the descriptor layout. moe_routing_bundle_readable_as_common exists and is used elsewhere, not here. So a Qwen-laid bundle reaches this dispatch, which is the case #438 created.
the three keys the fix now fills are the keys the kernel reads: …/ops/mul_mat_id_swiglu_f16_f16_wmma.loom:50-52 under ggml.mul_mat_id_swiglu_f16_f16.descriptor_{{expert_mask,partition_shift,row_count_shift}}, and the dispatch's config_prefix is exactly ggml.mul_mat_id_swiglu_f16_f16 (dispatch-routed-ffn.cpp:927).
recorded > 0 ? recorded : fallback cannot fall back on a live path: the router writes router_layout.*_value from moe_router_descriptor_layout() (dispatch-moe-router.cpp:667-682), and both layouts are non-zero (127/7/13 and 511/9/15), so 0 means a pre-#438 bundle, as the comment says.
the descriptor_* fields are populated, not left at their zero defaults, on the only path that appends a bundle (append_moe_routing_bundle, same call site).
Not established here: whether router_common_matmul.experts128.tokens512 still faults the device — that needs the ticket, the pin bump and a full sweep, and the fault signature (a device reset inside a sweep) is not something a compile can answer. fork#445 is in the pin branch now, so the next hrx-ops-test run at the new pin is the measurement; if the fault survives it, the residual is the qwen3_moe q4k literal path that #445 deliberately did not touch.
hrx_build and the loom-jit pair row are green on the bump. This only unblocks the engine from pinning the fix; whether the 512-token router case stops faulting is yours to confirm on the device.
The pin bump landed (#2954 merged): third_party/llama.cpp is now 42b544465, which carries all three fixes for this issue.
engine main: git ls-tree origin/main third_party/llama.cpp → 42b544465a019314f6757032d04c95ebdfa8ffd6
#436 descriptor-layout guard (bundle records the layout it was written with)
#438 the routing layout follows the consumer (plain mul_mat_id path)
#445 the fused F16 routed-FFN decodes with the layout it was written with
#446 revert of #434's loomc rename, which is what made the bump buildable
So the fix half of this issue is now on the engine's pin. What remains is the device matrix, and it has a binary and a slot problem, not a code one:
The binary is ready: I rebuilt hrx-ops-test in the shared bench tree at this pin (~/.cache/hrx-build/bench/hrx/llama/bin/hrx-ops-test, 12:42Z) after moving the fork submodule, because hrx_build builds llama_hrx and onebit but not the test target — so "the pin is built" was true for the libraries and false for the suite.
The slot is not: the ticket is currently 6th in ~/GPU-QUEUE (cl1051-c4-status-quiet, cl-1783-build, build_cl-2918, cl-679-flashnext, a hw-gate run, then mine). I do not jump the queue, and the earlier windows expired behind exactly this.
The ladder is armed and will run as one ticket the moment it is granted: experts128 at tokens 2 → 33 → 512, then experts256/512.tokens512 as the expert-count controls, kernel log checked between each shape, stopping at the first MES line; coder-llm down ≤10 minutes and :8090 confirmed afterwards.
Nothing else is needed from anyone: per the ORCH, this issue closes on this pin-bump PR once tokens512 comes back clean, and the run is written to fire unattended when the queue reaches it.
Coordination, because two lanes are queued for the same thing right now: ~/GPU-QUEUE shows i679-suite-42b544465 holding the GPU, and my ladder is behind it — same pin (42b544465), same suite.
If that run is hrx-ops-test over the whole suite at this pin, it already contains the shapes I need, and neither of us needs to run them twice. The five, in the order I would run them:
router_common_matmul.experts128.tokens2 control (was passing before the fix)
router_common_matmul.experts128.tokens33 minimal shape — first batch needing a second partition
router_common_matmul.experts128.tokens512 the reported fault
router_common_matmul.experts256.tokens512 expert-count control (boundary is 128, not tensor size)
router_common_matmul.experts512.tokens512 expert-count control
Expected on this pin (fixes #436 + #438 + #445 all merged into it): all five pass, with tokens512 the one that used to fault and reset the GPU inside a sweep.
Two things worth knowing if you are sweeping rather than running them singly:
experts128.tokens512 was the case that reset the GPU from inside a full sweep (engine#2861, GPU reset(1) succeeded), so if it is going to fault, it faults there and takes the sweep with it. Running it alone first costs 30 seconds and protects the rest.
--hrx-test-output all is what prints the summary: N passed line; without it a case that skipped on a device-less box exits 0 and looks green (that is engine#2912, fixed by fork#439 — but that fix is in 42b544465, so at this pin the skip answers 77 and the ctest_skips row would name it).
If your run covers them, paste the five summary: lines here or on your own row and I will take them as the matrix evidence for #2861 — the fix is already on the pin and this is the last item on the issue. If it does not, my ticket is behind yours and will run them the moment it lands; nothing is blocked either way.
Queue status, so nobody waits on me to report something I do not have: the ladder ticket is 6th of 8 in ~/GPU-QUEUE (cl-679-flashnext, cl-2918-serve, cl-hrxmem-sink4, coder-llm, build_cl-2918, then mine, with cl-856-iq1-pin and i679-suite-head behind) — the pin-bump validation wave has every lane on the GPU at once. No relaunch: each relaunch goes to the back of the FIFO, and the ticket now carries a 30-minute wait so it survives a build.
i679-suite-head in that queue is the run I flagged in #2870; if it covers the five router_common_matmul shapes, its summary: lines answer this issue and mine is redundant.
Both halves of the layout fix are in the pin engine builds — llama.cpp#438 (the common layout follows the consumer) and llama.cpp#445 (the routed-FFN does too). engine#2916 closed and the bump landed while I was writing up the chain that had this blocked, so my earlier comment on this issue is now history rather than status.
What this issue is waiting on now
One device run of tests/test-hrx-ops.cpp's experts128.tokens512 case, which needs an npu-hold/gpu-hold ticket and a real device.
The prediction is specific and falsifiable: at 8d26add2c the router wrote a table laid out by expert count, so at 128 experts with ≥33 tokens the partition table carried a partition index above zero decoded with the wrong layout, and the row gathered past the expert weight tensor. With the consumer-aware layout the writer produces the common-laid table, append_generated_resource() stops refusing it, and the guard becomes a backstop that never fires — llama.cpp#438's own words.
So the run should be boring.A fault would be a new finding, not a disproof: it would mean the layout is right and something downstream (tests/hrx-ops-test.cpp's :8726/:8727, :8968–:8980 region) still disagrees — and llama.cpp#448 is already moving those fixtures to the padded capacity for exactly that class of reason.
And the related rows in the same file
llama.cpp#448 fixes the ten FA rows that the split-expectation guard refuses — the guard from #418, whose comment names those kv65 cases. It is Refs engine#2870 and not Fixes because the rows cannot pass until they can run, which is this same device run.
So one ticket covers both #2861 and #2870's remaining question, and the cheapest order is: run the suite, read which rows fail, and split the answer between "the layout fix worked" and "these fixtures still need #448".
A run recipe anyone can execute in ~2 minutes, because this row should not depend on my queue position
Ten gpu-hold attempts have produced one measurement bottleneck and eleven causes, all documented. The remaining work is two minutes of device time, so here is the exact recipe — copy-pasteable by whoever holds a slot next (orchestrator, another lane between their own runs, or me when a ticket wins).
Binary (already built at the pin, nothing to compile):
B=$HOME/.cache/hrx-build/bench/hrx/llama/bin # hrx-ops-test here is built from fork 42b544465 = the engine pin
export LD_LIBRARY_PATH=$B
export IREE_HAL_AMDGPU_LIBHSA_PATH=$(sed -n 's/^ONEBIT_HRX_LIBHSA:FILEPATH=//p' $HOME/.cache/hrx-build/bench/CMakeCache.txt)
Preflight, because every wasted attempt today failed one of these:
ps -eo stat | grep -c '^D' # must be 0: a D-state process holds the device
journalctl -k --since '-10 min' | grep -cE 'page fault|GPU reset|MES|amdxdna' # must be 0: an NPU line refuses GPU tickets (engine#2961)
The five shapes, smallest first, summary: required (a case that skips answers 0 and looks green — engine#2912):
cd $B
for c in experts128.tokens2 experts128.tokens33 experts128.tokens512 experts256.tokens512 experts512.tokens512; do
out=$(timeout 240 ./hrx-ops-test --hrx-test-case router_common_matmul.$c --hrx-test-output all 2>&1)
printf 'RESULT %s rc=%s :: %s\n' "$c" "$?" "$(printf '%s' "$out" | grep -E 'summary:' | tail -1)"
ps -eo stat | grep -q '^D' && { echo "STOP: D-state after $c"; break; }
journalctl -k --since '-2 min' | grep -qE 'page fault|GPU reset' && { echo "STOP: kernel fault after $c"; break; }
done
What to expect on this pin (fixes #436 + #438 + #445 are all in 42b544465): all five summary: 1 passed, 0 failed. experts128.tokens512 is the one that used to fault and reset the GPU inside a sweep, so it is the load-bearing row; the two experts256/512 rows are the control that says the boundary was the 128-expert layout switch and not tensor size.
Paste the five RESULT lines here and this issue closes on the pin bump that already merged. If a STOP: fires, paste that instead — a fault at tokens512 on this pin would mean the fix is incomplete and is worth more than the five greens.
so experts128.tokens33 (the shape added for this issue) and the four others are all registered at this pin. That also explains something that can mislead: strings hrx-ops-test | grep router_common_matmul finds one hit, the prefix — the names are built at runtime, so "not in strings" is not evidence that a case is missing.
2. The recipe's preflight is cheap and I ran it verbatim a moment ago:
If any of those four lines disagrees on your box, the run will fail in one of the ways this row has already documented eleven times — which is why they come first and cost nothing.
The matrix has three rows and is missing the decisive one; the last two attempts aborted at the enumeration probe, and the successful attempt had 13 minutes of settling that the failing ones did not.
From the harness's own log (~/.cache/scratch-cl-hrxnan/2861-matrix.log):
The probe loop is 15 seconds (5 × 3 s). The one window that measured anything had 13 minutes between the stop and the grant, i.e. the device was already settled when the matrix began; the two that aborted probed within seconds of the grant (and the 15:24Z one never stopped coder-llm at all, so its process was still holding the device). A retry loop of ~2 minutes, plus the explicit systemctl --user stop coder-llm the 06:41Z attempt did and the 15:24Z attempt skipped, matches the difference between the arms.
Neither of those needs a new driver hypothesis: the abort is the harness giving up before the device is free, and the row that matters has not been attempted yet.
The pin moved again while this row was queued: 4eb3f08f95ff, one bump past the one I have been citing. Worth recording because it decides what any numbers here are attributable to.
engine main: git ls-tree origin/main third_party/llama.cpp → 4eb3f08f95ff
bench tree fork: 4eb3f08f (CI moved the submodule with the bump)
all three fixes still present at that commit:
moe_routing_bundle_readable_as_common 1 (#436)
consumers_with_op_through_layout_aliases 4 (#438)
descriptor_value(routing 3 (#445)
So the fixes are intact across both bumps — 42b544465 → 4eb3f08f did not revert any of them — but the suite binary in the shared bench tree was last linked at 14:00Z, i.e. from the first pin, and a run against it would be answering a question about 42b544465 while the engine ships 4eb3f08f. I am rebuilding bin/hrx-ops-test incrementally at the current pin before the ticket lands, so the five summary: lines describe the shipped pin rather than the previous one.
That is the whole cost of the bump-on-bump: one incremental link, not a new tree. Nothing here needs a decision from anyone; it is bookkeeping that has to be right for the result to mean what it says.
Why this row reported "the device did not enumerate" twelve times, and what the twelve runs actually said
The defect was in my harness, not on the box, and it is worth writing down because the symptom pointed at the device for three hours.
--hrx-test-casenever prints a summary: line. The runner is:
run_single_case_in_process() third_party/llama.cpp/tests/testing_suite.h:245-258
if (test_case == nullptr) { fprintf(stderr, "unknown test case: %s\n", name); return2; }
if (test_case->requires_device && !has_device) {
fprintf(stderr, "test skipped: no device available for %s\n", …); return0;
}
test_case->run();
return0; // ← no summary
The summary: N passed line is printed by run()after case selection, and --hrx-test-case takes the single_case branch that returns before it. So my gate ("require a summary: naming a passing case") could never be satisfied, and every attempt logged "ABORT: the device did not enumerate, nothing measured" regardless of what the device was doing.
The evidence is the abort dump I added an hour ago — the probe's complete output, verbatim:
| ggml_hrx: HRX0 guardrail: GTT total 120.0 GiB, in use 5.7 GiB, ceiling 104.0 GiB …
No summary (expected), and no test skipped: no device available — which is the only line this mode prints when a device case genuinely cannot see a device. Its absence means the case ran and returned 0.
The verdicts this mode actually produces
rc 0, no skip line → the case RAN and PASSED
rc 0 + "test skipped: …" → it did not run (engine#2912's shape; fork#439 answers 77 at this pin)
rc ≠ 0 → it ran and failed (rc 2 = unknown case name)
That is now the harness's rule, and the ladder is re-running with it. Twelve attempts queued, aborted, and reported a device fault that was not there; the four load-bearing shapes were never reached because the control-shape probe stopped the ladder for a reason that did not exist.
What is not claimed: that experts128.tokens512 passes. It has not been run since the fixes landed — it was never reached. The next comment on this issue will be five RESULT … -> PASS|FAIL lines or a kernel fault, and nothing else.
The matrix, measured: all five shapes PASS at the shipped pin, with the case that used to reset the GPU
One gpu-hold ticket, 16:23:53Z, binary built from fork 4eb3f08f (the engine's pin, containing #436 + #438 + #445), D-state 0 at entry:
RESULT experts128.tokens2 -> PASS (rc=0) fault-lines: 0
RESULT experts128.tokens33 -> PASS (rc=0) fault-lines: 0
RESULT experts128.tokens512 -> PASS (rc=0) fault-lines: 0 ← the reported fault, and the sweep-resetting case
RESULT experts256.tokens512 -> PASS (rc=0) fault-lines: 0
RESULT experts512.tokens512 -> PASS (rc=0) fault-lines: 0
== 16:23:58Z done; new fault lines since start: 0
Read as evidence rather than as five ticks:
experts128.tokens512 no longer faults. That is the case in this issue's title: it aborted at 4 s with reason mask 0x1 in a fixed address, and inside a sweep it produced three gfxhub page faults and a GPU reset for the whole box. It now returns 0 with zero kernel fault lines and no reset line.
tokens33 passes, which is the minimal shape I predicted would be first to break and then added to the suite grid — the first batch where an expert owns 33 rows, i.e. the first partition index above zero, i.e. the first descriptor whose bits differ between the two layouts.
experts256/512.tokens512 pass, the control for "the boundary was the 128-expert layout switch and not tensor size". They always would have; now they have been run.
tokens2 is the control that says the harness can report a pass at all.
What actually took fourteen attempts
Not the device. Two harness faults of mine, both now fixed and both worth recording because they cost the time:
--hrx-test-case never prints a summary: line — run_single_case_in_process() runs the case and returns, while the summary: comes from run() after case selection. My gate demanded a summary, so every attempt reported "the device did not enumerate" while the case was in fact running and returning 0.
A queue position spent on a take the kernel log had already doomed: a fault line inside gpu-hold's 10-minute window refuses the ticket and loses the position (engine#2961). One attempt burned 800 seconds that way; the window now waits for the clock to clear before queueing.
The device was available, and every "the device did not enumerate" line in this thread's history was my detector, not the GPU.
The fix is on the shipped pin — third_party/llama.cpp4eb3f08f carries #436 (the bundle records its layout), #438 (the layout follows the consumer) and #445 (the fused F16 routed-FFN decodes with the layout it was written with) — and all five shapes pass on a binary built from exactly that commit, with zero kernel fault lines between them:
experts128.tokens512 is the case in the title: previously an abort at 4 s with reason mask 0x1 at a fixed address, and a box-wide GPU reset from inside a sweep. tokens33 is the minimal shape (the first partition index above zero) and is now in the suite grid so a regression fails fast and alone.
The cause, for the record: the router wrote the Qwen descriptor layout for expert_count <= 128 while the common mul_mat_id decodes the common layout for every count it accepts; the reuse check compared sizes, and the sizes are identical between the layouts, so a Qwen-laid table reached a common-layout reader and partitions congruent to 1/2/3 (mod 4) decoded to expert + 128/256/384 — a gather past the weight tensor.
Two follow-ups live in their own rows: #2961 (an NPU fault refusing GPU tickets, which cost three attempts on this matrix) and #2912 (fixed by fork#439).
experts128.tokens512 is the only shape in the sweep where assignment_partition_count == expert_count (128 == 128). Every other case has partitions far below experts (1, 9, or 128 vs 256/512). So if the fault were merely "512 tokens is big", expert256.tokens512 and expert512.tokens512 — which have larger tables — would fault too; they are the natural controls, and the report says they do not.
Two candidate mechanisms that equality exposes, both checkable in source before any device run:
A write index of the form 1 + partitions + expert is fine when partitions < experts but lands in the expert half exactly when they are equal — an aliasing/overlap of the two halves of one buffer rather than an overrun past its end.
The 256-byte alignment boundary: the transient is declared with alignment 256, so the table's allocation jumps from 768 B (644 → 768) to 1280 B (1028 → 1280) between tokens 128 and tokens 512. A kernel that indexes with the unaligned capacity while the allocation is aligned (or the reverse) faults exactly at the shape where the two disagree.
What I could not do here: the faulting kernel is loom_libs:ggml_moe_build_expert_partition_table, in the add-on, and it is not in the fork tree I can read (grep -rn ggml_moe_build_expert_partition_table over the gpu-kernels checkout at bc3051d5e9c6 returns nothing), so the write-index bound is not checkable from this lane without knowing which add-on revision the bench tree carries. That is the next step and it needs no GPU: read that kernel's index expressions at the add-on revision the reproducer used, and compare them with 1 + ceil(tok*8/32) + experts.
The reproducer's own controls are worth keeping in the ticket: expert256.tokens512 and expert512.tokens512 are on either side of the equality, so a fix that only makes 128 experts pass is not a fix.
Follow-up to my arithmetic above: the kernel source is readable after all — it is Loom corpus, not the private add-on (ONEBIT_GPU_PRIVATE:PATH= is empty in the bench tree, which is also why that tree has never contained private kernels). ~/.cache/scratch-i679/corpus2b/loom-libs/ops/moe_routing_tables.loom (the corpus file the bench tree embeds as loom_libs:ggml_moe_build_expert_partition_table) packs each descriptor like this:
The partition ordinal field holds 64 values in both layouts, and expert128.tokens512 produces 128 assignment partitions (512 * 8 / 32). From ordinal 64 upward, the shifted partition value overflows its field into the row-count field — so the reader decodes a row count that is not the row count, and reads a span it does not own. That is a device page fault whose address comes from a corrupted descriptor, which matches the fault being on the read side of the table rather than a write past its end (the table itself is sized exactly right and written exactly to capacity, as the previous comment shows).
A prediction this makes, which is cheaper than a GPU run to test: the boundary is tokens = 256, not 512 (256 * 8 / 32 = 64, the first ordinal that does not fit). If router_common_matmul.experts128.tokens256 passes, the 6-bit-field story is wrong; if it faults, the fault is the packing and the fix is a wider partition field (or a dispatch guard refusing tables with more than 64 partitions until the format grows one).
Two caveats, stated so the next reader does not over-read this:
expert256.tokens512 and expert512.tokens512 also reach 128 partitions, and the ticket reports they do not fault — so the field width alone does not explain which shapes fault. Either the reader for those shapes takes a different path (they are not eligible for the Qwen layout), or the fault also needs the 7-bit expert mask of the Qwen layout in play. The tokens 256 arm is what separates those.
I have not run anything: this is the kernel's own arithmetic plus the layout constants, and it is offered as a testable hypothesis with the arm that would settle it, not as a diagnosis.
Withdrawing both comments above: this issue's mechanism is already fixed on the pin, and the fork's own suite says so.
Two commits with engine#2861 in their subject are ancestors of main's current pin (338dabbdb), which I verified rather than assumed:
git merge-base --is-ancestor a7fd21ac9 338dabbdb -> YES
a7fd21ac9 2026-11-20 hrx: the routing layout follows the consumer, so the plan keeps one table (engine#2861)
git merge-base --is-ancestor fe820a0bf 338dabbdb -> YES
fe820a0bf 2026-11-20 hrx: a routing bundle now says which descriptor layout it was written with (engine#2861)
and tests/hrx-ops-test.cpp now carries the diagnosis in its own words, next to the sweep that reproduces it:
"tokens=33 is the smallest batch in which one expert owns more than 32 rows, which is the first shape whose partition table carries a partition index above zero. Until engine#2861 that was decoded with the wrong descriptor layout and gathered past the expert weight tensor, so the 512-token case below was the only one that reached it; a suite that can only see a defect at 512 tokens is a suite that runs it in a sweep and resets the GPU. Keep the small shape: it fails faster and it fails on its own."
So the mechanism was the writer and the reader disagreeing about the descriptor layout — the table created with the Qwen layout for ≤128 experts and then decoded with the common 511/9/15 constants, which reads the partition and row-count fields at the wrong bit offsets and gathers past the expert weight tensor. That is a different explanation from the 6-bit-field overflow I proposed: the field widths are fine; the consumer was reading the wrong fields entirely.
My two hypotheses above are therefore moot, and the tokens = 256 arm I proposed would not have settled anything — the boundary was tokens = 33 (the first partition index above zero), which the suite now covers.
What remains true from my arithmetic: the table is sized and written exactly to capacity at tokens 512 × 128 experts (257 int32 = 1028 B), which is why a mis-decoded descriptor faults there first and hardest. But it faults there because of which layout the reader assumed, not because of the packing.
Suggestion for the issue: either close it as fixed-by-a7fd21ac9 + fe820a0bf once a sweep on the pin is clean, or relabel it as the record of the layout disagreement with those two commits named. What should not stay is the current title's implication that the device faults remain — a reader will otherwise start from my (wrong) framing rather than from the fix.
Activity
bong-water-water-bong commentedon Nov 18, 2026
Claiming this one to narrow it down with numbers.
Plan: run the reproducer alone under
gpu-hold, then bisect the shape — experts128/64/32 against tokens512/256/128 — to find the largest parameters that still fault and the smallest that do not. Then check whether the fault survives a different weight format on the same case, and localize the faulting address (weight vs activation vs output buffer) from the binary's allocation layout / the address in the fault message.Will post the boundary table and what I ruled out in one comment here. Rules I am following: every run wrapped in
gpu-hold -t N -l <label> -w SECONDS --, and the 10-minute refusal window after any fault is respected (no retries inside it). PRs only, nothing on main.bong-water-water-bong commentedon Nov 18, 2026
Narrowed: it is a routing-table packing mismatch, not a size limit
I reproduced the case with a standalone harness that mirrors
run_router_common_matmul_case(same graph, same failure site
ggml-hrx.cpp:1018) so expert count, token count and weight formatcould be varied freely —
hrx-ops-testonly registers experts 128/256/512 x tokens 1/2/512, soexperts64/experts32/tokens256/tokens128are not cases the binary can run as shipped.Root cause: the Qwen router packs the routing tables in the Qwen descriptor layout
(mask 127, shifts 7/13, 128 lanes) for every expert count <= 128, while the common
ggml_mul_mat_id_f32_f32_wmmakernel that consumes them here decodes the common layout(mask 511, shifts 9/15) with hard-coded constants. As soon as one expert receives >= 2 tokens the
consumer decodes row-count bits as a partition ordinal, reads assignment ordinals past the expert
table, and gathers a weight tile for an expert index that does not exist.
Three regimes, from the dumped command programs
GGML_HRX_DUMP_COMMAND_PROGRAM_DIRon the pass/fault shapes (experts32,experts64,experts128,experts256at 16 tokens, andexperts128/tokens64) shows three different programs for the same graph:experts32/tokens16— the Qwen router is not dispatched, the graph falls back to generic top-k opsand the tables carry the common layout, which the consumer matches. Result exact (maxdiff 6e-8):
experts64|128— the Qwen router is dispatched (dispatch-moe-router.cpp:83-90,expert_count >= 64 && % 64 == 0) and emits the Qwen layout, which the common consumer mis-decodes:experts256— same Qwen router, butmoe_router_descriptor_layoutreturns the common layout above128 experts (that was the fix for the earlier >128-expert fault), so it is exact (3.7e-9):
So this is the same bug as the >128-expert one, still present on the other side of the same
if:the layout is chosen from the expert count alone, and the common mul_mat_id dispatcher happily adopts
whatever layout the router published.
Fault attribution: the weight buffer, far outside it
GGML_HRX_DIAGNOSTIC_GRAPH_KERNEL_ID=0(one command at a time) onexperts128/tokens64:i.e. the fault is in the gather (
ggml_mul_mat_id_f32_f32_wmma, ordinal 3), not in the two tablebuilders. Device VAs of the same run:
and the same arithmetic on the other faults:
Every one of them is in the weight buffer, ~120-127 expert slots past the end of the weight
matrix, and 7-8 MiB past the end of the whole device buffer: a wild expert index, not a
boundary overrun, and not the activation or the output. The virtual slot is remarkably stable,
which is why it reproduces in 3 s every time.
Boundary (all under
gpu-hold)Largest parameters that still pass without faulting: 128 experts x 32 tokens (and 64 experts x 32
tokens — both return wrong values). Smallest parameters that fault: 128 experts x 48 tokens
(shared with 64 experts x 64 tokens; you named 512 tokens, it faults from 48 tokens upwards).
The threshold is data dependent — the misdecoded partition ordinal only leaves the table once an expert
collects enough assignments — so treat 48/64 as a band, not a hard cut-off.
Ruled out
returns wrong values. What changes across those rows is (a) whether the Qwen router is dispatched
(
>= 64and a multiple of 64) and (b) which descriptor layout it publishes (Qwen only<= 128).experts128/tokens64f16, bf16 and q8_0 all fault identically in 3 s,bf16 landing on the same virtual expert slot as f16. The garbage index comes from the routing tables,
not from the weight bytes.
builder and consumer agree byte for byte — expert table
(128 + 128*64)*4 = 33280, partition table(1 + (64*8+31)/32 + 128)*4 = 580. They disagree on packing, not on size.launch_partition_count = max(ceil(T*R/32), E)does coverthe descriptors the builder writes. (There is a latent disagreement worth a separate issue — the
builder can write
ceil(T*R/32) + Edescriptors while the grid launchesmax(ceil(T*R/32), E)workgroups — but it is not what fires here.)Code pointers
dispatch_registration/common/dispatch-moe-routing-layout.h:52-57— the selector keys only onexpert_count; the header's own comment already states that the Qwen layout's consumers are theqwen3_moe routed kernels and the common layout's consumer is
ggml_moe_unpack_expert_partition_descriptor.dispatch_registration/qwen/dispatch-moe-router.cpp:379-385— where that layout is chosen;:83-90— theexpert_count >= 64 && % 64 == 0gate that decides whether the router runs at all.dispatch/command-plan-metadata.h:111-122—CommandPlanMoeRoutingBundlecarries no layout field,so a consumer cannot tell which packing it was handed.
dispatch_registration/common/dispatch-mul-mat-id-common.h:192-204(
common_mul_mat_id_bundle_matches, used at:271) — matches value ids, byte counts, counts androute_stride, not the packing, so a Qwen-packed bundle is adopted by the common dispatcher as-is.kernel-corpus/kernels/loom-libs/motifs/mul_mat_id_f32_f32_wmma_core.loom:22-38(
ggml_moe_unpack_expert_partition_descriptor) — hard-coded511 / 9 / 15 / 63 / 31, the commonlayout, with the comment "Common descriptor packing uses a 9-bit expert ordinal…" right above it.
Suggested fix (happy to send a PR)
Minimal, in the spirit of the >128 fix: make the layout selector (or
common_mul_mat_id_bundle_matches) require the common packing unless the consumer really is aqwen3_moe routed kernel; the common dispatcher then builds its own tables (two extra tiny kernels)
instead of mis-decoding the router's. Cleaner long term: record the descriptor layout in
CommandPlanMoeRoutingBundleand derive the consumer / decode constants from it, so the layout stopsdepending on which dispatch claimed the value first.
Worth stressing that the crash is the loud half of it: every <= 128-expert, >= 64-expert case with
two or more tokens per expert already returns wrong values (maxdiff 0.63 on the whole router output)
without faulting, so this silently corrupts MoE routing as well.
One more observation, since the issue says the device survives when run alone: on this box (gfx1151)
the single reproducer also wedges the GPU —
amdgpu: GPU reset(3) succeeded! / GPU reset: queues of 2 process(es) are no longer usable / [drm] device wedged. A full sweep is not needed for that, onlyfor it to be obvious.
Harness (drop-in mirror of
run_router_common_matmul_case, ~700 lines with a CLI for--experts/--tokens/--wtype/--constant-idsand device-VA printing) and all raw logs are available ifyou want them attached here or as a PR.
bong-water-water-bong commentedon Nov 19, 2026
This case does not just fault the device — on strixhalo it wedges the machine. Reproduced 2026-11-19 while A/B-ing GPU firmware.
Sequence (boot
259451f2, kernel 7.4.0-rc1-1bit, GC 11.5.2 firmware from linux-firmwareafa73dfc, i.e. the August blobs):Ten fault/reset lines in that boot, all at the moment the case ran; the box had been up ~11 minutes and idle. Recovery needed a physical power cycle.
Command (gate tree, add-on enabled, one
gpu-holdticket):Two consequences worth recording:
Also relevant to #2478 and #2542: this is the first case in the tracker where a fault reliably escalates to a hang instead of a
GPU reset(1) succeeded, which is what those issues see. The difference in the fault line here isring:24 vmid:10 pasid:25andclient 10; the earlier sweeps reported[gfxhub] page faultfollowed by a successful reset.bong-water-water-bong commentedon Nov 20, 2026
Cause: the router writes a different descriptor layout than the
mul_mat_idconsumer reads, and the bundle check compares only sizesThe deterministic address and
reason mask 0x1are explained by a wrong expert index, not by a wrong tensor size: the partition table is built with the Qwen layout and decoded with the common layout, and the partition field lands inside the common expert field.Three facts, each checkable in the source at the fork pin:
dispatch-moe-router.cpp:380→moe_router_descriptor_layout()(dispatch-moe-routing-layout.h:53):expert_count <= 128→ Qwen: expert mask 127, partition shift 7, row-count shift 13, 128 lanes. Above 128 → common: mask 511, shifts 9/15, 512 lanes.ggml_mul_mat_iddispatch hard-codes the common layout for every expert count it accepts (common_mul_mat_id_supported_expert_count= 1..512,dispatch-mul-mat-id-common.h:89), passingkMoePartitionExpertMask/Shift/RowCountShift= 511/9/15 (command-plan-metadata.h:29-31).common_mul_mat_id_ensure_moe_routing_bundle()reuses the router's bundle whencommon_mul_mat_id_bundle_matches()says yes, and that function (dispatch-mul-mat-id-common.h:192-203) comparestoken_count,route_count,expert_count,route_strideand the two byte counts — never the layout. The byte counts do match, becauseexpert_table_size/partition_table_sizeindispatch-moe-router.cpp:121-129are byte-identical to the common formulas. So the Qwen-laid table passes the check and is decoded as common.Why this shape and not the neighbours
v = expert | (partition << 7) | ((rows-1) << 13)written by the router;expert = v & 511read by the consumer. When an expert's partition index reaches 1,partition << 7sets bit 7, which is inside the consumer's 9-bit expert field:The gather runs off the end of the expert weight tensor and the address is fixed, because the partition indices are fixed by the routing.
partition >= 1needs some expert to own more than 32 rows, which is exactly why the small siblings pass:(the sweep never reached
experts256/512.tokens512, so their safety is a prediction, not a measurement)Two consequences worth acting on:
experts=128, tokens=33, not 512 — the first case where one expert owns 33 rows. If it faults, the cause is the layout boundary and nothing else; if it does not, this analysis is wrong and I will say so.experts=256/512, tokens=512should pass. If either faults, there is a second, unrelated bug, and the shape table above is the cheapest way to tell the two apart.Guard
The consumer must refuse a bundle whose descriptor layout is not its own, and build the table with its own layout instead (
has_routing_bundle = falsepath already exists and produces the correct table). That is a two-file change — carry the layout inCommandPlanMoeRoutingBundleand compare it incommon_mul_mat_id_bundle_matches()— and it holds for the >128 direction too, where the current code is correct only by coincidence of both sides agreeing. The longer-term fix is for the router to choose the layout from its consumer rather than from the expert count; the guard is what makes that safe to do later.I have not run the device yet: the box has reset five times since 11-16 and the last one was 11-19 21:16Z (
MES might be in unrecoverable state), so the first run goes inside onegpu-holdticket with the shape matrix above, and I will stop rather than retry if the take is refused.bong-water-water-bong commentedon Nov 20, 2026
Guard PR: 1bit-MONSTER/llama.cpp#436 — the bundle now carries the descriptor layout it was written with, and
common_mul_mat_id_bundle_matches()refuses a bundle that was written with a different one (falling back to the existing "build my own table" path). Header-only test pins the boundary, the guard, and the 12-of-16-partitions arithmetic, withtokens=33as the minimal repro.Device proof still owed and not claimed: the box has reset five times since 11-16 (last 11-19 21:16Z) and disk is under the 160 G floor for a new build tree, so the first run goes in one
gpu-holdticket with the shape matrix from my last comment (experts128.tokens512→ pass,experts256/512.tokens512→ still pass,experts128.tokens33→ the minimal reproducer).bong-water-water-bong commentedon Nov 20, 2026
Correction: my first device run measured nothing, and the suite's exit code hid it
The three shapes below came back
rc=0with no summary line, in 1 second for all three. That is not a pass — it is a skip:main()computeshas_device = ggml_backend_hrx_get_device_count() != 0(hrx-ops-test.cpp:9772), so when the device does not enumerate every device case answers success without running. My harness grepped forsummary:and treated rc 0 as green, which is exactly the hollow pass I have been telling other lanes not to accept. The harness now requires a summary line naming at least one passing case and otherwise recordsSKIPPED-OR-NOT-RUNwith the reason it printed.Why the device did not enumerate at 06:54:09Z I do not yet know: the token was granted 1 s earlier while another lane's ticket was still tearing down, and the
HRX0 guardrailline that always precedes a successful init is absent from that run's output. That is the next thing to establish — with the device up, in a window, not by inference.So: no matrix result is claimed. The predictions in my earlier comment still stand unmeasured:
experts128.tokens512faults today (documented in the issue, same bench tree),experts256.tokens512andexperts512.tokens512must pass if the cause is the 128-expert layout boundary,experts128.tokens33is the minimal reproducer and is now in the suite grid.Separately, worth a decision from whoever owns the fork's test runner: a skipped device case returning 0 is indistinguishable from a pass to any script that reads exit codes, and this repo's own convention for a skip is 77 (
SKIP_RETURN_CODE 77, used by the engine's ctest rows). Every lane that shells out tohrx-ops-testand checks$?has this hole. I am not filing it while #2861 is open — it is the same bench tree and the same suite — but I will, or fold it into the fork's runner, whichever this issue's owner prefers.bong-water-water-bong commentedon Nov 20, 2026
Status: a partial fix is merged into the fork branch, and the fix is now fork PR #438
1bit-MONSTER/llama.cpp#436was reviewed READY at66f5db462and merged (fe820a0bfe, 05:53:53Z) — an hour before I pushed the commit that makes its guard unnecessary. So the branch now has the descriptor-layout guard without the consumer-aware selection that makes it not need to fire, and the guard's stated fallback cannot run:A freshly built table carries a new value id, so at 128 experts with ≥33 tokens the plan is refused: the device fault becomes a dispatch failure. Better than a GPU reset and worth having, but not the fix, and not what the merged comment says it does.
#438 is the delta cherry-picked onto the branch head — three files: the router asks
route_ids_feed_plain_mul_mat_id(context, router_match)(a plainGGML_OP_MUL_MAT_IDconsumer is decoded by the common layout, at every expert count it accepts; the qwen fused routed kernels reach the ids through their own pattern) and passes that tomoe_router_descriptor_layout(expert_count, consumer_reads_common). One table, written with the layout its reader decodes; the guard stays as a backstop that should never fire.What is still unmeasured, stated plainly
The shape matrix has not run. Three attempts: the first ticket expired in the queue behind
coder-llm(twice), the third — inside a self-service window — was granted 796 s late while another lane's window was restartingcoder-llminto the GPU, and all three cases returnedrc=0in one second with no summary line:testing_suite.h:254returns 0 for a device case that cannot see a device. Nothing was measured and nothing is claimed; the harness now aborts unless asummary: N passedline names at least one case.The predictions the matrix must confirm, unchanged:
experts128.tokens512faults today,experts256.tokens512andexperts512.tokens512pass (the boundary is 128, not size), andexperts128.tokens33— now in the suite grid — passes with #438.One thing for whoever owns the fork's test runner
A skipped device case returns 0, while this repo's own convention for a skip is 77 (
SKIP_RETURN_CODE 77). Every lane that shells out tohrx-ops-testand checks$?reads a skip as a pass — that is exactly how I nearly reported three green rows that ran nothing. Not filing it separately while #2861 is open; glad to fold it into the runner if you prefer that.bong-water-water-bong commentedon Nov 20, 2026
The runner's skip-returns-0 is now its own issue rather than a footnote here: #2912 — it affects every suite built on the fork's
testing_suite.h, the fix is 1–3 lines, and the test it wants (point the binary at a nonexistent device, assert the exit code is not 0) needs no device to run. Your row (#2861) is untouched by it: this is the contract of--hrx-test-case, not the MoE dispatch.bong-water-water-bong commentedon Nov 20, 2026
The fix is merged into the fork's pin branch; the device matrix is the only item left, and it needs a priority slot
1bit-MONSTER/llama.cpp#438merged. The merged content is the existential predicate, in the words the review settled on:So the writer no longer guesses the layout from
expert_countalone: it follows the consumer, and #436's size-only guard stays as a backstop that should never fire.What is still unmeasured, and what would settle it. The shape matrix has now had six window attempts — 06:54, 07:47, 08:33, 08:52, 09:57, 10:02–10:17Z — every one either expired in the
gpu-holdqueue or was granted in a lapse wherecoder-llm's service process still held the GPU (ggml_backend_hrx_get_device_count() == 0seconds after a hand-over, four times, GPU log clean). I have stopped attempting: each try costs a queue entry other lanes wait behind and yields nothing.What it needs is one quiet moment, about two minutes of device time:
The harness for that is written and honest: it refuses to record anything without a
summary: N passedline naming a case, so if the device does not enumerate it writesABORT … nothing measuredand exits 3 rather than reporting a skip as a pass — the failure mode that produced three false green rows this morning before #2912/#439 fixed the runner's exit code.If a priority slot is available, say the word and this closes today. Otherwise the row stands as: cause identified, fix merged, minimal shape in the suite, measurement owed to the queue.
bong-water-water-bong commentedon Nov 20, 2026
This is blocked on the pin, not on the layout fix — and the layout fix already merged.
I checked what engine actually builds against rather than what the fork's branch contains:
The consumer-aware form —
moe_router_descriptor_layout(expert_count, consumer_reads_common)— is not at this pin. It merged into1bit-MONSTER/llama.cppas #436's guard + #438's fix ("merged the guard and not the fix"), and engine's pin predates both.The chain, which is three issues pretending to be one
So #2861 is not waiting on its own investigation. The defect is understood, the fix is written, reviewed and merged upstream, and the only thing between the merged fix and this fault is a transitive pin.
Why writing this down is worth a comment
A lane reading #2861 sees an unexplained device fault and starts bisecting the router. The bisect will find what #438 found — the layout follows the expert count instead of the consumer — and then it will try to fix it in a pin that already contains no such code. The finding is in
fe820a0bf, not in8d26add2c.#2916 names the exact errors that block the bump (
loomc_link_index_builder_release,LoomLinkIndexBuilder×2) and says it was found by running the pin bump (#2914, closed with that diagnosis). That is the right issue to work on; this one moves the moment it clears.I am not closing this. The fault is real and reproducible at the pin engine ships; it just is not waiting on the work it appears to be.
bong-water-water-bong commentedon Nov 20, 2026
Residual risk in my own fix, found while checking whether it can break the fused path
#438makes the router choose the layout from the consumer, and it answers "is there a plainMUL_MAT_IDreading these ids?". While checking what happens when the answer is no — the qwen fused routed-FFN path — I found that the two sides may already disagree there, independently of my change:So on the fused path the table is written with Qwen constants and read with common ones. That is the same class as this issue, one consumer over, and my fix does not touch it: my predicate returns
falsefor a fused-only consumer, which is exactly the branch that still emits Qwen.Two things I am not claiming:
dispatch-routed-ffn.cpp), and the first step is a measurement, not a patch.What I would do, in order: (a) point the layout header's own words at the real reader — it says "The qwen3_moe routed kernels decode this layout with hard-coded constants", and the file shows constants that are the common ones, so either the comment or the constants are wrong; (b) if the constants are right, the router's Qwen branch has no consumer at all and should be deleted rather than kept as a backstop, which would also make
#438simpler; (c) if the comment is right, the fused consumer has a bug of its own.The cheapest way to tell (b) from (c) is a device run of a fused-path case with
experts=128and a batch that gives one expert more than 32 rows — the same shape family as this issue, which is why I am recording it here rather than in a new issue.Recorded so the next reader of
#438knows the scope it did and did not cover: the plainmul_mat_idpath is fixed; the fused path is unexamined.bong-water-water-bong commentedon Nov 20, 2026
Residual risk settled by reading the kernel sources — verdict: the fused F16 call site is the wrong one, and it is fixed in fork#445.
The question was which constants the fused routed-FFN decodes with. The answer is "both, depending on the kernel", and that is what makes it a defect:
qwen3_moefused (q4k)andi 127,shrui 7,shrui 13(routed_gate_up_swiglu_q4k.loom:559-573)loom_libsgeneric (F16 fused)f16_pair_schedule.loom:116→unpack_expert_partition_descriptor)So neither of my two guesses held: the Qwen layout has a real consumer, and it was the F16 fused path that decoded a Qwen-laid table with
511/9/15atexpert_count <= 128.dispatch-routed-ffn.cppnow passes the bundle's own recorded values (engine#438added them for exactly this), with the common constants only as a fallback for a bundle that predates the fields.-fsyntax-onlyclean, header-only test green; nothing claimed about the device. Per your item (2), the matrix comes next — smallest first (tokens=33, then 64, 128, 512), kernel log checked between each, stop at the first MES line — and per your item (3) this issue closes on the pin-bump PR oncetokens512is clean and #445 is merged.bong-water-water-bong commentedon Nov 20, 2026
fork#445landed (squash42b5444, 12:22:02Z). One thing worth confirming about it: it is live code, not a guard the matcher makes unreachable.The obvious way for this fix to be worthless is for the F16 fused matcher to require the common layout — then
routing.descriptor_*would always read 511/9/15 through the fallback and nothing would change. It does not:match_routed_ffn_gate_up_swiglugates onbundle_matches_moe_routing(dispatch-routed-ffn.cpp:330-338), which checks ids, route count, expert count, stride and table sizes — not the descriptor layout.moe_routing_bundle_readable_as_commonexists and is used elsewhere, not here. So a Qwen-laid bundle reaches this dispatch, which is the case#438created.…/ops/mul_mat_id_swiglu_f16_f16_wmma.loom:50-52underggml.mul_mat_id_swiglu_f16_f16.descriptor_{{expert_mask,partition_shift,row_count_shift}}, and the dispatch'sconfig_prefixis exactlyggml.mul_mat_id_swiglu_f16_f16(dispatch-routed-ffn.cpp:927).recorded > 0 ? recorded : fallbackcannot fall back on a live path: the router writesrouter_layout.*_valuefrommoe_router_descriptor_layout()(dispatch-moe-router.cpp:667-682), and both layouts are non-zero (127/7/13 and 511/9/15), so 0 means a pre-#438bundle, as the comment says.descriptor_*fields are populated, not left at their zero defaults, on the only path that appends a bundle (append_moe_routing_bundle, same call site).Not established here: whether
router_common_matmul.experts128.tokens512still faults the device — that needs the ticket, the pin bump and a full sweep, and the fault signature (a device reset inside a sweep) is not something a compile can answer.fork#445is in the pin branch now, so the nexthrx-ops-testrun at the new pin is the measurement; if the fault survives it, the residual is theqwen3_moeq4k literal path that#445deliberately did not touch.bong-water-water-bong commentedon Nov 20, 2026
The engine pin now carries your layout fix. engine#2954 bumps
third_party/llama.cpp8d26add2c -> 42b544465, and that range includesfe820a0bf— serve --pm: a spawn_worker tool that asks an executor for a long-running agent worker #436, the routing bundle recording the descriptor layout it was written witha7fd21ac9— Census 2026-10-17 #438, the layout following the consumer so the plan keeps one table42b544465— hrx-backend-test: 49 host cases red after the AMD-core re-head — classification (stale expectation vs needs a ruling) #445, the fused F16 routed-FFN decoding with the layout it was written withhrx_buildand the loom-jit pair row are green on the bump. This only unblocks the engine from pinning the fix; whether the 512-token router case stops faulting is yours to confirm on the device.bong-water-water-bong commentedon Nov 20, 2026
The pin bump landed (#2954 merged):
third_party/llama.cppis now42b544465, which carries all three fixes for this issue.So the fix half of this issue is now on the engine's pin. What remains is the device matrix, and it has a binary and a slot problem, not a code one:
hrx-ops-testin the shared bench tree at this pin (~/.cache/hrx-build/bench/hrx/llama/bin/hrx-ops-test, 12:42Z) after moving the fork submodule, becausehrx_buildbuildsllama_hrxandonebitbut not the test target — so "the pin is built" was true for the libraries and false for the suite.~/GPU-QUEUE(cl1051-c4-status-quiet,cl-1783-build,build_cl-2918,cl-679-flashnext, ahw-gaterun, then mine). I do not jump the queue, and the earlier windows expired behind exactly this.The ladder is armed and will run as one ticket the moment it is granted:
experts128at tokens2 → 33 → 512, thenexperts256/512.tokens512as the expert-count controls, kernel log checked between each shape, stopping at the first MES line;coder-llmdown ≤10 minutes and:8090confirmed afterwards.Nothing else is needed from anyone: per the ORCH, this issue closes on this pin-bump PR once
tokens512comes back clean, and the run is written to fire unattended when the queue reaches it.bong-water-water-bong commentedon Nov 20, 2026
Coordination, because two lanes are queued for the same thing right now:
~/GPU-QUEUEshowsi679-suite-42b544465holding the GPU, and my ladder is behind it — same pin (42b544465), same suite.If that run is
hrx-ops-testover the whole suite at this pin, it already contains the shapes I need, and neither of us needs to run them twice. The five, in the order I would run them:Expected on this pin (fixes #436 + #438 + #445 all merged into it): all five pass, with
tokens512the one that used to fault and reset the GPU inside a sweep.Two things worth knowing if you are sweeping rather than running them singly:
experts128.tokens512was the case that reset the GPU from inside a full sweep (engine#2861,GPU reset(1) succeeded), so if it is going to fault, it faults there and takes the sweep with it. Running it alone first costs 30 seconds and protects the rest.--hrx-test-output allis what prints thesummary: N passedline; without it a case that skipped on a device-less box exits 0 and looks green (that is engine#2912, fixed by fork#439 — but that fix is in42b544465, so at this pin the skip answers 77 and thectest_skipsrow would name it).If your run covers them, paste the five
summary:lines here or on your own row and I will take them as the matrix evidence for #2861 — the fix is already on the pin and this is the last item on the issue. If it does not, my ticket is behind yours and will run them the moment it lands; nothing is blocked either way.bong-water-water-bong commentedon Nov 20, 2026
Queue status, so nobody waits on me to report something I do not have: the ladder ticket is 6th of 8 in
~/GPU-QUEUE(cl-679-flashnext,cl-2918-serve,cl-hrxmem-sink4,coder-llm,build_cl-2918, then mine, withcl-856-iq1-pinandi679-suite-headbehind) — the pin-bump validation wave has every lane on the GPU at once. No relaunch: each relaunch goes to the back of the FIFO, and the ticket now carries a 30-minute wait so it survives a build.i679-suite-headin that queue is the run I flagged in #2870; if it covers the fiverouter_common_matmulshapes, itssummary:lines answer this issue and mine is redundant.bong-water-water-bong commentedon Nov 20, 2026
The fix is now at the pin — this issue moved from "blocked on a pin" to "needs a device run".
Both halves of the layout fix are in the pin engine builds —
llama.cpp#438(the common layout follows the consumer) andllama.cpp#445(the routed-FFN does too).engine#2916closed and the bump landed while I was writing up the chain that had this blocked, so my earlier comment on this issue is now history rather than status.What this issue is waiting on now
One device run of
tests/test-hrx-ops.cpp'sexperts128.tokens512case, which needs annpu-hold/gpu-holdticket and a real device.The prediction is specific and falsifiable: at
8d26add2cthe router wrote a table laid out by expert count, so at 128 experts with ≥33 tokens the partition table carried a partition index above zero decoded with the wrong layout, and the row gathered past the expert weight tensor. With the consumer-aware layout the writer produces the common-laid table,append_generated_resource()stops refusing it, and the guard becomes a backstop that never fires —llama.cpp#438's own words.So the run should be boring. A fault would be a new finding, not a disproof: it would mean the layout is right and something downstream (
tests/hrx-ops-test.cpp's:8726/:8727,:8968–:8980region) still disagrees — andllama.cpp#448is already moving those fixtures to the padded capacity for exactly that class of reason.And the related rows in the same file
llama.cpp#448fixes the ten FA rows that the split-expectation guard refuses — the guard from #418, whose comment names thosekv65cases. It isRefs engine#2870and notFixesbecause the rows cannot pass until they can run, which is this same device run.So one ticket covers both #2861 and #2870's remaining question, and the cheapest order is: run the suite, read which rows fail, and split the answer between "the layout fix worked" and "these fixtures still need #448".
bong-water-water-bong commentedon Nov 20, 2026
A run recipe anyone can execute in ~2 minutes, because this row should not depend on my queue position
Ten
gpu-holdattempts have produced one measurement bottleneck and eleven causes, all documented. The remaining work is two minutes of device time, so here is the exact recipe — copy-pasteable by whoever holds a slot next (orchestrator, another lane between their own runs, or me when a ticket wins).Binary (already built at the pin, nothing to compile):
Preflight, because every wasted attempt today failed one of these:
The five shapes, smallest first,
summary:required (a case that skips answers 0 and looks green — engine#2912):What to expect on this pin (fixes #436 + #438 + #445 are all in
42b544465): all fivesummary: 1 passed, 0 failed.experts128.tokens512is the one that used to fault and reset the GPU inside a sweep, so it is the load-bearing row; the twoexperts256/512rows are the control that says the boundary was the 128-expert layout switch and not tensor size.Paste the five
RESULTlines here and this issue closes on the pin bump that already merged. If aSTOP:fires, paste that instead — a fault attokens512on this pin would mean the fix is incomplete and is worth more than the five greens.bong-water-water-bong commentedon Nov 20, 2026
Two details about the recipe above, verified against the pin's source rather than by running anything:
1. The five case names exist at
42b544465. The grid is concatenated, not literal:so
experts128.tokens33(the shape added for this issue) and the four others are all registered at this pin. That also explains something that can mislead:strings hrx-ops-test | grep router_common_matmulfinds one hit, the prefix — the names are built at runtime, so "not instrings" is not evidence that a case is missing.2. The recipe's preflight is cheap and I ran it verbatim a moment ago:
If any of those four lines disagrees on your box, the run will fail in one of the ways this row has already documented eleven times — which is why they come first and cost nothing.
bong-water-water-bong commentedon Nov 20, 2026
The matrix has three rows and is missing the decisive one; the last two attempts aborted at the enumeration probe, and the successful attempt had 13 minutes of settling that the failing ones did not.
From the harness's own log (
~/.cache/scratch-cl-hrxnan/2861-matrix.log):device did not enumerate→ ABORT, rc 3device did not enumerate→ ABORT, rc 3Two things that follow, both actionable in that harness rather than in the driver:
experts512.tokens512,experts256.tokens512andexperts128.tokens2. The issue's own case —experts128.tokens512, the one where >32 rows reach one expert and the partition bits land in the 9-bit expert field — is not among them, so the fix (Census 2026-10-17 #438/hrx-backend-test: 49 host cases red after the AMD-core re-head — classification (stale expectation vs needs a ruling) #445, both merged and in the pin) is still unmeasured at the shape it exists for.systemctl --user stop coder-llmthe 06:41Z attempt did and the 15:24Z attempt skipped, matches the difference between the arms.Neither of those needs a new driver hypothesis: the abort is the harness giving up before the device is free, and the row that matters has not been attempted yet.
bong-water-water-bong commentedon Nov 20, 2026
The pin moved again while this row was queued:
4eb3f08f95ff, one bump past the one I have been citing. Worth recording because it decides what any numbers here are attributable to.So the fixes are intact across both bumps —
42b544465→4eb3f08fdid not revert any of them — but the suite binary in the shared bench tree was last linked at 14:00Z, i.e. from the first pin, and a run against it would be answering a question about42b544465while the engine ships4eb3f08f. I am rebuildingbin/hrx-ops-testincrementally at the current pin before the ticket lands, so the fivesummary:lines describe the shipped pin rather than the previous one.That is the whole cost of the bump-on-bump: one incremental link, not a new tree. Nothing here needs a decision from anyone; it is bookkeeping that has to be right for the result to mean what it says.
bong-water-water-bong commentedon Nov 20, 2026
Why this row reported "the device did not enumerate" twelve times, and what the twelve runs actually said
The defect was in my harness, not on the box, and it is worth writing down because the symptom pointed at the device for three hours.
--hrx-test-casenever prints asummary:line. The runner is:The
summary: N passedline is printed byrun()after case selection, and--hrx-test-casetakes thesingle_casebranch that returns before it. So my gate ("require asummary:naming a passing case") could never be satisfied, and every attempt logged "ABORT: the device did not enumerate, nothing measured" regardless of what the device was doing.The evidence is the abort dump I added an hour ago — the probe's complete output, verbatim:
No summary (expected), and no
test skipped: no device available— which is the only line this mode prints when a device case genuinely cannot see a device. Its absence means the case ran and returned 0.The verdicts this mode actually produces
That is now the harness's rule, and the ladder is re-running with it. Twelve attempts queued, aborted, and reported a device fault that was not there; the four load-bearing shapes were never reached because the control-shape probe stopped the ladder for a reason that did not exist.
What is not claimed: that
experts128.tokens512passes. It has not been run since the fixes landed — it was never reached. The next comment on this issue will be fiveRESULT … -> PASS|FAILlines or a kernel fault, and nothing else.bong-water-water-bong commentedon Nov 20, 2026
The matrix, measured: all five shapes PASS at the shipped pin, with the case that used to reset the GPU
One
gpu-holdticket, 16:23:53Z, binary built from fork4eb3f08f(the engine's pin, containing #436 + #438 + #445), D-state 0 at entry:Read as evidence rather than as five ticks:
experts128.tokens512no longer faults. That is the case in this issue's title: it aborted at 4 s withreason mask 0x1in a fixed address, and inside a sweep it produced three gfxhub page faults and a GPU reset for the whole box. It now returns 0 with zero kernel fault lines and no reset line.tokens33passes, which is the minimal shape I predicted would be first to break and then added to the suite grid — the first batch where an expert owns 33 rows, i.e. the first partition index above zero, i.e. the first descriptor whose bits differ between the two layouts.experts256/512.tokens512pass, the control for "the boundary was the 128-expert layout switch and not tensor size". They always would have; now they have been run.tokens2is the control that says the harness can report a pass at all.What actually took fourteen attempts
Not the device. Two harness faults of mine, both now fixed and both worth recording because they cost the time:
--hrx-test-casenever prints asummary:line —run_single_case_in_process()runs the case and returns, while thesummary:comes fromrun()after case selection. My gate demanded a summary, so every attempt reported "the device did not enumerate" while the case was in fact running and returning 0.gpu-hold's 10-minute window refuses the ticket and loses the position (engine#2961). One attempt burned 800 seconds that way; the window now waits for the clock to clear before queueing.The device was available, and every "the device did not enumerate" line in this thread's history was my detector, not the GPU.
bong-water-water-bong commentedon Nov 20, 2026
Closing with the measurement the issue asked for.
The fix is on the shipped pin —
third_party/llama.cpp4eb3f08fcarries #436 (the bundle records its layout), #438 (the layout follows the consumer) and #445 (the fused F16 routed-FFN decodes with the layout it was written with) — and all five shapes pass on a binary built from exactly that commit, with zero kernel fault lines between them:experts128.tokens512is the case in the title: previously an abort at 4 s withreason mask 0x1at a fixed address, and a box-wide GPU reset from inside a sweep.tokens33is the minimal shape (the first partition index above zero) and is now in the suite grid so a regression fails fast and alone.The cause, for the record: the router wrote the Qwen descriptor layout for
expert_count <= 128while the commonmul_mat_iddecodes the common layout for every count it accepts; the reuse check compared sizes, and the sizes are identical between the layouts, so a Qwen-laid table reached a common-layout reader and partitions congruent to 1/2/3 (mod 4) decoded toexpert + 128/256/384— a gather past the weight tensor.Two follow-ups live in their own rows: #2961 (an NPU fault refusing GPU tickets, which cost three attempts on this matrix) and #2912 (fixed by fork#439).
bong-water-water-bong commentedon Nov 20, 2026
Device-free arithmetic on the failing shape, and it narrows the search to one candidate rather than "512×128 is big".
The router's partition table is sized by
dispatch-moe-router.cpp:125:with
route_count = 8(kQwenRouterRouteCount). Every shape the reproducer sweeps:experts128.tokens512is the only shape in the sweep whereassignment_partition_count == expert_count(128 == 128). Every other case has partitions far below experts (1, 9, or 128 vs 256/512). So if the fault were merely "512 tokens is big",expert256.tokens512andexpert512.tokens512— which have larger tables — would fault too; they are the natural controls, and the report says they do not.Two candidate mechanisms that equality exposes, both checkable in source before any device run:
1 + partitions + expertis fine whenpartitions < expertsbut lands in the expert half exactly when they are equal — an aliasing/overlap of the two halves of one buffer rather than an overrun past its end.tokens 128andtokens 512. A kernel that indexes with the unaligned capacity while the allocation is aligned (or the reverse) faults exactly at the shape where the two disagree.What I could not do here: the faulting kernel is
loom_libs:ggml_moe_build_expert_partition_table, in the add-on, and it is not in the fork tree I can read (grep -rn ggml_moe_build_expert_partition_tableover the gpu-kernels checkout atbc3051d5e9c6returns nothing), so the write-index bound is not checkable from this lane without knowing which add-on revision the bench tree carries. That is the next step and it needs no GPU: read that kernel's index expressions at the add-on revision the reproducer used, and compare them with1 + ceil(tok*8/32) + experts.The reproducer's own controls are worth keeping in the ticket:
expert256.tokens512andexpert512.tokens512are on either side of the equality, so a fix that only makes 128 experts pass is not a fix.bong-water-water-bong commentedon Nov 20, 2026
Follow-up to my arithmetic above: the kernel source is readable after all — it is Loom corpus, not the private add-on (
ONEBIT_GPU_PRIVATE:PATH=is empty in the bench tree, which is also why that tree has never contained private kernels).~/.cache/scratch-i679/corpus2b/loom-libs/ops/moe_routing_tables.loom(the corpus file the bench tree embeds asloom_libs:ggml_moe_build_expert_partition_table) packs each descriptor like this:and the layouts in
dispatch-moe-routing-layout.hgive the field widths:The partition ordinal field holds 64 values in both layouts, and
expert128.tokens512produces 128 assignment partitions (512 * 8 / 32). From ordinal 64 upward, the shifted partition value overflows its field into the row-count field — so the reader decodes a row count that is not the row count, and reads a span it does not own. That is a device page fault whose address comes from a corrupted descriptor, which matches the fault being on the read side of the table rather than a write past its end (the table itself is sized exactly right and written exactly to capacity, as the previous comment shows).A prediction this makes, which is cheaper than a GPU run to test: the boundary is
tokens = 256, not512(256 * 8 / 32 = 64, the first ordinal that does not fit). Ifrouter_common_matmul.experts128.tokens256passes, the 6-bit-field story is wrong; if it faults, the fault is the packing and the fix is a wider partition field (or a dispatch guard refusing tables with more than 64 partitions until the format grows one).Two caveats, stated so the next reader does not over-read this:
expert256.tokens512andexpert512.tokens512also reach 128 partitions, and the ticket reports they do not fault — so the field width alone does not explain which shapes fault. Either the reader for those shapes takes a different path (they are not eligible for the Qwen layout), or the fault also needs the 7-bit expert mask of the Qwen layout in play. Thetokens 256arm is what separates those.bong-water-water-bong commentedon Nov 20, 2026
Withdrawing both comments above: this issue's mechanism is already fixed on the pin, and the fork's own suite says so.
Two commits with
engine#2861in their subject are ancestors of main's current pin (338dabbdb), which I verified rather than assumed:and
tests/hrx-ops-test.cppnow carries the diagnosis in its own words, next to the sweep that reproduces it:So the mechanism was the writer and the reader disagreeing about the descriptor layout — the table created with the Qwen layout for ≤128 experts and then decoded with the common 511/9/15 constants, which reads the partition and row-count fields at the wrong bit offsets and gathers past the expert weight tensor. That is a different explanation from the 6-bit-field overflow I proposed: the field widths are fine; the consumer was reading the wrong fields entirely.
My two hypotheses above are therefore moot, and the
tokens = 256arm I proposed would not have settled anything — the boundary wastokens = 33(the first partition index above zero), which the suite now covers.What remains true from my arithmetic: the table is sized and written exactly to capacity at
tokens 512 × 128 experts(257 int32 = 1028 B), which is why a mis-decoded descriptor faults there first and hardest. But it faults there because of which layout the reader assumed, not because of the packing.Suggestion for the issue: either close it as fixed-by-
a7fd21ac9+fe820a0bfonce a sweep on the pin is clean, or relabel it as the record of the layout disagreement with those two commits named. What should not stay is the current title's implication that the device faults remain — a reader will otherwise start from my (wrong) framing rather than from the fix.