Repository navigation
tests: Flash-Next routed experts at the file's 512 experts (engine #572) - #329
Conversation
…ml-org#572) The #281 routed cases use 16 experts (50-320 routed rows per expert), so they never reach the small-row regime of the real model: 10 routes over 512 experts is ~1.6 / 10 / 40 rows per expert at 80 / 512 / 2048 tokens. Adds, at 512 experts and those token counts: - eval: gate/up + SwiGLU for IQ4_XS (UD-IQ4_XS) and IQ2_S (UD-IQ3_XXS), and the 640 -> 2560 down MUL_MAT_ID for IQ4_NL and Q5_0; - perf: the same down MUL_MAT_ID cases. These cover the gpu-kernels routed-expert tile fit (IQ4_XS / Q5_0 on the HIP prefill GEMM, 8-wave down and IQ2_S widths). On HRX0 vs CPU, two rounds each of default, GGML_HRX_HIP_MMID_TILE_FIT=0 and GGML_HRX_HIP_MMID_IQ4XS_Q5_0=0: MUL_MAT_ID 6/6 and MUL_MAT_VEC_FUSION 6/6 every run (performance mode). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
ready for review at a8d82a4 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY -- the cases the existing arms structurally cannot reach, which is the whole point of them
The value here is not "more coverage", it is coverage of a region the existing arms cannot reach: with 16 experts and 10 routes you get 50-320 rows per expert, and the new tiles in gpu-kernels#67 only engage at a few routed rows per expert. At the file's real 512 experts with 10 routes, 80 / 512 / 2048 tokens gives about 1.6 / 10 / 40 rows per expert -- the small-row tiles become selectable, and test-backend-ops -o MUL_MAT_ID then diffs them against the CPU reference.
The type set matches the kernel PR exactly: gate/up IQ4_XS (UD-IQ4_XS) and IQ2_S (UD-IQ3_XXS), down IQ4_NL (both files) and Q5_0 (UD-IQ4_XS), 640 -> 2560 with one input row per route. So the shapes and the formats line up with what hrx_prefill_gemm now claims, which is the only thing that makes a shape-fitted tile testable at all.
One note, and it is the same one I put on #67: this file is that PR's only correctness evidence, and it lives in a different repository. Naming the pair in both bodies (and merging them together) is what stops a window where the new formats run with no arm that reaches them.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at a8d82a4
The test is fine and the registry change is the more valuable half -- a switch that looks like one thing and does another, announced once at the point it is used.
The case shapes are the right ones and the reasoning is in the body: Flash-Next's real expert count is 512 with 10 routes, and "the existing 16-expert cases put 50-320 rows on each expert. At 512 experts each expert gets ~1.6 / 10 / 40 row[s]" --
i.e. the existing cases exercise a distribution the real model never has, and at 512 experts the per-expert row count falls to what a batch actually delivers. That is the difference between a test that covers a shape and a test that covers the shape.
And the registry change is the finding worth keeping:
"The bare word
"fused"is not a substring here: it is special-cased below to skip EVERY registration whose kind isDispatchMatchKind::Fused, which is a large fraction of this backend (engine#2146 counted the fallout). That
difference is invisible from the command line … measured on LFM2.5-1.2B,=fusedturned a coherent completion into fragments with no error, which is how it was read as a kernel defect twice."
A category-wide disable that changes the answer without failing a node is the worst kind of switch: it looks like a per-name filter, it is documented as one, and it silently turns a model into fragments. The fix is a one-time
announcement at the point of use plus naming the one-registration form -- which is the right amount of intervention: it does not remove the switch (a test may need it), it makes using it a decision rather than an accident.
"read as a kernel defect twice" is the sentence that earns the change: two engineers went looking in the kernels because the switch said fused and meant "everything fused".
One note: the announcement goes to stderr once. A test that captures stdout for comparison will see it once mid-run; worth a line in the body saying so, since a golden-output test that starts asserting on stderr would fail for a reason unrelated to its
subject.
Not run: the new cases on a device (needs GGML_HRX=ON and an IQ4_XS/IQ2_S/IQ4_NL/Q5_0 head) -- the change is a test table plus a diagnostic.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at a8d82a4: READY
The justification is measured, not asserted, and it is the reason this is worth a test-only PR: the cases that already existed could not select the path. In the file's own words — "16-expert cases above (50-320 rows per expert) never select". At 16 experts with 10 routes, every expert gets 50–320 rows and the fused narrow kernel is not chosen; at 512 experts / 10 routes each expert gets roughly 1.6 / 10 / 40 rows, which is the regime where it is. So a regression in the fused gate/up path had no test that could reach it, and the old cases passing said nothing about it.
Three details make the new arms trustworthy rather than merely present:
- the arithmetic is in the comment — "512 tokens x 10 routes is 160 partitions of 32 routed rows, and 80 tokens is 25, the last one partial" — so the non-divisible boundary is a deliberate case, not an accident of a round number;
- the 16-expert variant is kept alongside (
true, 16, 10, …) so the two regimes stay comparable, and the new one is not a replacement that loses the old coverage; - the eval/perf split is deliberate: eval covers gate/up + swiglu for the two IQ4_XS/IQ2_S forms and down (
MUL_MAT_ID, 640 → 2560) for IQ4_NL and Q5_0 with one input row per route, and perf covers the two down formats. A fused path that is numerically right but slower, or fast but wrong, fails a different arm.
fp_to_str is not cosmetic, and the comment says why: "%f: the std::to_string format for floating point before C++26." C++26 changes how std::to_string formats floating point, so a test whose name is built from a float parameter would silently rename itself on a compiler or standard-library bump — taking any baseline, filter or -o match keyed on that name with it. Spelling %f explicitly pins the names. That is a two-line change now against a confusing day later, and it is exactly the sort of thing a test-only PR is the right place for.
This is ggml-org#572's unparked correctness arm, and it does the thing that work needs: a case at the file's real expert count, chosen because the existing count could not exercise the kernel, with correctness and speed kept as separate arms.
Refs 1bit-MONSTER/engine#572. Test-only.
test-backend-opsgains the Flash-Next routed shapes at the file's real expert count: 512 experts, 10 routes, 80 / 512 / 2048 tokens.MUL_MAT_VEC_FUSION) for IQ4_XS and IQ2_S; down (MUL_MAT_ID, 640 → 2560) for IQ4_NL and Q5_0.The existing 16-expert cases put 50-320 rows on each expert. At 512 experts each expert gets ~1.6 / 10 / 40 rows, which reaches selection paths the old cases never exercised.
On HRX0 against the CPU: MUL_MAT_ID 6/6 and MUL_MAT_VEC_FUSION 6/6, both with the HRX defaults and with
GGML_HRX_HIP_MMID_TILE_FIT=0 GGML_HRX_HIP_MMID_IQ4XS_Q5_0=0. The dispatch log shows each arm takes a different kernel for IQ4_XS and Q5_0. The backend change these cases cover is in the kernel add-on, in 1bit-MONSTER/gpu-kernels#67.🤖 Generated with Claude Code