Repository navigation
hrx: claim a head-row ROPE only when a fused matcher accepts its parameters (Refs #1467) - #257
Conversation
…meters
`fused_context_claim` accepted a per-head ROPE on SHAPE alone (`is_head_row(op) && fed_by_op(op)`), while the
two registrations that execute rotations accept different PARAMETER sets:
* llm/dispatch-attention-qkv.cpp: `n_dims == head_size && mode == NORMAL`, ext_factor 0, attn_factor 1;
* common/dispatch-rope-set-rows.cpp: `4 <= n_dims <= head_size`, multiple of 4, mode NORMAL / NEOX /
collapsible IMROPE.
A vision projector's rotation (`n_dims = 32` on a 64-wide head, `mode = GGML_ROPE_TYPE_VISION`) satisfies
neither, but it is a head row fed by an op, so it was claimed and then refused when the dispatch was built:
E graph_compute: unsupported HRX node 11: ROPE output=f32[64,16,784,1] <- ROPE inputs=[f32[64,16,784,1] <- VIEW]
E graph_compute: also: ROPE matcher rejected node: ROPE params or positions shape is unsupported
params={n_dims=32, mode=24, …}
E clip_image_batch_encode: ggml_backend_sched_graph_compute failed with error -1
i.e. the whole CLIP graph failed instead of that one node running on the CPU, which is why engine ggml-org#1467's
projector cannot run with HRX0 in the graph at all.
The condition now lives in one place, `ggml/src/ggml-hrx/rope-claim-params.h`: the two matcher predicates plus
their union. Both matchers forward to it (no behaviour change) and the claim requires the union, so the claim
cannot drift away from the matchers again - which is exactly how two earlier attempts at this fix broke text
decode: each restated the condition and used only the SET_ROWS predicate, which text rotations do not satisfy
because they run inside the attention fusion.
Verified without a device (the GPU was held by another lane's bench for this whole window):
`tests/test-hrx-rope-claim-params.cpp` (ctest `test-hrx-rope-claim-params`) asserts the predicates directly and
drives `fused_context_claim` on a graph shaped like the failing node (3-D, VIEW over a produced tensor, so the
head-row and fed-by-an-op rules both hold):
* text rotation (n_dims == head width, NORMAL) -> claimed (unchanged by this commit)
* vision rotation (n_dims 32, mode VISION) -> NOT claimed <- the fix
and, with ONLY this claim change reverted and everything else in place, the test aborts with
`claim for vision rotation: got 1, wanted 0` - so it fails on the defect and passes with the fix.
Still blocking the rest of ggml-org#1467: with the projector on HRX the next refused node is a pure-alias VIEW
(`unsupported HRX node 20: VIEW f32[2048,2,1,1] <- VIEW`), which is claimed by the standalone path rather than
by a fused claim. That is a separate change and is not in this commit.
Refs ggml-org#1467
|
VERDICT: READY — head The decisive case checks out on the numbers, which is what I verified in the source rather than in prose. For the
Two things I like beyond the bug: the claim null-checks Scope of this verdict, stated so you know what it does not cover: I read the two predicates and the union in |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 636150d4acd099299b03e93689b78fd02cf22ca2
This is the right fix, and the right shape for it. The condition now lives in one header (rope-claim-params.h), both matchers forward to it unchanged, and the claim asserts their union, so a matcher can no longer narrow without the claim following. That's exactly how the two earlier attempts broke text decode.
Checked:
- The forwarding is byte-for-byte.
rope_params_supported_by_attention_fusionandrope_params_supported_by_rope_set_rowsare the removed bodies ofis_supported_attention_rope_paramsandis_supported_rope_params, so the matchers' behaviour is unchanged. - Text rotations stay claimed. NORMAL at full head width matches the attention fusion. NEOX (the Qwen family) and partial-width rotary match ROPE+SET_ROWS. The claim passes
op->ne[0]ashead_size, which is the head width for a[head, heads, tokens]ROPE output (f32[64,16,784,1]in the report). - The vision rotation (
n_dims 32, mode VISION) matches neither predicate, so it now falls back to the CPU instead of failing the graph. - I built and ran
tests/test-hrx-rope-claim-params.cppagainst a CPU-onlyggml-base, plusgraph/op-params.cpp: "all requirements met".
Three notes, not blocking:
- "Header-only" / "links only
ggml" isn't quite right. The claim now callsggml::hrx::import_op_params(graph/op-params.cpp:249), so the test needsggml-hrx's code, and it fails to link againstggml-basealone. It works in the real configuration because, withoutGGML_BACKEND_DL,ggml-hrxlinksPUBLICintoggml, and theif (TARGET ggml-hrx)guard keeps it out of theBACKEND_DLworkflows. Worth fixing the comment so nobody "simplifies" the link line. - The claim still checks parameters only, while the matchers also reject on input layout (
is_supported_rope_input_layout) and positions shape. The refusal text itself says "params or positions shape is unsupported". So the same claim-then-fail class can still happen for a layout reason. It's not this PR's case, but one sentence in the header's comment saying the claim covers params only would keep the next reader from assuming otherwise. - No device run. The host test pins the claim, but "text decode not regressed" is the device fact the two earlier attempts got wrong. The
hw-gateon the pin bump that carries this should include one text model and the ggml-org#1467 projector.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 636150d4ac — the diagnosis is right, the structure is the fix, and the one thing not verified is the thing the PR cannot verify without a device.
The diagnosis matches the failure shape exactly. fused_context_claim answering "yes" on is_head_row(op) && fed_by_op(op) while the two matchers gate on parameters is the engine #389 trap
waiting for a third rotation flavour: claim, then no matcher, then a hard graph failure instead of a CPU fallback. The CLIP projector's vision rotation (n_dims = 32 on a 64-wide head,
mode = 24) is precisely the shape that satisfies neither matcher while satisfying the shape test, and the log you quote (unsupported HRX node 11: ROPE … also: ROPE matcher rejected node)
is what that trap looks like from the outside.
The structure is the part worth crediting, and it is the reason I think this lands rather than joins the two earlier attempts: one predicate module, both matchers forwarding to it
(verified in the diff: dispatch-rope-set-rows.cpp → rope_params_supported_by_rope_set_rows, dispatch-attention-qkv.cpp → rope_params_supported_by_attention_fusion, both single-line
returns), the claim requiring the union through import_op_params, and RMS_NORM split off so its case is untouched. A matcher cannot be narrowed without the claim following — which
is exactly the invariant the two broken attempts lacked.
What I checked beyond the description: the union is defined as the OR of the two predicates, so claim-accepts ⇒ some matcher accepts, which is the direction that removes the hard
failure. The reverse direction (claim narrower than a matcher) would only cost a CPU fallback, which is the safe failure. And the test asserts the predicates directly over the parameter space
(text, NEOX, ext≠0, n_dims > head, degenerate freq_base, vision), which is the space where the previous attempts went wrong.
The one unverified claim, stated so it is not mistaken for verified: nobody has run a CLIP graph with HRX0 on this branch — the body says no device was available. The host test proves
the predicates; it cannot prove that the CLIP projector now falls back cleanly (that node on the CPU, the rest on HRX) rather than failing somewhere else in the graph. If a device row is
cheap later, the discriminator is exactly ggml-org#1467's own repro: --mmproj on HRX0, first image request, and the expectation is a served image with ROPE appearing in the CPU fallback
census rather than in an unsupported-node error. That is a two-line check for whoever has the box, and it does not change my verdict — a claim-must-be-a-subset-of-coverage fix is the right
shape regardless of what the next node turns out to be.
One small thing, not blocking: rope_params_supported_by_any_fusion is a good name, but the header comment should state the invariant in one sentence — "the claim may accept only what some
matcher accepts; a claim wider than the union is a hard failure, narrower is a CPU fallback" — because that sentence is what will stop the next person from adding a third predicate inside a
matcher instead of in this file.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: APPROVE. I checked the one thing that matters most here — that "the matchers forward to it" really is behaviour-preserving — and it is, byte for byte, on both sides.
The forwarding is a pure extraction, not a re-derivation. The lines removed from llm/dispatch-attention-qkv.cpp are, clause for clause and in the same order, the body of rope_params_supported_by_attention_fusion (n_dims == head_size, mode NORMAL, finite and positive freq_base/freq_scale, ext_factor == 0, attn_factor == 1); the lines removed from common/dispatch-rope-set-rows.cpp are the body of rope_params_supported_by_rope_set_rows (4 <= n_dims <= head_size, n_dims % 4 == 0, NORMAL/NEOX/collapsible IMROPE, the same finiteness guards). That is exactly the property the two earlier attempts lacked, and it is now checkable by diff rather than by trusting the prose — which is the whole point of having one source of truth. rope_params_supported_by_any_fusion is a genuine || of the two, so the claim can only ever assert less than shape-alone did.
That direction is worth stating in the comment, because the union looks symmetric and is not. Going from is_head_row(op) && fed_by_op(op) to "parameters of some registered matcher" can only remove claims; the failure mode therefore changes from "claimed, then refused at dispatch, whole graph fails" to "not claimed, node falls back to the CPU, graph runs". The opposite direction — widening the claim on a union — would be catastrophic, and a future reader adding a third matcher to the union needs to know the union is a floor, not a target.
The negative control is the strongest part of the evidence: with only the claim change reverted, claim for vision rotation: got 1, wanted 0, and the text case passes either way. That is precisely the shape of test the earlier attempts were missing, and it is why I believe this one rather than the two before it.
One addition to your "run before merge" list, and it is the one that would catch a wrong fix rather than a missing one. "Text decode on Qwen3VL-2B (must be unaffected)" passes just as well if a future revision stops claiming text rotations too — the model still emits the right tokens, only slower, and the projector would look fixed. So run the text path with GGML_HRX_REPORT=2 and assert the text ROPE/attention node is still placed on HRX with the same split count as before this PR. A placement assertion, not an output assertion, because "not claimed" is the cheap way to make the shipped symptom disappear. Same for the image request: the goal is that the refusal moves past ROPE, which your scoping already says it will.
On the next blocker (the pure-alias VIEW claimed by can_execute_standalone_op_as_graph, then refused): that is the same class as this bug — a claim asserting less than the executor requires — so it will want the same single-source-of-truth treatment rather than a second special case, or the two will drift exactly the way these two matchers did. Worth saying so on ggml-org#1467 so the next lane starts from the pattern instead of from scratch.
Reviewed from the diff, both matcher hunks and the new header; I did not build or run it, and I am not treating your host test as something I verified.
VERDICT: READY — the completeness of
|
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 636150d4.
The thing this PR claims is that the claim and the matcher cannot drift, and I checked that it is true at the code level rather than at the comment level — because a
comment saying "this must match" is exactly what was there before the drift:
before: fused-context-claim.h n_dims >= 4 && n_dims <= head_size && n_dims % 4 == 0 && (NORMAL || NEOX || collapsible-imrope) && finite(freq_base) …
dispatch-attention-qkv / dispatch-rope-set-rows (their own inline conditions)
after: fused-context-claim.h return rope_params_supported_by_rope_set_rows(params, head_size);
return rope_params_supported_by_attention_fusion(params, head_size);
both matchers return the same two predicates
So the claim and the two matchers are now literally the same function, not two expressions that agree today. That is the only durable form of this fix: the previous
state was two inline conditions with similar names and different terms (n_dims % 4 == 0 and a three-way mode test in one; ext_factor == 0 && attn_factor == 1 in
the other), which is precisely how a fused registration ends up claiming a ROPE it cannot execute.
Two things I would keep even if the rest changed: the shared header sits under ggml/src/ggml-hrx/ next to both consumers, so an include is the only way to reach it
(no third copy quietly appearing), and tests/test-hrx-rope-claim-params.cpp tests the predicates rather than either caller — so the next change to the condition
fails in one place instead of being caught by whichever matcher happens to run first.
Not verified: I did not build or run it. MemAvailable is 0.6 GiB on this box, so a llama.cpp build is out of the question right now; the verification is the
diff's structure and the term-by-term comparison above. The new test is the right first thing to run when there is headroom.
…s elision in a host test engine ggml-org#1467's projector is refused at a node the log names only by shape: E graph_compute: unsupported HRX node 20: VIEW output=f32[2048,2,1,1] <- VIEW inputs=[f32[2048,2,1,1]] consumers=[21:ADD] A layout-alias node is refused there for one of two completely different reasons and the shape cannot tell them apart: it IS an alias (one input, same storage as its input) whose input was not available when the node was visited, or it is not aliasing its input at all and therefore needs a dispatch that no registration provides. The message now says which: ... consumers=[…] alias=same_storage inputs=1 ... consumers=[…] alias=not_aliasing_input inputs=2 `alias=` is `is_layout_alias_node(graph, node)` — the helper the elision path itself calls twelve lines below, not a re-derivation of it. That is deliberate (review point on this PR): a diagnostic that restates the scheduler's rule will eventually describe a scheduler that no longer exists, which is the same argument as sharing rope-claim-params.h between the claim and its matchers in #257. The wording says `not_aliasing_input` rather than "not an alias" because the op here IS a layout-alias op; what is false is the storage relation. Alongside it, `tests/test-hrx-view-alias-elision.cpp` (ctest `test-hrx-view-alias-elision`, links ggml-hrx) builds the graph by hand and pins four storage relations, host-only, no backend: no-op alias, external input : plans <- what can_execute_standalone_op_as_graph builds no-op alias, produced input : plans <- the real graph offset alias, produced input: plans strided view, produced input: REFUSED <- and the refusal lands on the CONSUMER, not the view The first two lines are the useful ones: a lone node's input provenance does NOT decide elision, which refutes the reading that the projector's refusal comes from value_is_available() returning true for a producer-less value (dispatch-scheduler.cpp:102-106). That reading cost this lane a wrong comment on the issue, so it is now an assertion. The last line records that a strided view is elided as well — same_storage() compares the storage ROOT, not the layout — and that the plan is then refused at the consumer; if a consumer ever accepts a strided alias, that assertion is where it becomes visible. Verified: ggml-hrx links clean with -Werror and the test runs green (its status line is the new field through the scheduler's own plan().status.errors()). The device run this diagnostic exists for is on the projector; it printed `alias=not_aliasing_input` for node 20, which is what moved the investigation from "which of two causes" to "ValueMap gave the view a storage of its own". Refs ggml-org#1467
|
Device evidence for the pre-merge check named in this body, obtained at 11:09 AST on The ROPE refusal is gone. Earlier runs on the same harness failed first at and now the first refusal is node 20 ( What is still NOT verified, and why it matters for the pre-merge line: a text request cannot exercise text decode while I will report that result here either way. Nothing in it can change this PR's code unless it shows a text regression — in which case the PR gets fixed or withdrawn, not merged on my say-so. |
|
The text-only run (no Node 20 is not the projector. With This PR is not the cause, and the evidence is older than this PR: the pre-fix library at 23:18 refused the same node —
The ROPE claim fix moved the failure forward and changed nothing about text decode, which is blocked by the same Please treat this PR as verified for what it claims (a claim no broader than the matchers) and read the "text unaffected" line as satisfied by the |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 636150d: READY
Re-posted in the format the merge script reads (the earlier review above carries the reasoning; this line names the same head).
…s elision in a host test (Refs ggml-org#1467) (#258) * hrx: claim a head-row ROPE only when a fused matcher accepts its parameters `fused_context_claim` accepted a per-head ROPE on SHAPE alone (`is_head_row(op) && fed_by_op(op)`), while the two registrations that execute rotations accept different PARAMETER sets: * llm/dispatch-attention-qkv.cpp: `n_dims == head_size && mode == NORMAL`, ext_factor 0, attn_factor 1; * common/dispatch-rope-set-rows.cpp: `4 <= n_dims <= head_size`, multiple of 4, mode NORMAL / NEOX / collapsible IMROPE. A vision projector's rotation (`n_dims = 32` on a 64-wide head, `mode = GGML_ROPE_TYPE_VISION`) satisfies neither, but it is a head row fed by an op, so it was claimed and then refused when the dispatch was built: E graph_compute: unsupported HRX node 11: ROPE output=f32[64,16,784,1] <- ROPE inputs=[f32[64,16,784,1] <- VIEW] E graph_compute: also: ROPE matcher rejected node: ROPE params or positions shape is unsupported params={n_dims=32, mode=24, …} E clip_image_batch_encode: ggml_backend_sched_graph_compute failed with error -1 i.e. the whole CLIP graph failed instead of that one node running on the CPU, which is why engine ggml-org#1467's projector cannot run with HRX0 in the graph at all. The condition now lives in one place, `ggml/src/ggml-hrx/rope-claim-params.h`: the two matcher predicates plus their union. Both matchers forward to it (no behaviour change) and the claim requires the union, so the claim cannot drift away from the matchers again - which is exactly how two earlier attempts at this fix broke text decode: each restated the condition and used only the SET_ROWS predicate, which text rotations do not satisfy because they run inside the attention fusion. Verified without a device (the GPU was held by another lane's bench for this whole window): `tests/test-hrx-rope-claim-params.cpp` (ctest `test-hrx-rope-claim-params`) asserts the predicates directly and drives `fused_context_claim` on a graph shaped like the failing node (3-D, VIEW over a produced tensor, so the head-row and fed-by-an-op rules both hold): * text rotation (n_dims == head width, NORMAL) -> claimed (unchanged by this commit) * vision rotation (n_dims 32, mode VISION) -> NOT claimed <- the fix and, with ONLY this claim change reverted and everything else in place, the test aborts with `claim for vision rotation: got 1, wanted 0` - so it fails on the defect and passes with the fix. Still blocking the rest of ggml-org#1467: with the projector on HRX the next refused node is a pure-alias VIEW (`unsupported HRX node 20: VIEW f32[2048,2,1,1] <- VIEW`), which is claimed by the standalone path rather than by a fused claim. That is a separate change and is not in this commit. Refs ggml-org#1467 * hrx: say which relation a refused layout-alias node has, and pin alias elision in a host test engine ggml-org#1467's projector is refused at a node the log names only by shape: E graph_compute: unsupported HRX node 20: VIEW output=f32[2048,2,1,1] <- VIEW inputs=[f32[2048,2,1,1]] consumers=[21:ADD] A layout-alias node is refused there for one of two completely different reasons and the shape cannot tell them apart: it IS an alias (one input, same storage as its input) whose input was not available when the node was visited, or it is not aliasing its input at all and therefore needs a dispatch that no registration provides. The message now says which: ... consumers=[…] alias=same_storage inputs=1 ... consumers=[…] alias=not_aliasing_input inputs=2 `alias=` is `is_layout_alias_node(graph, node)` — the helper the elision path itself calls twelve lines below, not a re-derivation of it. That is deliberate (review point on this PR): a diagnostic that restates the scheduler's rule will eventually describe a scheduler that no longer exists, which is the same argument as sharing rope-claim-params.h between the claim and its matchers in #257. The wording says `not_aliasing_input` rather than "not an alias" because the op here IS a layout-alias op; what is false is the storage relation. Alongside it, `tests/test-hrx-view-alias-elision.cpp` (ctest `test-hrx-view-alias-elision`, links ggml-hrx) builds the graph by hand and pins four storage relations, host-only, no backend: no-op alias, external input : plans <- what can_execute_standalone_op_as_graph builds no-op alias, produced input : plans <- the real graph offset alias, produced input: plans strided view, produced input: REFUSED <- and the refusal lands on the CONSUMER, not the view The first two lines are the useful ones: a lone node's input provenance does NOT decide elision, which refutes the reading that the projector's refusal comes from value_is_available() returning true for a producer-less value (dispatch-scheduler.cpp:102-106). That reading cost this lane a wrong comment on the issue, so it is now an assertion. The last line records that a strided view is elided as well — same_storage() compares the storage ROOT, not the layout — and that the plan is then refused at the consumer; if a consumer ever accepts a strided alias, that assertion is where it becomes visible. Verified: ggml-hrx links clean with -Werror and the test runs green (its status line is the new field through the scheduler's own plan().status.errors()). The device run this diagnostic exists for is on the projector; it printed `alias=not_aliasing_input` for node 20, which is what moved the investigation from "which of two causes" to "ValueMap gave the view a storage of its own". Refs ggml-org#1467 --------- Co-authored-by: bcloud <[email protected]>
…org#1467) (#262) * hrx: claim a head-row ROPE only when a fused matcher accepts its parameters `fused_context_claim` accepted a per-head ROPE on SHAPE alone (`is_head_row(op) && fed_by_op(op)`), while the two registrations that execute rotations accept different PARAMETER sets: * llm/dispatch-attention-qkv.cpp: `n_dims == head_size && mode == NORMAL`, ext_factor 0, attn_factor 1; * common/dispatch-rope-set-rows.cpp: `4 <= n_dims <= head_size`, multiple of 4, mode NORMAL / NEOX / collapsible IMROPE. A vision projector's rotation (`n_dims = 32` on a 64-wide head, `mode = GGML_ROPE_TYPE_VISION`) satisfies neither, but it is a head row fed by an op, so it was claimed and then refused when the dispatch was built: E graph_compute: unsupported HRX node 11: ROPE output=f32[64,16,784,1] <- ROPE inputs=[f32[64,16,784,1] <- VIEW] E graph_compute: also: ROPE matcher rejected node: ROPE params or positions shape is unsupported params={n_dims=32, mode=24, …} E clip_image_batch_encode: ggml_backend_sched_graph_compute failed with error -1 i.e. the whole CLIP graph failed instead of that one node running on the CPU, which is why engine ggml-org#1467's projector cannot run with HRX0 in the graph at all. The condition now lives in one place, `ggml/src/ggml-hrx/rope-claim-params.h`: the two matcher predicates plus their union. Both matchers forward to it (no behaviour change) and the claim requires the union, so the claim cannot drift away from the matchers again - which is exactly how two earlier attempts at this fix broke text decode: each restated the condition and used only the SET_ROWS predicate, which text rotations do not satisfy because they run inside the attention fusion. Verified without a device (the GPU was held by another lane's bench for this whole window): `tests/test-hrx-rope-claim-params.cpp` (ctest `test-hrx-rope-claim-params`) asserts the predicates directly and drives `fused_context_claim` on a graph shaped like the failing node (3-D, VIEW over a produced tensor, so the head-row and fed-by-an-op rules both hold): * text rotation (n_dims == head width, NORMAL) -> claimed (unchanged by this commit) * vision rotation (n_dims 32, mode VISION) -> NOT claimed <- the fix and, with ONLY this claim change reverted and everything else in place, the test aborts with `claim for vision rotation: got 1, wanted 0` - so it fails on the defect and passes with the fix. Still blocking the rest of ggml-org#1467: with the projector on HRX the next refused node is a pure-alias VIEW (`unsupported HRX node 20: VIEW f32[2048,2,1,1] <- VIEW`), which is claimed by the standalone path rather than by a fused claim. That is a separate change and is not in this commit. Refs ggml-org#1467 * hrx: say which relation a refused layout-alias node has, and pin alias elision in a host test engine ggml-org#1467's projector is refused at a node the log names only by shape: E graph_compute: unsupported HRX node 20: VIEW output=f32[2048,2,1,1] <- VIEW inputs=[f32[2048,2,1,1]] consumers=[21:ADD] A layout-alias node is refused there for one of two completely different reasons and the shape cannot tell them apart: it IS an alias (one input, same storage as its input) whose input was not available when the node was visited, or it is not aliasing its input at all and therefore needs a dispatch that no registration provides. The message now says which: ... consumers=[…] alias=same_storage inputs=1 ... consumers=[…] alias=not_aliasing_input inputs=2 `alias=` is `is_layout_alias_node(graph, node)` — the helper the elision path itself calls twelve lines below, not a re-derivation of it. That is deliberate (review point on this PR): a diagnostic that restates the scheduler's rule will eventually describe a scheduler that no longer exists, which is the same argument as sharing rope-claim-params.h between the claim and its matchers in #257. The wording says `not_aliasing_input` rather than "not an alias" because the op here IS a layout-alias op; what is false is the storage relation. Alongside it, `tests/test-hrx-view-alias-elision.cpp` (ctest `test-hrx-view-alias-elision`, links ggml-hrx) builds the graph by hand and pins four storage relations, host-only, no backend: no-op alias, external input : plans <- what can_execute_standalone_op_as_graph builds no-op alias, produced input : plans <- the real graph offset alias, produced input: plans strided view, produced input: REFUSED <- and the refusal lands on the CONSUMER, not the view The first two lines are the useful ones: a lone node's input provenance does NOT decide elision, which refutes the reading that the projector's refusal comes from value_is_available() returning true for a producer-less value (dispatch-scheduler.cpp:102-106). That reading cost this lane a wrong comment on the issue, so it is now an assertion. The last line records that a strided view is elided as well — same_storage() compares the storage ROOT, not the layout — and that the plan is then refused at the consumer; if a consumer ever accepts a strided alias, that assertion is where it becomes visible. Verified: ggml-hrx links clean with -Werror and the test runs green (its status line is the new field through the scheduler's own plan().status.errors()). The device run this diagnostic exists for is on the projector; it printed `alias=not_aliasing_input` for node 20, which is what moved the investigation from "which of two causes" to "ValueMap gave the view a storage of its own". Refs ggml-org#1467 * hrx: record WHY a value got its own storage, and which way an alias source was found Three review points from #262, applied. The second and third changed the design rather than the wording. 1. **No re-derivation from the string it built.** `aliasing` is the boolean; `relation` is formatted from it. 2. **The classifier asks the value, not the map.** Asking `find_tensor(view_src)` at message time answers a different question from the one answered when the storage was chosen - values added in between make that lookup succeed where it failed then, so the message could name the wrong repair. `AliasMiss` is recorded on `Value` inside `get_or_add_tensor_value()`. 3. **The dead label is gone.** `ViewSrcRegisteredStorageDiffers` could never be set: a registered `view_src` is an early return in `find_alias_source()`, so the fresh-storage branch can only mean "no alias source". What the schedule actually needs to know is *which way* an alias source was found, because a found source joins THAT value's storage and that storage need not be the node input's - which is exactly how `is_layout_alias_node()` ends up false while an alias source exists. So: NoAliasSource - view_src unregistered and no value shares its storage root: a storage of its own ExactViewSrc - aliased the view_src value itself, and that is not the node input's storage RangeFallback - aliased by the storage-root fallback, not by identity None - not a view and the message prints `alias=not_aliasing_input(no_alias_source)` / `(aliased_view_src_not_the_input)` / `(aliased_storage_root_fallback_not_the_input)`. Snapshot restore in graph-diagnostics.cpp takes the new field (AliasMiss::None) so a restored value cannot claim a reason it never had. `ggml-hrx` links clean with -Werror and the host test still pins its relations. Refs ggml-org#1467 --------- Co-authored-by: bcloud <[email protected]>
… node (Refs ggml-org#1467) (#267) * hrx: claim a head-row ROPE only when a fused matcher accepts its parameters `fused_context_claim` accepted a per-head ROPE on SHAPE alone (`is_head_row(op) && fed_by_op(op)`), while the two registrations that execute rotations accept different PARAMETER sets: * llm/dispatch-attention-qkv.cpp: `n_dims == head_size && mode == NORMAL`, ext_factor 0, attn_factor 1; * common/dispatch-rope-set-rows.cpp: `4 <= n_dims <= head_size`, multiple of 4, mode NORMAL / NEOX / collapsible IMROPE. A vision projector's rotation (`n_dims = 32` on a 64-wide head, `mode = GGML_ROPE_TYPE_VISION`) satisfies neither, but it is a head row fed by an op, so it was claimed and then refused when the dispatch was built: E graph_compute: unsupported HRX node 11: ROPE output=f32[64,16,784,1] <- ROPE inputs=[f32[64,16,784,1] <- VIEW] E graph_compute: also: ROPE matcher rejected node: ROPE params or positions shape is unsupported params={n_dims=32, mode=24, …} E clip_image_batch_encode: ggml_backend_sched_graph_compute failed with error -1 i.e. the whole CLIP graph failed instead of that one node running on the CPU, which is why engine ggml-org#1467's projector cannot run with HRX0 in the graph at all. The condition now lives in one place, `ggml/src/ggml-hrx/rope-claim-params.h`: the two matcher predicates plus their union. Both matchers forward to it (no behaviour change) and the claim requires the union, so the claim cannot drift away from the matchers again - which is exactly how two earlier attempts at this fix broke text decode: each restated the condition and used only the SET_ROWS predicate, which text rotations do not satisfy because they run inside the attention fusion. Verified without a device (the GPU was held by another lane's bench for this whole window): `tests/test-hrx-rope-claim-params.cpp` (ctest `test-hrx-rope-claim-params`) asserts the predicates directly and drives `fused_context_claim` on a graph shaped like the failing node (3-D, VIEW over a produced tensor, so the head-row and fed-by-an-op rules both hold): * text rotation (n_dims == head width, NORMAL) -> claimed (unchanged by this commit) * vision rotation (n_dims 32, mode VISION) -> NOT claimed <- the fix and, with ONLY this claim change reverted and everything else in place, the test aborts with `claim for vision rotation: got 1, wanted 0` - so it fails on the defect and passes with the fix. Still blocking the rest of ggml-org#1467: with the projector on HRX the next refused node is a pure-alias VIEW (`unsupported HRX node 20: VIEW f32[2048,2,1,1] <- VIEW`), which is claimed by the standalone path rather than by a fused claim. That is a separate change and is not in this commit. Refs ggml-org#1467 * hrx: say which relation a refused layout-alias node has, and pin alias elision in a host test engine ggml-org#1467's projector is refused at a node the log names only by shape: E graph_compute: unsupported HRX node 20: VIEW output=f32[2048,2,1,1] <- VIEW inputs=[f32[2048,2,1,1]] consumers=[21:ADD] A layout-alias node is refused there for one of two completely different reasons and the shape cannot tell them apart: it IS an alias (one input, same storage as its input) whose input was not available when the node was visited, or it is not aliasing its input at all and therefore needs a dispatch that no registration provides. The message now says which: ... consumers=[…] alias=same_storage inputs=1 ... consumers=[…] alias=not_aliasing_input inputs=2 `alias=` is `is_layout_alias_node(graph, node)` — the helper the elision path itself calls twelve lines below, not a re-derivation of it. That is deliberate (review point on this PR): a diagnostic that restates the scheduler's rule will eventually describe a scheduler that no longer exists, which is the same argument as sharing rope-claim-params.h between the claim and its matchers in #257. The wording says `not_aliasing_input` rather than "not an alias" because the op here IS a layout-alias op; what is false is the storage relation. Alongside it, `tests/test-hrx-view-alias-elision.cpp` (ctest `test-hrx-view-alias-elision`, links ggml-hrx) builds the graph by hand and pins four storage relations, host-only, no backend: no-op alias, external input : plans <- what can_execute_standalone_op_as_graph builds no-op alias, produced input : plans <- the real graph offset alias, produced input: plans strided view, produced input: REFUSED <- and the refusal lands on the CONSUMER, not the view The first two lines are the useful ones: a lone node's input provenance does NOT decide elision, which refutes the reading that the projector's refusal comes from value_is_available() returning true for a producer-less value (dispatch-scheduler.cpp:102-106). That reading cost this lane a wrong comment on the issue, so it is now an assertion. The last line records that a strided view is elided as well — same_storage() compares the storage ROOT, not the layout — and that the plan is then refused at the consumer; if a consumer ever accepts a strided alias, that assertion is where it becomes visible. Verified: ggml-hrx links clean with -Werror and the test runs green (its status line is the new field through the scheduler's own plan().status.errors()). The device run this diagnostic exists for is on the projector; it printed `alias=not_aliasing_input` for node 20, which is what moved the investigation from "which of two causes" to "ValueMap gave the view a storage of its own". Refs ggml-org#1467 * hrx: say WHICH alias lookup missed, not just that one did `alias=not_aliasing_input` (previous commit) says a layout-alias node's storage is not its input's. On engine ggml-org#1467's text tower that is where the investigation stops, because two very different causes print the same word and they need different repairs: * `view_src_unregistered` — the `ggml_tensor` the node's `view_src` points at is not a value in this graph, so `find_alias_source`'s pointer lookup cannot hit and the storage-root fallback has nothing to match. Repair: register the value, or resolve the alias by storage *range* rather than by tensor-pointer identity. * `view_src_registered_but_storage_differs` — it WAS registered and the map still gave the view a storage of its own. Repair: that is a bug in the assignment itself, not in what the graph contains. Both now print distinctly: ... alias=not_aliasing_input(view_src_unregistered) inputs=1 ... alias=not_aliasing_input(view_src_registered_but_storage_differs) inputs=1 `find_tensor()` is public and `Value::tensor` is public (`graph/value-map.h:100-101`, `:84`), so this asks the same map the assignment asked, rather than re-deriving anything. Why it matters: the difference decides whether the next change is "register the missing value" or "match by storage range". Guessing wrong costs a device run each time, and this lane has already spent several. Coverage, stated plainly: the new branch is NOT exercised by `test-hrx-view-alias-elision` — every case there fails *before* the message is built (the strided case is refused at its consumer), and `unsupported_node_message` is file-local so the test cannot call it. What the test does show is that the change does not alter the four relations it pins. Exercising the new branch needs the projector on a device. Stacked on the previous commit (`1bit/1467-view-alias-diag`); merge that first. Refs ggml-org#1467 * hrx: print the two storages and the view's layout for a refused alias node Six hypotheses about engine ggml-org#1467's refused `VIEW` have died under their own tests (input provenance, offsets, strides, an unregistered view_src resolved by storage range, producer coverage, and the claim). Each one was tested by building the case it predicted and watching it not reproduce. That is the signal to stop predicting and print the two storages. For a layout-alias node whose storage is not its input's, the message now also carries: storages=out7/in3 nb=[4,8192,16384,32768] offs=0 * `storages=outN/inM` - the two `ValueStorageId`s. Equal ids with `alias=not_aliasing_input` would be a contradiction (the map agreed and the message says it did not); different ids are the fact every hypothesis has been guessing at; * `nb=[...]` and `offs=` - what layout the view describes. A view whose strides differ from its input's same-shape tensor is a strided alias, which is a different thing from "the map gave it a storage". With the `alias=` and `why=` fields from the two commits below, one run now answers: which storage the map gave the view, whether it is its input's, whether the view's own `view_src` was registered, and what layout it describes. Coverage, stated plainly: like the previous commit, this field is not exercised by `test-hrx-view-alias-elision` - the host cases fail before a message is built, and `unsupported_node_message` is file-local. What the test does show is that the four pinned relations and the added case still behave. Stacked on `1bit/1467-alias-reason` (#262), itself stacked on #258 and #257. Merge in that order. Refs ggml-org#1467 * tests: reproduce engine ggml-org#1467's refused VIEW on the host, with the run's own numbers The projector run printed the facts this case encodes: VIEW output=f32[2048,2,1,1] nb=[4,32768,65536,65536] offs=8192 alias=not_aliasing_input(view_src_unregistered) storages=out24/in11 Rows of 2048 f32 taken from a buffer whose rows are 8192 f32 apart (`nb[1]` = 32768 bytes = 4x the width), starting one row in (`offs` = 8192 bytes = 2048 f32), and the wide source is never registered as a value in the graph - which is why `find_alias_source`'s two tensor-identity lookups both miss and the view is given a storage of its own. `ViewKind::WideWindow` builds exactly that shape, so `test-hrx-view-alias-elision` now reproduces the refusal on a machine with no device: no-op alias, external input : plans no-op alias, produced input : plans offset alias, produced input: plans strided view, produced input: REFUSED <- refused at its CONSUMER wide window view (node 20) : REFUSED <- refused AT THE VIEW, as the projector is The assertion is `REQUIRE(!wide)`: that is today's behaviour and it is the defect. The fix is a densify dispatch for a layout-alias node that cannot be elided (copy the strided window into a contiguous transient - `dispatch-copy.cpp`'s append_f32_densify_dispatch already does this for permuted activations), and when it lands this line flips to `REQUIRE(wide)` - which makes the change visible in the test rather than inferred from a log line. Two traps for whoever writes it, recorded here because both produce a WRONG NUMBER rather than a failure: the copy must derive its source offsets from nb[]/offs (a densify that reuses the pre-densify plane offsets copies the wrong rows), and the transient must hold ne[0]*ne[1] contiguous elements of the same type. Refs ggml-org#1467 * hrx: drop the merge markers the previous commit carried, keeping this branch's superset block The pin has this message code as #258 landed it; this branch has it with the why=/facts additions, so the superset is the resolution and nothing from the pin is lost. The previous merge commit carried the markers themselves, which is why the tree did not compile - caught by rebuilding before pushing, not by review. * hrx: take the pin's AliasMiss block back, and re-apply only the facts on top of it The previous merge resolved this hunk to *this branch's* older version, which silently removed what the base added deliberately: the `AliasMiss` switch, i.e. the miss cause read from **assignment-time state**. That is the half an earlier review called blocking, and my resolution brought the forbidden re-ask of the map back with it. The reviewer caught it; this commit fixes it. Resolution now, per file: - `dispatch-scheduler.cpp`, `value-map.{h,cpp}`, `graph-diagnostics.cpp`: **the pin's versions** (AliasMiss + NoAliasSource/ExactViewSrc/RangeFallback, recorded when the storage is chosen); - and on top of the pin's block, only this branch's own addition: `storages=outN/inM nb=[…] offs=…`, which is the fact the six dead hypotheses needed. `why=` still comes from the pin's `AliasMiss`, never from a re-ask. - `<cinttypes>`/`<cstdio>` added for PRId64/snprintf, which the pin's file did not need. Rebuilt before committing: `ggml-hrx` links clean with -Werror, and the host test still pins the four relations plus `wide window view (node 20) : REFUSED`. Refs ggml-org#1467 --------- Co-authored-by: bcloud <[email protected]>
…rd inside it dispatch-attention-qkv.cpp conflicted because both sides narrowed the same predicate: our line replaced the inlined condition with a call to rope_params_supported_by_attention_fusion (the extraction from llama.cpp#257, which exists so the fused claim and the matcher cannot drift), and AMD's rebase inlined the old condition again plus a new guard (params.n_offs != 0 -> false). Resolution takes both intents rather than one side: the file keeps our delegation, and the n_offs guard moves INTO the shared predicate in rope-claim-params.h. Putting it in the file that the claim and the matcher both call is the whole reason #257 moved the condition there -- a guard added only to the matcher would make the claim assert a rotation the matcher now declines, which is engine#1467's failure shape (claimed, then refused at dispatch build). RopeParams.n_offs exists in the merged tree (op-params.h:138), so the guard compiles against both parents' intent. Marker files: 87 -> 86.
What is wrong
fused_context_claimaccepted a per-head ROPE on shape alone (is_head_row(op) && fed_by_op(op)), while the two registrations that execute rotations accept different parameter sets:llm/dispatch-attention-qkv.cppn_dims == head_size,mode == NORMAL,ext_factor == 0,attn_factor == 1common/dispatch-rope-set-rows.cpp4 <= n_dims <= head_size,n_dims % 4 == 0,mode ∈ {NORMAL, NEOX, collapsible IMROPE}A vision projector's rotation (
n_dims = 32on a 64-wide head,mode = 24 = GGML_ROPE_TYPE_VISION) satisfies neither, but it is a head row fed by an op, so it was claimed and then refused when the dispatch was built:So the whole CLIP graph failed rather than that one node falling back to the CPU — which is why engine ggml-org#1467's projector cannot run with HRX0 in the graph at all.
The change
The condition now lives in one place,
ggml/src/ggml-hrx/rope-claim-params.h: the two matcher predicates plus their union (rope_params_supported_by_any_fusion). Both matchers forward to it (no behaviour change) and the claim requires the union viaimport_op_params→op_params_as<RopeParams>.RMS_NORMis split off so its case is unchanged.That structure is the point: two earlier attempts at this fix broke text decode because each restated the condition and used only the SET_ROWS predicate — and text rotations do not satisfy that one, they run inside the attention fusion. Now a matcher cannot be narrowed without the claim following.
Verification (no device was available — see below)
New host test
tests/test-hrx-rope-claim-params.cpp(ctesttest-hrx-rope-claim-params, links onlyggml):freq_base, vision);fused_context_claimon a graph shaped like the failing node — 3-D,VIEWover a produced tensor so the head-row and fed-by-an-op rules both hold:n_dims == head width, NORMAL) → claimed (unchanged by this commit);n_dims 32, mode VISION) → not claimed — the fix.Regression property, measured: with only this commit's claim change reverted and everything else in place, the test aborts with
so it fails on the defect and passes with the fix, and the text case passes either way — which is the property the two earlier attempts lacked.
Not verified here, stated plainly
The GPU was held by another lane's bench for this entire window (
GPU-TOKEN: gpu-hold supreme max bench), so I could not run the image request or a text decode against the rebuilt library. What is verified is the claim/predicate logic plus a cleanggml-hrxlink with-Werror. The device check to run before merge is: text decode on Qwen3VL-2B (must be unaffected) and one image request with the projector on HRX0 (should now report the next refused node rather than ROPE).Still blocking ggml-org#1467 after this
With the projector on HRX the next refused node is a pure-alias view:
That one is claimed by the standalone path (
can_execute_standalone_op_as_graph, whose single-node graph feeds the view from an External leaf) rather than by a fused claim, so it needs its own change. This PR does not claim to fix the projector's throughput; it removes one hard blocker and the claim/matcher divergence behind it.Refs ggml-org#1467