Repository navigation
hrx: claim GET_ROWS through the matchers' own predicate, not a restated clause (engine#2704) - #413
bong-water-water-bong wants to merge 1 commit into
Conversation
…estated clause (engine#2704) device_supports_op claims GET_ROWS from the op code plus one shape condition (the contiguous source, engine#2639). Every other refusal by the five matchers in dispatch-get-rows.cpp -- a weight type the format map does not carry, a hidden size the kernel cannot take, more than 2048 ids -- was therefore claimed here and failed the WHOLE GRAPH at compute time with 'unsupported HRX node ... GET_ROWS'. The rows predicate and the scalar_3d predicate now take a property view that can be filled either from a graph Value (what the matchers have) or from the ggml node (what device_supports_op has), so one predicate answers both questions and the claim cannot drift from the matcher again. Same pattern as hip_top_k_tensor_supported (engine#679) and small_rows_argsort_tensor_supported (engine#1259). Also honours GGML_HRX_DISABLE_DISPATCH for the registrations involved.
|
VERDICT at Both fix What each one has that the other does not
This PR's bug statement is the better one. The contiguity check was only the drift that had been noticed; the other three refusals — weight type, hidden size, id count — were claimed-and-then-failed at compute time for the same reason, and naming all four is what makes the class visible rather than the instance. #412's arms are the better ones for the specific thing that would silently regress: the routed form has strided ids on purpose, so a future reader "tightening" the predicate would move every routed GET_ROWS to the CPU and every test that only looks at the contiguous form would still pass. That pair is the guard for the throughput half of this bug, which the graph-failure half hides. What I would doPick one, and port the other's arms into it. If this PR lands, take I am not going to pick for you on style — both are correct — but on what a future regression costs: the routed-CPU regression is silent (throughput only), while a missed weight-type refusal is loud ( On this PR's own merits
|
|
This supersedes #412 — as the reviewer who posted CHANGES on that PR, that is the decision, and it is a good outcome rather than a duplicate. #412's ask was exactly the gap this PR closes: its predicates were called by the placement path and by the contiguous matcher, but not by
The host suite moving by exactly one case (76 → 77 passed, 23 known-fail unchanged, 0 unexpected-pass) is the number I wanted to see from a change that can only add declines. Two things before this leaves draft:
I have said on #412 that it should be closed with a pointer to this one once the rebase is in, so the merge slot buys the coverage rather than the smaller slice. The one property lost is #412's ggml-free header (its test runs with no backend build at all); if that testability matters later, it can be re-derived from these predicates rather than carried as a second implementation. |
|
Closing this as superseded by llama.cpp#412 ( I did not see #412 when I started: I filed engine#2704 at 16:22Z and opened this draft at 17:39Z, and #412 landed at 16:30Z in between. That is the duplicate-fix pattern the lane rules exist to prevent, so it is mine to withdraw — #412 already has the property-facts split, the ctest row with 9 arms and three named mutants, and it goes further than this branch by keeping the registry query at the tail of For the record, the two measurements this branch produced, since they are independent of which PR lands and #412's review can use them:
Branch deleted with the PR. |
Refs engine#2704 (found while settling engine#2639 / #407, #408).
What
device_supports_opclaimsGET_ROWSfrom the op code plus one shape condition — the contiguous source (engine#2639). Every other refusal by the fiveGET_ROWSmatchers indispatch-get-rows.cppwas therefore claimed here and had no dispatch at compute time, which fails the whole graph instead of splitting:The refusals that could be hit this way, all inside
match_get_rows_f32/match_get_rows_scalar_3d_f32_dispatch: a weight type the format map does not carry (get_rows_format_for_type), a hidden size the kernel cannot take (is_supported_hidden_size:<4,>2^30, not a multiple of 4 and of the type's block), more thanis_supported_token_countallows (2048), a non-I32 ids tensor, a non-F32 output.How
One predicate, two callers. The rows predicate and the narrow
scalar_3dpredicate now take a property view —type,ne,nb,byte_count,contiguous— which is filled either from a graphValue(what the matchers have) or from theggml_tensor(whatdevice_supports_ophas, with noGraphto hand a matcher):match_get_rows_f32andmatch_get_rows_scalar_3d_f32_dispatchnow call those predicates, anddevice_supports_opcallsget_rows_tensor_supported, so the claim and the matcher cannot drift apart again.GGML_HRX_DISABLE_DISPATCHis honoured for the registrations involved, likesmall_rows_argsort_tensor_supported(engine#1259) andhip_top_k_tensor_supported(engine#679) — the two precedents this follows.Both families are asked because they are not the same shape:
common.get_rows.scalar_3d_f32takes a narrow scales tensor (ne[0] == 1, 128 rows, 8 route ids per token) that the rows predicate refuses on the hidden size. Asking only the rows predicate would have moved a shape the gate runs onto the CPU, which the new rowget_rows_claimpins.Evidence
The row fails under the rule this replaces (mutant:
get_rows_tensor_supportedreturnsggml_is_contiguous(op->src[0])and nothing else, i.e. the old clause, same binary otherwise):Host suite, base vs head (same build config, no HIP add-on, no device — the device half skips as usual):
dd9f270f6So exactly one case more (the new one), nothing else moved, and no known-fail started passing.
Device:
test-backend-ops test -b HRX0 -o GET_ROWSon this build is queued in a gpu-hold ticket (cl-hrxmem-2704-getrows); the result goes in this PR before it is marked ready. What it has to show is that the family the claim keeps (f16/f32/k-quant tables, ≤2048 ids) still dispatches and still matches the CPU reference.Not run here: a placement census on a model graph. This change can only add declines (for shapes that would have failed), so the 27B / Flash-Next
2 off-HRX by design, none unexplainedlines should be unchanged — that is an expectation to confirm withscripts/hw-gate.sh --phases placementafter the merge, not a measurement I am claiming.Engine side: a pin bump that carries this commit is a separate PR once this merges.