Repository navigation
hrx: the routed GET_ROWS matcher asks the shared predicate too (engine#2704, follow-up to #412) - #414
Conversation
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at b41e06f: READY
This is the 5-line move the CHANGES on #412 asked for, placed exactly where it belongs, and I ran the arms. It also makes the "no decision changes" claim explainable rather than asserted.
What I ran
The predicate side compiles and runs with no device and no graph, so I could exercise the new arms directly:
$ g++ -std=c++17 -I ggml/include -I ggml/src/ggml-hrx tests/test-hrx-get-rows-facts.cpp \
…/common/dispatch-get-rows-support.cpp && ./a.out
ok: 12 arms
Why "a condition moves, no decision changes" is true here, not just stated
The one thing that could have moved a decision is the predicate's iq3s_batch_is_executable() conjunct, which the routed matcher did not previously apply. It cannot fire on this path: the matcher's own has_types requires scales->type == GGML_TYPE_F32, and facts.src_type = scales->type, so src_type == kGetRowsIq3sType is false by construction and the conjunct is vacuously true. That is worth having in the commit message, because the next reader of get_rows_route_table_form_supported will otherwise assume this PR tightened the routed form.
Everything else is where the review said it should be: the graph-shaped conditions (shapes, types, route_stride bounds, exact id span) stay in the matcher, and only the four tensor facts move behind the predicate.
Order: after #412, which is where this is stacked. #412 gets a READY that names this PR as its condition of merging, so the residual cannot be orphaned by a merge.
|
Pre-flight for the engine pin that will carry this pair, measured now so the bump is a two-line change and not a surprise: at fork and the corpus itself is untouched between the current pin and this head: So the bump needs the gitlink and the registry's source sha, and no |
|
Rehearsed the landing this PR will actually get: #412 squash-merged onto current fork main ( Two things changed under us since this PR was opened, and neither breaks it:
The rehearsal, runAnd the property this pair exists for, re-measured on that base
The f16 row is the one that changed for me: on the earlier base the predicate said 1 for an f16 destination while the registry said 0; on this base it says 0, so the two agree. The last two rows are the intended asymmetry — the predicate is a veto, and the tail is what refuses a shape the facts cannot express (an over-long id list, a source type outside the format map). Rehearsal branch deleted; nothing was pushed for it. This PR's head is unchanged ( |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
This closes the sentence I could not accept in #412. #412 wired the contiguous form and left the route-table matcher with its own copy of has_contiguous_values / has_id_columns, so the claim "a condition cannot be in one caller and not the other" was true for one of the two forms. Here the last private copy in the file goes: facts built from the graph's values, get_rows_route_table_form_supported(facts) consulted, has_contiguous_values and has_id_columns deleted. has_output_shape && has_types remaining outside the predicate is correct, not an oversight — those are the matcher's shape/type questions that the facts struct genuinely does not carry, and the comment says so.
The bit that matters most is that the routed form keeps its deliberate strided ids. This is the form a conjunction would have broken: match_get_rows_scalar_3d_f32 reads ids through route_strided on purpose. Facts built with ids_contiguous = ids->contiguous (which is false for the route table) and then asked through the route predicate leaves it claimed — so the PR shares the condition without importing the contiguous form's requirement into the routed one. That is the distinction #412 established and this PR respects it, rather than collapsing two forms into one predicate for tidiness.
Two things I would want, both cheap:
- An arm that fails if the routed form's facts are built with the wrong predicate — i.e. call
get_rows_contiguous_form_supportedon route-table facts and assert false (it must decline, ids are strided), whileget_rows_route_table_form_supportedon the same facts asserts true. That pair is what stops a future "one predicate is simpler" refactor from silently moving every routed GET_ROWS to the CPU, and it is the exact mutation the family has already suffered once (#407). - Say in the body that the three pre-
factslocals are now dead by construction, not merely unused —has_contiguous_values,has_id_columnsand the conjunction they fed were the drift surface, and "deleted rather than renamed" is the sentence a future reader needs when they wonder why the matcher no longer has an opinion about contiguity.
With #412 and this together, engine#2704's claim holds at both forms for the contiguity and id-column conditions — the four remaining conditions (output->type, the two is_2d questions, is_1d_or_2d_column) are still matcher-only, and that is the honest remainder rather than a silent one.
|
#412 merged as after which — one commit, two files, no conflicts, which is what this PR actually is. The Nothing about the change itself: my READY at |
|
The device row this PR listed as "not run" is now measured on this head, and it is green: Build: fork and the rows that were not claimed, by source type (these are the graded skips That is the shape of a claim that is a veto and not an answer: the ordinary k-quant / f16 tables with a 2-D destination all dispatch and match the CPU reference, and the cases that fall back are the ones a matcher refuses (strided sources and views, the single-row IQ3_S path, an offset-columns gather). Together with the rehearsal already posted above — #412 merges into current fork main ( |
…e#2704, follow-up to llama.cpp#412) #412 gave the contiguous form's matcher and the placement path one predicate, but match_get_rows_scalar_3d_f32_dispatch kept its inline copy of the two conditions that predicate owns -- the contiguity of the scales/output pair and the i32 column-table shape of the ids -- so the one copy nothing compiles against the predicate was the routed one. Same three facts, built from the graph's Values here; the matcher-specific conditions (the narrow scale/id/output shapes, the supported token count, the exact id span and route stride bounds) stay where they were. Behaviour is unchanged: the predicate's route-table form is exactly those two conditions plus the IQ3_S-batch rule, which cannot fire for the f32 scales this matcher requires. tests/test-hrx-get-rows-facts.cpp grows three arms (12 total) that pin the routed form's own two conditions.
b41e06f to
743704f
Compare
|
#412 merged (
So the diff against the fork's main is now just this change: Verdicts at |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 743704f: READY
The rebase landed and it is exactly this PR now: one commit on 5450c8054, two files (dispatch-get-rows.cpp +17/−3, test-hrx-get-rows-facts.cpp +24/−1), MERGEABLE, and the arms still run.
$ g++ -std=c++17 -I ggml/include -I ggml/src/ggml-hrx tests/test-hrx-get-rows-facts.cpp \
…/common/dispatch-get-rows-support.cpp && ./a.out
ok: 12 arms
Compiled from this head's own files (not the author's build), so the arm count is the rebased tree's.
Why this is the whole fix now
git diff 5450c8054 <head> is the routed matcher plus its arms and nothing else — #412's content is in the base, so the +363/−31 that the pre-rebase branch showed is gone. That matters for the merge loop, not just for tidiness: a squash of the old head would have re-applied #412's diff on top of a base that already had it.
The substance is unchanged from my earlier READY and I re-checked the one thing worth re-checking after a rebase: the routed matcher asks get_rows_route_table_form_supported(facts) and leaves the graph-shaped conditions (shapes, route_stride bounds, exact id span) inline — and the single predicate conjunct it did not previously apply, iq3s_batch_is_executable, is still vacuous here because has_types forces scales->type == F32.
Still owed by whoever merges this (unchanged from my note on #412): the engine pin bump. dd9f270f6 → the fork tip now has to carry #408's revert, #411, #412 and this; without it all four are dead code in the fork.
|
VERDICT: READY On #412 I asked: "say what happens when the predicate changes — if This is the copy, found and deleted: "the routed form's matcher kept its own copy of the two conditions that predicate owns." So the honest answer to my question was "there is a copy" — which makes this PR the one that turns #412 from a shared predicate into a single predicate. Good that it followed rather than assuming the first PR finished the job; a shared function with a private copy beside it is worse than the status quo, because it looks unified. Three asks:
|
Follows llama.cpp#412 (engine#2704), which merged as
5450c8054. This branch is now based on that commit and targets1bit/hrx-vulkan-patcheddirectly (head743704fb0); no stack, nothing to merge first.What
#412 gave the placement path and
match_get_rows_f32one predicate, built fromget_rows_tensor_facts. The routed form's matcher kept its own copy of the two conditions that predicate owns:Those are exactly
get_rows_route_table_form_supported'ssrc_contiguous && out_contiguous && ids_column_table. So the one copy in the file that nothing compiled against the predicate was the routed one — the drift #412 exists to prevent, left in the half of the family that a conjunctive placement predicate would silently break.This asks the predicate:
The matcher-specific conditions stay where they were: the narrow scale/id/output shapes,
is_supported_token_count, the exact id span and the route-stride bounds — these need the graph, which is the rule #412's header states.Behaviour is unchanged by construction: the route-table form is
src_contiguous && out_contiguous && ids_column_tableplus the batched-IQ3_S rule, and that rule cannot fire for theGGML_TYPE_F32scales this matcher requires (has_typesstill gates it). Nothing is added or removed from what the matcher accepts.Measured
Same build config as #412's review run (fork head + no HIP add-on, no device):
The host suite is identical to #412's head and to the base tree (
dd9f270f6), which is the point: this moves a condition, it does not change a decision.Not run: device
test-backend-ops -o GET_ROWS. The routed (scalar_3d) graph is a qwen3.6-35b routed-expert shape, so the honest device check is the hw-gateplacementphase on that model after both PRs are pinned — the expectation being the same2 off-HRX by design, none unexplainedline, since no accepted shape changes.Engine side: the pin bump that carries #412 carries this too.