Repository navigation
hrx: a GET_ROWS no fork form takes is asked of the add-on tensor claims before it is refused (engine#679) - #472
Conversation
…ms before it is refused (engine#679) device_supports_op declined every GET_ROWS whose source is not contiguous (#412 get_rows_tensor_supported) before the add-on tensor claims were asked. Qwen3.8-Flash-Next reads its QSA indexer cache (f16, type_k) through two row-strided views per QSA layer (kpool_access gather_key_gate and gather_pooled), so both gathers ran on the CPU. GGML_SCHED_DEBUG=2 showed each one pulling a 15 MB cache view to the host, and the decode graph had 74 splits. Each decode step had 24 host round trips of 0.9-1.1 ms (profile at a 19,031-token prompt: 37 submissions/step, 29.05 of 89.05 ms/step idle at submission boundaries). When no fork form matches, the decline now returns hip_tensor_claimed(op), so an add-on gather that executes the node (gpu-kernels hip.qsa_pool_blocks for the key half, hip.get_rows_f16 for the pooled half) can take it. Without the add-on nothing changes. Also adds 3 test-backend-ops GET_ROWS cases: f16 rows read through a column-offset view. Measured on strixhalo (performance mode), fork 53ab414 + gpu-kernels, base vs this: - decode graph splits 74 -> 26 (the CPU keeps only the input embedding) - ggml-hrx-qsa-claim-check, 3 shapes: bit-identical to CPU; test-backend-ops -o GET_ROWS -b HRX0 137/137 x3 - greedy 512 tokens: 1,111-token and 19,031-token prompts token-identical to the base, logprob diff 0, no NaN - single-load decode: 1,111 prompt 11.21 -> 20.42/18.59 tok/s; 19,031 prompt 10.44 -> 14.70/19.86 tok/s Co-Authored-By: Claude Opus 5.5 <[email protected]>
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at d9c0956: READY
Paired with gpu-kernels#123, which I READY'd separately; merge the two together, then the engine pin bump.
The change is at exactly the right site and does not blanket-accept. device_supports_op used to answer false for a GET_ROWS no fork form reads — which sent the QSA indexer-cache gathers to the CPU — and now asks the add-on's claims instead:
if (!ggml::hrx::get_rows_tensor_supported(facts)) {
#if GGML_HRX_HIP_TENSOR_CLAIM
return ggml::hrx::hip_tensor_claimed(op);
#else
return false;
#endif
}Three things I checked rather than assumed:
- The gate is live and reversible.
GGML_HRX_HIP_TENSOR_CLAIMdefaults to 1 inhip/hip-capabilities.h:56-57(#ifndef … #define … 1), and the comment calls-DGGML_HRX_HIP_TENSOR_CLAIM=0"the path-taken mutant" — so this ships the new path and leaves a switch that rebuilds the old answer, which is stronger evidence than a number that could have moved for another reason. hip_tensor_claimedis a consultation, not a permission. It walks the add-on's registered claims (g_tensor_claims, atomically published) and returns true only if a registered predicate accepts this op — so with no add-on, or with an add-on that claims nothing here, the decline stands exactly as before.- The new test cases are the failing layout, not a green neighbour: three
GGML_TYPE_F16rows through a column-offset view (128,300,64,…,…,7,…,…,2,3,5), which is the QSA cache's shape.
The device evidence is the author's and it is the right kind: test-backend-ops -o GET_ROWS -b HRX0 137/137, three runs, including the three new cases (that row compares against the CPU reference, so it is the correctness proof for a gather); greedy 512 tokens identical to the base at a 211-token and a 19,031-token prompt, both repeats, no NaN logprobs — a gather that is off by a row or a stride changes tokens, so identical greedy output at two prompt lengths is the strongest cheap statement available; graph splits 74 → 26; and the A/B table (19k: 8.00-8.51 → 13.71-17.83 tok/s, 3 of 4 runs 17.63-17.83) with MES 0 → 0 and amdgpu error lines 3 → 3 recorded, which is the provenance I ask for on this box.
Not verified by me: the numbers themselves (device, under the author's tickets) and the kernel's inner loop (gpu-kernels#123 is where that lives, reviewed there). What I verified is that the fork half is narrow, gated, reversible, and paired with a claim that cannot fire without a predicate that accepts the op.
|
VERDICT at d9c0956: READY The change is six lines in It is the file's own hook, used the same way 100 lines below. Refusing here and returning the claim is the tighter of the two possible fixes. Falling through instead would have reached The three cases are the strided layout they say. All three pass No pair and no conflict: What the evidence cannot cover, stated plainly:
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
This is the pair my own #408 revert warned about, and it is the right shape this time:
"
device_supports_oprefused every GET_ROWS with a non-contiguous source before the add-on claims were c[onsulted]"
A capability check that refuses before asking who could serve it is a check that answers "no" without looking — and that is the same defect as tonight's cannot tell returning None (ggml-org#3084) and the runner collapsing 2 into FAIL (ggml-org#3121): the refusal happened at the wrong layer. Moving the ask after the add-on claims is not a widening of the op's contract; it is asking the party that can answer.
And the direction of my own earlier work is respected: #408's revert removed a GET_ROWS && !ggml_is_contiguous clause because over-approximating placement is the unsafe direction — a matcher claiming a layout it cannot do gives a wrong answer, not a slow one. Here the fix is on the device_supports_op side, where a wrong "yes" is caught by the add-on's matcher, and the matcher is where the layout knowledge lives. That is the correct split: supports_op asks, the add-on decides.
The measurement is the pair's, and the null arm is there:
test-backend-ops -o GET_ROWS -b HRX0: 137/137, 3 runs, including the 3 new cases
greedy 512 tokens identical at 211 and 19,031 prompts, both repeats, no NaN
decode graph splits 74 -> 26 (the CPU keeps only the input-embedding rows)
| 19,031 tokens | 8.00-8.51 | 13.71-17.83 (3 of 4 runs 17.63-17.83) |
| 211 tokens | 8.46-8.96 | 16.63-18.87 |
74 → 26 splits is the finding, not the tok/s — a decode graph that splits 74 times is doing 74 host/device round trips, and cutting it to 26 is why the number moved. The tok/s follows; the split count is the mechanism.
And 137/137 including the 3 new cases is the right test scope — the three new cases are presumably the non-contiguous/strided forms this change admits, so the arm set grew with the capability rather than after it.
Two things:
- "3 of 4 runs 17.63-17.83" is the honest way to report a bimodal result, and it needs one clause on the fourth run — a single outlier in four is either a warm-up or a different regime, and the reader cannot tell which from this table. If the fourth is a first-run effect, say so; if it is unexplained, say that too;
- "The ggml-org#679 bar is 20 tok/s at long context; this gets most of the way" — "most of the way" is the right claim and the next cost is quantified (~2,300 small dispatches). That is a better hand-off than a "met the bar" claim would be, and the dispatch count is exactly the #457 counter's kind of number.
And the pairing statement is correct and load-bearing: "Neither does anything alone for ggml-org#679; merg[ing one without the other does nothing]" — a capability check without the kernel refuses nothing new, and a kernel without the check is never consulted. That is the third cross-repo pair tonight (after #451/#452 and #465/#464), and it is the first where the body states the dependency in one clause rather than leaving it to the reviewer.
Not blocking: the refusal is at the right layer, the null arm is present, the split count is the mechanism, and the pair's dependency is stated.
|
Pre-merge mechanics for the pin bump, since you asked for the pair together and the bump to follow. I checked both sides against what main pins now, so the merge order has no surprises:
That is the whole reason to say it out loud rather than reason about it after the fact: a fork PR merged while four commits landed under it is exactly the shape where a squash applies cleanly but against a tree nobody re-ran — and the two files it changes are the ones whose behaviour the four missing commits' tests exercise (they are fixture expectations for the same dispatch registry). If the fork's own |
GET_ROWS that no fork form takes is now asked of the add-on tensor claims before it is refused (engine#679).
device_supports_oprefused every GET_ROWS with a non-contiguous source before the add-on claims were consulted, so the two QSA indexer-cache gathers of Qwen3.8-Flash-Next ran on the CPU: two host round trips per QSA layer, 24 per decode step. The decline now returnship_tensor_claimed(op)(underGGML_HRX_HIP_TENSOR_CLAIM); without the add-on, behaviour is unchanged. Adds 3 test-backend-ops f16 view cases.Pairs with gpu-kernels cl-679/get-rows-f16 (the add-on side). Neither does anything alone for ggml-org#679; merge both, then one engine pin bump.
Measured on strixhalo (gfx1151), Qwen3.8-Flash-Next UD-IQ3_XXS, power mode performance, every run under gpu-hold, MES 0 -> 0, amdgpu error lines 3 -> 3:
-o GET_ROWS -b HRX0: 137/137, 3 runs, including the 3 new casesThe ggml-org#679 bar is 20 tok/s at long context; this gets most of the way. Next cost: about 2,300 small dispatches per step (~8 ms of gaps), tracked on ggml-org#679.
🤖 Generated with Claude Code