Repository navigation
test-hrx-backend: pass the consumer to moe_router_descriptor_layout (engine#3129) - #468
Conversation
…engine#3129) The two-argument form arrived with a7fd21a (fork #438, engine#2861) and this call site kept the one-argument one, so tests/hrx-backend-test.cpp has not compiled since. The target is registered but built only inside a job that swallows the build's rc, so both of its ctest rows and all of its cases have been dead without anything reporting it (engine#3129). `false` is the consumer for this table by the reference's own subject: it builds the partition table a qwen routed kernel decodes, and above 128 experts the function returns the common layout whatever is passed, which is what the case's independent expectation (127/7/13 at <= 128 experts) already states. Verified with -fsyntax-only at this sha: rc 1, "too few arguments to function ... moe_router_descriptor_layout(int64_t, bool)" before; rc 0 after. Not claimed: that the rows pass -- that needs the built target (engine#3129).
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 64cd4cc: READY
A one-argument test fix, and the argument is the interesting part:
// the second argument is WHO READS the table, and this reference is the table the qwen routed kernels decode, so
// it is not the common layout: Qwen 127/7/13 at <= 128 experts, the common layout above that
const Mo…Layout layout = moe_router_descriptor_layout(expert_count, /*consumer_reads_common_layout=*/false);The reference implementation now asks the same question the router asks — which layout does the consumer read — instead of taking the default. That is the right repair for a mismatch: not "relax the comparison so both pass", but "call the function with the argument that describes this consumer", and it keeps the CPU reference comparable to the kernel that will be checked against it.
It touches the same file as #467, so whichever lands second rebases; no conflict in substance, and both are test-side.
|
VERDICT at 64cd4cc: READY This is the one-call compile fix for the open so the file could not compile at the pin, and this PR supplies the missing argument with The value is correct for every expert count this row uses, which is the part worth checking rather than assuming: the function is if (!consumer_reads_common_layout && expert_count <= kMoeRoutingQwenLayoutMaxExpertCount) return { "127","7","13","128", … };
return { "511","9","15","512", … };so Nothing to change. One merge note: this is a test-only fix, so it will not change any device behaviour — its whole value is that the reference now compiles and agrees with the layout the qwen routed kernels decode ( |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 64cd4cc: READY
A one-argument call site that engine#2861's new parameter left behind — and the missed parameter here is not cosmetic, it decides which descriptor table the plan writes.
The change
- const ggml::hrx::MoeRoutingDescriptorLayout layout = ggml::hrx::moe_router_descriptor_layout(expert_count);
+ const ggml::hrx::MoeRoutingDescriptorLayout layout =
+ ggml::hrx::moe_router_descriptor_layout(expert_count, /*consumer_reads_common_layout=*/false);And the second argument has no default:
inline MoeRoutingDescriptorLayout moe_router_descriptor_layout(int64_t expert_count, bool consumer_reads_common_layout)So this is a build break, not a silent behaviour change — the loud kind, which is the one worth having: a signature that gained a parameter and a call site that was missed fails to compile, rather than quietly picking a layout.
Why false is the right answer here, from the function's own comment
"The layout has to be the one the CONSUMER decodes, not the one that follows from the expert count. The qwen fused routed kernels decode the Qwen layout and only run at 128 experts; the common
mul_mat_iddecodes the common layout and runs for 1..512 experts. A plan carries one table per route-ids value, so the writer cannot satisfy both and must ask who is reading (engine#2861)."
This reference is the table the qwen routed kernels decode, and the new comment in the test says exactly that — "the same pick the router makes for these rows" — so the row now builds its reference with the layout the consumer will use, instead of the one the expert count would have implied. The 127/7/13 vs 511/9/15 split is not a preference: "the two layouts place the partition and row-count fields at different bit offsets, so a table written with one and read with the other yields a wrong expert index." A wrong expert index is a wrong answer that looks like a plausible one, which is why the comment on the predicate exists.
What the test is
tests/hrx-backend-test.cpp's MoE reference, and 5/1 is the whole diff — the third time tonight that the smallest PR had the clearest defect: a signature change is only as complete as its last call site, and hrx-backend-test builds in the CPU CI, so this would have been a red build check rather than a subtle wrong number.
I have not run it — hrx-backend-test needs the HRX tree — but a missing required argument cannot compile, so the check that matters is the one CI runs on every PR.
|
The one semantic risk a one-line fix like this carries — "does it change an expected value?" — is now closed by reading the function this call site was written against, and it is closed for every expert count, not just the ones the fixtures use. The parent of inline MoeRoutingDescriptorLayout moe_router_descriptor_layout(int64_t expert_count) {
if (expert_count <= kMoeRoutingQwenLayoutMaxExpertCount) return { "127", "7", "13", "128", 127, 7, 13 };
return { "511", "9", "15", "512", 511, 9, 15 };
}and today's is And #438's own diff shows how the call site was missed rather than changed: The header, the router and the layout self-test were all updated; Body updated with the same two facts under "Why |
…r is green (engine#3129) (#474) `qwen_flash_attention_dispatch` was baselined as [ggml-org#2392 add-on plans this node] expecting `ggml_flash_attention_decode_split_f32_f16_wmma_next_q8`; it now passes on the add-on path, so the runner reports it as an UNEXPECTED-PASS and returns 1. The table's own rule says what to do about that -- "A row is removed when its mechanism's fix lands: the case then passes on the add-on path (UNEXPECTED-PASS)" -- so the row goes, with the measurement recorded in its place. Measured at the current pin, built fresh, run with no device (the configuration this file's no-device branch describes): before: host: 76 passed, 0 failed, 22 known-fail, 1 unexpected-pass, 99 total rc 1 after: host: 77 passed, 0 failed, 22 known-fail, 0 unexpected-pass, 99 total rc 0 What made it visible: nothing in CI selects these rows (`LABELS "hrx"` vs the workflows' `ctest -L main`, and this target had not even compiled since #438 until #468), so the baseline drifted unwatched. That is engine#3129's thesis, and this is the one edit that makes the target green before anyone spends runner time gating it. Co-authored-by: pi-i679 <[email protected]>
Refs engine#3129.
tests/hrx-backend-test.cpphas not compiled since forka7fd21ac9(#438, engine#2861): the two-argumentmoe_router_descriptor_layout(int64_t, bool)arrived and this one call site kept the one-argument form. One line, and the reason it is worth its own PR rather than a rider on #467 is that the claim is different and separable: #467 is about the get_rows capacity class, this is a compile break, and a compile break should not live or die with another PR's fate.The break, at exactly the sha this branch is cut from (
9ad200545)and after this commit, same command, same tree:
-fsyntax-onlyis the honest unit for this: no device, no link, no ggml objects — it fails on the arity and nothing else, in about a second.Why
falseis the right consumer, read from the reference's own subjectThe header (pinned sha) states the rule the parameter exists for:
And the equivalence is total, which is what closes the only semantic risk a one-line fix like this carries: the parent of
a7fd21ac9(the last tree where this compiled) hadso with
falsethe two-argument function is the same function for everyexpert_count— not merely for the fixture sizes the suite uses.git show --stat a7fd21ac9also shows how the call site was missed rather than changed: the header, the router andtests/test-hrx-moe-routing-layout.cppwere updated,tests/hrx-backend-test.cppwas not touched at all.This call site builds
make_qwen_partition_table_reference— the table a qwen routed kernel decodes — so the consumer does not read the common layout, and the function returns127/7/13at ≤ 128 experts and the common layout above that whatever is passed. The case's own expectation, written out on purpose rather than read from this function (:8574, "so a wrong layout cannot pass by agreeing with itself"), says exactlycompact = expected_expert_count <= 128→127/7/13/128, else511/9/15/512. So the fix does not move the expectation; it makes the reference agree with it again.Swept for the same class: this is the only stale call site
Both production call sites pass the flag, and the layout self-test exercises both values, so the two-argument form is in use and this was the single straggler.
Not claimed
host: 1 passed, 0 failedwith the device half skipping — that is their measurement, not mine, and I am crediting it rather than restating it as verified here.engine#3129stays open for that and for the reason the break was invisible (a gate does attempt this build —hrx-build.yml's blanketcmake --build "$fork"with-k 0, whose rc is swallowed — and thefork_ctest_known_failbaseline carrieshrx-backend-test # Failed, which absorbs the newNot Runbecausectest_known_fail.pykeys the baseline by name and never compares the recorded reason).One line plus a four-line comment, no other file touched.