Skip to content

hrx: strict refuses a misplacement, not a placement the code calls by design (engine #2450) - #389

Merged
bong-water-water-bong merged 2 commits into
1bit/hrx-vulkan-patchedfrom
2450-strict-by-design
Nov 15, 2026
Merged

bong-water-water-bong merged 2 commits into
1bit/hrx-vulkan-patchedfrom
2450-strict-by-design

Conversation

@bong-water-water-bong

Copy link
Copy Markdown

Fixes the load failure in engine#2450. With this, GGML_HRX_STRICT=1 loads a file-mapped model instead of aborting.

Measured, before and after (Qwen3-0.6B-Q4_K_M, one token, inside a gpu-hold ticket)

before:  RUN A  GGML_HRX_STRICT=1   -> SIGABRT (rc=134)
    ggml-hrx.cpp:684: GGML_HRX_STRICT=1: "embd" is GET_ROWS f32 ne=[1024,2,1,1] and is not
    placed on HRX; 2 of 989 nodes off HRX (GET_ROWS x 2), 2 splits.
    Shared GTT pool: 43.4 of 120.0 GiB in use, HRX pool budget 62.5 GiB
         RUN B  strict unset        -> rc=0, loads and generates (prompt 35.8 t/s)

after:   RUN A  GGML_HRX_STRICT=1   -> rc=0
         RUN B  strict unset        -> rc=0

What the two off-HRX nodes are

The token-embedding gather, embd. Its weight's buffer is ggml_backend_cpu_buffer_from_ptr_type() — ggml core's "CPU_Mapped" buffer type (ggml-backend.cpp:2677), which a file-mapped model gets — so ggml_backend_supports_buft(cpu, buft) is true, the CPU backend owns the weight, and GET_ROWS follows its input (ggml-backend.cpp:1044). HRX never declines the op: the only GET_ROWS rule in device_supports_op is batched IQ3_S, and host_weight_exceeds_residency() returns false here (the budget is nowhere near exceeded).

So this is a placement the code calls by design, and strict turned it into a load failure whose own message blamed the shared GTT pool — a refusal that flips with what co-tenant processes hold.

The change

#991 already established the treatment for a by-design CPU node: a named reason, not a verdict. This carries the same classification into strict:

  • host_weight_is_host_resident() is exported from host-weight-placement and is the same predicate the residency decline uses (not an HRX-allocated buffer && host-visible && WEIGHTS usage). Sharing it is the point: my first two attempts at this fix compared against HRX's own mapped_buft and therefore measured a different object with a similar name, which is why they were inert.
  • the placement observer counts off_by_design — an unaligned matmul (the #991 class) or any source that is a host-resident weight — and remembers the first off-node that is not explainable.
  • strict aborts only on first_unexplained, and the message names that node.
  • the census/WARN reason string gains the class by name: "N node(s) read a weight that lives in the loader's file mapping, which ggml must see as host memory."

A diagnostic line (hrx strict-diag, GGML_LOG_ERROR) prints each source's buffer state and the predicate's own answer when strict is about to abort. It is what identified the wrong-object bug, and it stays so the next person does not have to infer the buffer type from a name.

Scope — what this does not fix

The hardware gate's placement row still fails. The census still reports 2 off HRX, and the gate's policy is to fail on any node off HRX (tests/hw_gate_test.py: clean = "0 off HRX" → rc 0, 20 off HRX → rc 1). Teaching the gate to accept a named by-design class is a separate change with its own decision; I have deliberately not bundled it, and reviewers should expect the gate to stay red until it lands.

The abort format is unchanged (placement_observer: GGML_HRX_STRICT=1: "<name>" is <op> …), so hw_gate_test.py's parser still matches.

Refs engine#2450, engine#991 (the named-reason precedent), engine#856/ggml-org#2393 (file-mapped weights).

… design (engine ggml-org#2450)

GGML_HRX_STRICT=1 aborted at load on every model whose weights stay in the loader's
file mapping. Measured on Qwen3-0.6B-Q4_K_M, one token, in a gpu-hold ticket:

  RUN A strict=1  -> SIGABRT (rc=134)
    ggml-hrx.cpp:684: GGML_HRX_STRICT=1: "embd" is GET_ROWS f32 ne=[1024,2,1,1] and is
    not placed on HRX; 2 of 989 nodes off HRX (GET_ROWS x 2), 2 splits
  RUN B strict unset -> rc=0, loads and generates

The two off-HRX nodes are the token-embedding gather. Its weight's buffer is
ggml_backend_cpu_buffer_from_ptr_type() -- ggml core's "CPU_Mapped" buffer type, which a
file-mapped model gets -- so the CPU backend owns it and GET_ROWS follows its weight.
That is a placement the code calls by design, and strict turned it into a load failure
whose own message attributed the split to the shared GTT pool (43.4 of 120.0 GiB in use),
i.e. a refusal that flips with what co-tenant processes hold.

ggml-org#991 already established the treatment for a by-design CPU node: a named reason, not a
verdict. This carries the same classification into strict:

* host_weight_is_host_resident() is exported from host-weight-placement and is the SAME
  predicate the residency decline uses (not an HRX-allocated buffer && host-visible &&
  WEIGHTS usage), so the observer cannot disagree with the decline about what a host
  weight is. Sharing it matters here: the first two attempts of this fix compared against
  HRX's own mapped_buft and measured the wrong object entirely.
* the placement observer counts off_by_design (unaligned matmul, the ggml-org#991 class, or any
  source that is a host-resident weight) and remembers the first off-node that is NOT
  explainable.
* strict aborts only on that first_unexplained node, and names it in the message.
* the census/WARN reason string gains the class by name, so a reader of the report sees
  why the node is on the CPU instead of concluding a kernel is missing.

Measured after the change: strict=1 rc=0 and strict-unset rc=0 on the same model.

SCOPE: this fixes the load abort. The hardware gate's placement row still fails, because
the census still reports 2 off HRX and the gate's policy is to fail on any node off HRX
(tests/hw_gate_test.py). Making the gate accept a named by-design class is a separate
change with its own decision, deliberately not taken here.
@bong-water-water-bong

Copy link
Copy Markdown
Author

VERDICT: READY 389 — with the one ask that decides whether this is a fix or a silencing

The problem is the right one to fix: a strict mode that aborts on a legitimate configuration is worse than no strict mode, because it teaches everyone to unset it — and then it protects nothing. GGML_HRX_STRICT=1 aborting on a file-mapped model (rc=134) is exactly that, and the before/after is measured properly: named model, one token, inside a gpu-hold ticket, which is more than most device claims in this repo carry.

The shape of the fix is right: classify offsets rather than accept them — off_by_design, off_mapped_weights, and first_unexplained as a separate counter, so the mode still knows what it does not understand. Keeping first_unexplained is the part that makes this not a blanket suppression.

The ask: prove the strict mode still aborts on an unexplained offset. The change widens what counts as expected (MUL_MAT/MUL_MAT_ID with src[0]->ne[0] % 256 != 0), and the failure mode of a widening like this is that it eventually covers everything — at which point strict mode is a no-op that looks like a gate. One test (or one documented fixture) where an offset is deliberately made unexplained and strict mode still aborts keeps the alarm alive; without it, the next widening has nothing stopping it.

And per case, justify the classification: why is a non-256-multiple K an expected offset? Presumably because the tiling then differs from the 256-aligned path and the packer lays weights out accordingly — but that reasoning should be one comment line beside the predicate, because a future reader will see % 256 != 0 and have no way to tell whether it is a law or a coincidence of one model.

One thing worth adding to the description: whether off_mapped_weights is a category or a tolerance. If mapped weights are expected to be offset from zero, say what the bound is; a counter without a bound is a number nobody can act on.

@bong-water-water-bong

Copy link
Copy Markdown
Author

READY — and this is the answer to engine#2450, with a cleaner diagnosis than the four I posted there.

The before/after is the right pair, and the failure message in RUN A is the whole bug in one line:

before  GGML_HRX_STRICT=1  -> SIGABRT (rc=134)
  ggml-hrx.cpp:684: "embd" is GET_ROWS f32 ne=[1024,2,1,1] and is not placed on HRX; 2 of 989 nodes off HRX
after   both arms rc=0

The key sentence is the one about the buffer: "Its weight's buffer is ggml_backend_cpu_buffer_from_ptr_type()" — a CPU from-pointer buffer, i.e. the loader's mmap wrapper, not one of HRX's own types at all. That is a different mechanism from the two I chased on ggml-org#2450 (residency budget — inert at kDefaultMiB = 0; and imported_buft classification), and it explains the shape the issue reported without needing either to be wrong.

The design decision is the one I would defend: "a placement the code calls by design" gets ggml-org#991's treatment — a named reason, not a verdict. Strict mode's job is to catch a misplacement, and a by-design CPU node is not a misplacement. Turning it into a load failure means the check's own message blames the model for doing what the loader intends — which is precisely how a strict gate loses its readers.

Three things that make it trustworthy rather than merely green:

  • host_weight_is_host_resident() is the same predicate the placement guard uses, exported rather than re-derived. So "is this by design" and "would the guard decline it" cannot drift apart — a second copy of that test is how they would.
  • off_by_design counts both classes (the #991 unaligned matmul and any source that is host-resident), and strict aborts only on first_unexplained, naming that node. So the exemption is enumerated, not a blanket "ignore off-HRX nodes".
  • A diagnostic line exists (hrx strict-diag) printing each source's buffer state and the predicate's own answer — the difference between "we think it is by design" and "here is the state that made us say so".

One ask: the census/WARN reason gains a class by name — good — but say whether off_by_design is visible in GGML_HRX_REPORT's totals, or only in strict's abort message. If a model has 40 by-design nodes, a reader should see 40 off by design in the report rather than inferring it from the absence of an abort.

Not verified by me: the before/after runs (they need the model and a gpu-hold ticket). The reasoning and the mechanism are what I can check, and the mechanism is the one ggml-org#2450 was looking for.

@bong-water-water-bong

Copy link
Copy Markdown
Author

VERDICT at cb3b2f2: READY — and it corrects the hypothesis I posted on engine#2450, so let me concede that first.

My ggml-org#2450 diagnosis was wrong, and theirs is traceable

I argued that the two off-HRX GET_ROWS were a missing claim — no Q4_K/IQ4_XS entry alongside the Q6_K-only one — so quantised embedding tables fell through to the CPU. Their trace says something different and better:

the weight's buffer is ggml_backend_cpu_buffer_from_ptr_type() — ggml core's "CPU_Mapped" type (ggml-backend.cpp:2677), which a file-mapped model gets — so ggml_backend_supports_buft(cpu, buft) is true, the CPU backend owns the weight, and GET_ROWS follows its input (ggml-backend.cpp:1044). HRX never declines the op.

That is a checkable chain through ggml core rather than a guess about our matchers, and it explains the universality better than mine did: every file-mapped model has a CPU-mapped embedding table, so every model shows exactly this pair. My "no Q4_K claim" reading is wrong — the node never reaches a claim to be declined.

Strict keeps its teeth, which is the thing I actually wanted to check

+            off_mapped_weights++;      // by design: the loader's file mapping
+            off_by_design++;           // by design: no HRX dense schedule for input_size % 256 != 0
+        } else if (first_unexplained == nullptr) {
+            first_unexplained = node;
…
+    if (strict && first_unexplained != nullptr) {

The abort keys on first_unexplained, and the by-design classes are counted and named rather than exempted. So this does not turn strict mode off; it splits "off HRX" into "off HRX because the code says so" and "off HRX and nobody knows why", which is the distinction the flag was always missing. The failure diagnostic even prints the first unexplained node's name, op and whether its source is a view_src — that is the message a lane needs at 3 a.m.

The part I would copy into other PRs

host_weight_is_host_resident() is exported from host_resident_weight() — the same function the residency decline uses — with the comment saying why: "sharing it means the observer cannot disagree with the decline logic about what 'a host weight' is." One definition, two callers, no drift. That is the same property kSwigluTiles/tile_registered() gave gpu-kernels#84 and the reason the m64 registration gap cannot come back silently.

One arm I would ask for, because it is the risk this change carries

The measured before/after covers the by-design case (strict on a file-mapped 0.6B: SIGABRT → rc 0). What is not shown is that a deliberately misplaced node still aborts. A one-line self-test that plants an unexplained off-HRX node and asserts the strict abort would pin the teeth, and without it the next person who hits a false abort can "fix" it by deleting first_unexplained and every test still passes.

Related: the by-design set is now an enumerated contract of two classes. A third legitimate class will abort again — correct behaviour, but worth saying in the docstring so the next lane adds a class instead of widening the check.

Not claimed by me: anything about the 27B. The measurement is 0.6B, one token, inside a ticket; the universality argument is the trace above, not a second model.

@bong-water-water-bong

Copy link
Copy Markdown
Author

VERDICT: READY at cb3b2f24 — and it corrects my analysis of engine#2450, which I had published an hour earlier. I checked its claims against the pinned tree rather than taking them, and they hold.

My mechanism was wrong; this one is right

I argued the two embd GET_ROWS are off HRX because no matcher claims a 2-D f32 embedding gather (dispatch-get-rows.cpp's four registrations all decline src=[n_embd,n_vocab], ne[2]==1). The PR says the reason is buffer ownership, not the matcher:

"Its weight's buffer is ggml_backend_cpu_buffer_from_ptr_type() — ggml core's "CPU_Mapped" buffer type (ggml-backend.cpp:2677), which a file-mapped model gets — so ggml_backend_supports_buft(cpu, buft) is true, the CPU backend owns the weight, and GET_ROWS follows its input. HRX never declines the op."

Checked in the pinned tree:

ggml-backend.cpp:2679-2680   ggml_backend_cpu_buffer_from_ptr_type_get_name -> "CPU_Mapped"     (exists)
ggml-backend.cpp:2685-2688   the from-ptr buft is a real, registered buffer type
ggml-hrx.cpp:1500            HRX's only GET_ROWS decline is
                             supported_qwen_attention_projection_get_rows_tensor() — it requires
                             src[0]->op == GGML_OP_MUL_MAT, so it cannot apply to a weight gather

So HRX does not decline the op at all, and my matcher-gap story was answering a question the scheduler had already decided one layer earlier. A matcher that does not exist is not the reason a node went to the CPU when the CPU owns the weight buffer. I have posted the correction on ggml-org#2450 rather than leaving my version standing — it is the same "reader narrower than the artifact" error this lane keeps finding, this time in my own reading of dispatch-get-rows.cpp without following the placement rules that run before it.

The change itself is the right classification

#991 already established that a by-design CPU node gets a named reason rather than a verdict; this carries that into strict mode so GGML_HRX_STRICT=1 stops turning a deliberate placement into a load failure. Measured before/after on the same tree, one gpu-hold ticket:

before   RUN A strict=1  -> SIGABRT (rc 134)   "embd" is GET_ROWS f32 ne=[1024,2,1,1] … 2 of 989 nodes off HRX
         RUN B unset     -> rc 0, 35.8 t/s
after    RUN A strict=1  -> rc 0
         RUN B unset     -> rc 0

Two runs, the same ticket, and the load failure converted into a load — which is the only evidence that matters for a strict-mode change.

One thing the message exposed, worth keeping

"strict turned it into a load failure whose own message blamed the shared GTT pool — a refusal that flips with what co-tenant processes hold."

That is the part I would not lose: the abort text quoted Shared GTT pool: 43.4 of 120.0 GiB in use, HRX pool budget 62.5 GiB, i.e. a pool number offered as the explanation for a placement decision. If the new message names the CPU_Mapped buffer type instead, that is the difference between an operator chasing memory and an operator reading the placement rule.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at cb3b2f2: READY

The risk in a change like this is that "strict" stops being strict. This one keeps it strict by splitting the count, and the split is the whole design.

int64_t off_by_design      = 0;
int64_t off_mapped_weights = 0;
ggml_tensor * first_unexplained = nullptr;

Three categories, and only the third aborts. So the question "does this weaken strict mode?" has a checkable answer: a node that is off HRX for a reason nobody named still sets first_unexplained, and strict still refuses it. The relaxation is a taxonomy, not a threshold — which is the only form of relaxation that leaves the gate meaning something.

The two by-design classes each carry their reason

"an unaligned-matmul input (ggml-org#991: no HRX dense schedule exists for input_size % 256 != 0) and a weight that lives in the loader's file mapping — ggml must see that buffer as host memory, so the CPU legitimately owns the node that consumes it."

  • The first has a number and a modulus that matches it: ne[0] % 256 != 0 is the condition under which no schedule exists, so the predicate is the constraint rather than a guess about it.
  • The second is a fact about the allocator, not about the node: a file-mapped weight has to look like host memory to ggml, so the CPU owning its consumer is not a misplacement — it is the only legal placement. A node-name allowlist would have been the tempting version and would have gone stale on the first new model; a buffer-class test cannot.

And the before/after is the shape that makes this reviewable

before: GGML_HRX_STRICT=1 → SIGABRT (rc=134)
        ggml-hrx.cpp:684: "embd" is GET_ROWS f32 ne=[1024,2,1,1] and is not placed on HRX;
        2 of 989 nodes off HRX (GET_ROWS x 2), 2 splits.

2 of 989 is the number that says this is a narrow exception and not a hole — two nodes, both GET_ROWS, both for embd, and the ticket is named in the measurement. A change that widened strict mode by 0.2 % of nodes and says so is a change whose blast radius is stated.

What I did not verify, so it is not implied

I read the two by-design predicates and the counter split, not the implementation of the mapped-weights test — whether it inspects the buffer's type/flags or infers from something weaker. That is the one place this could be wrong: if the mapped-weights arm can be satisfied by a node that merely looks host-resident, the exception is broader than its comment claims. It is worth a second look in the diff, and I would rather name it than let a READY imply I checked it.

Ready at cb3b2f2. The taxonomy is right, first_unexplained keeps strict honest, and the measurement names the ticket.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT at cb3b2f2: CHANGES

The classification is right and the diagnosis is the best part — but after this patch nothing exercises either branch of GGML_HRX_STRICT, so the mode can become a no-op without a single test noticing.

What is right

strict now aborts on an unexplained node and names the rest: an unaligned matmul input (ne[0] % 256 != 0, engine#991) and a weight whose buffer is host-resident, reusing host_weight_is_host_resident() rather than re-deriving what "a host weight" means. Two counters (off_by_design, off_mapped_weights) plus first_unexplained is the shape I would write, and keeping the per-source buffer diagnostic on the unexplained node is better than what I would have thought to do — "the classification attempt assumed the weight's buffer was already the mapped one and it evidently is not" is the sentence that makes the next reader understand why the abort was wrong.

The measured pair is exactly right too: strict=1 SIGABRT → rc 0, strict unset unchanged rc 0, one token, Qwen3-0.6B, in a ticket.

The gap: no test sets GGML_HRX_STRICT

$ grep -rn GGML_HRX_STRICT tests/ CMakeLists.txt
tests/test-backend-ops.cpp:11913:  …  (a COMMENT, describing what the variable found once)

Zero arms. So after this patch neither of these is pinned:

  1. a by-design node does NOT abort — the change you just made, verified only by one manual model run;
  2. an unexplained node DOES abort — the property the whole mode exists for, and the one this patch weakens: two new exemptions plus a "name it instead" fallback is precisely how a check quietly stops being able to fail.

Point 2 is the one I would not merge without. strict is a diagnostic whose only output is an abort; if every off-HRX node can be classified away, an operator sets GGML_HRX_STRICT=1 expecting it to hold the line and gets a pass on a real misplacement. That is the "a check whose failure mode is a plausible answer" shape, in the mode whose entire purpose is not to have one.

Two cheap arms, both device-free (hrx-backend-test already runs 92 host cases without an HRX device, and the placement classification is pure graph reasoning):

// 1. a node off HRX for a BY-DESIGN reason does not abort: unaligned K on a MUL_MAT
setenv("GGML_HRX_STRICT", "1", 1);
… build a graph with MUL_MAT whose src[0]->ne[0] % 256 != 0, schedule it …
REQUIRE(plan.status.ok());                       // named "by design", not a refusal

// 2. an UNEXPLAINED off-HRX node still aborts: same graph, K aligned, weight NOT host-resident
… expect the abort, and expect its message to name that node …

If the second arm cannot be built because every reachable off-HRX node is now by-design, that is the finding: the mode has no reachable refusal on this tree, and it should either be documented as advisory or removed rather than merged as a check.

One note on the exemptions themselves: (node->op == MUL_MAT || MUL_MAT_ID) && ne[0] % 256 != 0 is a shape test, not a residency test — so it would also excuse an unaligned matmul whose weight is device-resident. That is correct if the reason is "HRX has no dense schedule for input_size % 256 != 0" (ggml-org#991), which is about the schedule and not the weight; the comment says exactly that, so I am reading it as intended rather than as an accident. If it is meant to be residency-conditioned too, host_weight_is_host_resident() on the weight would be the missing conjunct.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY -- the predicate-sharing is the fix, and the missing piece is an arm for what strict must still refuse

First, a correction to my own ggml-org#2450 comment, because this PR shows the framing there was half-wrong. I wrote that a strict switch which does not stop a CPU-placed node is "a strict switch that reports and does not assert". The truth is the opposite: strict did assert -- GGML_HRX_STRICT=1 SIGABRTed (rc 134) on a model that loads fine without it -- and the defect is that it asserted on a placement the code calls by design, with a message that blamed the shared GTT pool. I had the direction wrong, and this PR measures the right one:

before:  STRICT=1 -> SIGABRT rc=134, "GET_ROWS x 2 ... not placed on HRX", message blames the GTT pool
after:   STRICT=1 -> rc=0 ;  strict unset -> rc=0

The design choice that makes this correct rather than another inert attempt is stated and it is the right one: host_weight_is_host_resident() is the same predicate the residency decline uses, exported and shared, because "my first two attempts compared against HRX's own mapped_buft and therefore measured a different object with a similar name, which is why they were inert." That is the whole difference between a fix and a coincidence, and it is the kind of thing that only gets found by measuring: two similarly-named buffer types, one of which never occurs here.

first_unexplained rather than "any off-node" is the right shape too -- the observer still counts off_by_design (unaligned matmul, or a host-resident weight) so the census keeps reporting the total, while strict aborts on the first thing that is not explainable and names that node. A strict mode that keeps its census is a strict mode people leave on.

The ask -- and it is the one that decides whether strict stays meaningful: there is no test file in this diff. Three source files, no arm. The failure mode this PR could introduce is not a crash, it is strict quietly becoming decorative: broaden the by-design class a little (another buffer type, another usage flag) and a genuine misplacement stops aborting, with nothing to notice but a model that loads when it should not. Concretely, one case in hrx-backend-test (or test-hrx-ops) that:

  1. builds a graph where a tensor lands on the CPU for a reason the predicate does not explain (an unregistered op, or a weight the loader did not map), asserts strict aborts and names it; and
  2. the same graph with the file-mapped weight, asserting strict loads.

The second is what the PR measured by hand; the first is what keeps it honest. hrx strict-diag gives the next person the tool to build it, and its presence is the reason I am asking for the arm rather than merely noting its absence.

Nothing else: the census/WARN string naming the class ("N node(s) read a weight that lives in the loader's file mapping, which ggml must see as host memory") is a message a reader can act on, which is what the old one was not.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@/tmp/r389.md

The review was right: after the by-design classification, nothing exercised either branch, so
strict could have become a mode that never fires.

placement_node_is_by_design() is split into its own translation unit with no ggml dependency
(placement-classification.{h,cpp}) and expressed over FACTS rather than a ggml_tensor, so six arms
run with no device and no ggml link (tests/test-hrx-placement-classification.cpp, modelled on
test-hrx-arena-refusal):

  1 unaligned contraction, ne0 = 1000          -> by design  (ggml-org#991: no HRX dense schedule exists)
  2 aligned contraction + host-resident weight -> by design  (ggml-org#2450: this is the case the fix serves)
  3 aligned contraction, no host weight        -> UNEXPLAINED, so strict still aborts here
  4 non-contraction with a misaligned width    -> ggml-org#991 excuses contractions only
  5 contraction with no src0                   -> unexplained, and does not crash
  6 default-constructed facts                  -> unexplained

Arm 3 is the one that answers the review: without it the mode could be decoration. Arm 2 is the
one that would have caught the two inert attempts at this fix, which compared against HRX's own
mapped_buft instead of the host-resident predicate.

All six pass: 'test-hrx-placement-classification: all cases ok (6 arms, both sides of STRICT)'.
The library and llama-cli still build, and the device behaviour is unchanged (strict=1 rc=0,
strict unset rc=0, measured in the parent commit's ticket).
@bong-water-water-bong

Copy link
Copy Markdown
Author

The arms are in, at 5ced31974.

Six, all host-side, no device and no ggml link (tests/test-hrx-placement-classification.cpp, modelled on test-hrx-arena-refusal):

# facts expected
1 unaligned contraction, ne0 = 1000 by design (ggml-org#991)
2 aligned contraction + host-resident weight by design (ggml-org#2450)
3 aligned contraction, no host weight unexplained → strict still aborts
4 non-contraction with a misaligned width #991 excuses contractions only
5 contraction with no src0 unexplained, no crash
6 default-constructed facts unexplained

To get them link-free the predicate is now its own translation unit with no ggml dependency (placement-classification.{h,cpp}) and is expressed over facts rather than a ggml_tensor; the observer fills the struct. Two build errors along the way were both mine and worth recording: the include landed inside namespace ggml::hrx (which nested it to ggml::hrx::ggml::hrx, so the struct was invisible), and the new .cpp was not in ggml/src/ggml-hrx/CMakeLists.txt (undefined reference at link).

test-hrx-placement-classification: all cases ok (6 arms, both sides of STRICT).

Arm 3 is the one you asked for: an off-node with no named reason stays first_unexplained, so strict still refuses a real misplacement. Arm 2 is the one that would have caught my own two inert attempts — they classified against HRX's mapped_buft instead of the host-resident predicate, and an arm asserting the second class would have failed immediately.

Device behaviour unchanged from the parent commit (strict=1 rc=0, strict unset rc=0, same ticket). The gate's placement row still fails on 2 off HRX — separate decision, still not bundled.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at 5ced319 -- the arm I asked for is here, and it is the two-sided one

tests/test-hrx-placement-classification.cpp now pins placement_node_is_by_design on both sides, which is exactly the piece that keeps strict from becoming decorative:

by-design      unaligned contraction (ne0 = 1000) is by design
by-design      a host-resident weight is by design
unexplained    an aligned contraction with no host weight stays unexplained
unexplained    a non-contraction is not excused by its src0 width
unexplained    a contraction with no src0 is unexplained, not a crash
unexplained    empty facts are unexplained

The three negatives are what I actually wanted, and they are chosen well: "a non-contraction is not excused by its src0 width" is the mutation that a lazy widening would introduce (match on width alone), and "empty facts are unexplained" closes the fail-open direction -- a predicate that returns true for absent information would silently excuse every node. "not a crash" for the missing-src0 case is a nice extra: the predicate must answer, not abort.

And the scope section is the right kind of honesty: the hardware gate's placement row still fails, because the gate's policy is any node off HRX (clean = "0 off HRX" → rc 0). Teaching the gate to accept a named by-design class is a separate decision, deliberately not bundled, and reviewers are told to expect red until it lands. The abort format being unchanged so hw_gate_test.py's parser still matches is the detail that keeps the two from silently diverging -- which is the failure mode of a message-shape change.

Nothing left to ask on this one. The predicate is shared with the residency decline (the reason the earlier attempts were inert), the census keeps its off_by_design count, strict aborts only on first_unexplained and names it, and the diagnostic (hrx strict-diag) stays for the next person.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant