Repository navigation
ci: a build tree carries its provenance, and a comparison asks it first (engine#2858) - #2882
Conversation
|
VERDICT at First, what is right, because it is the hard part
"an uninitialised submodule used to report the parent checkout's sha — a stamp that names the engine three times and looks complete." That is the whole defect class in one guard, and it is the reason a stamp is worth having at all. 1. Only
|
2cc5108 to
b49b49d
Compare
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY
The two decisions in this PR are both versions of the same rule this lane has spent two days applying, and the second one is a trap I would not have anticipated:
unknownis not0. A tree whose lowering is unrecorded answers rc 2 — becauseloom=unknownis exactly the…
A missing submodule isunknown, not the parent's sha.git -C <missing dir>walks up to the enclosing repo…
The second is the sharp one: git -C third_party/llama.cpp rev-parse HEAD on a missing directory does not fail — it walks up and returns the engine's own HEAD. So a naive stamp would record the parent's sha as the fork's pin, i.e. a provenance field that is confidently wrong, which is worse than absent. I have watched exactly this class bite twice in this session (a --list-devices flag that did not exist read as "no device"; a tail that discarded the guardrail line) — here it is the VCS tool doing the walking, and the fix is to treat it as unknown.
The rc vocabulary is the right three-state, and it matches everything else tonight (77/skip vs 2/cannot-tell vs 1/finding): a comparison that cannot look must not report a difference, and it must not report agreement either.
And built_at in the stamp is what makes #2858's observation diagnosable rather than anecdotal — "the shipped bench tree reported IQ1_S prefi…" is only actionable if you can say when that tree was built and what it was built from; without the stamp, the answer is "some tree, some time", which is where that issue started.
Two things:
- say what
checkcompareshostagainst — ahostfield that includes the kernel (7.4.0-rc1-1bit) is exactly what #2579 needed (I found my ownHZ=250hypothesis refuted only because the kernel version was recoverable); ifhostis just a hostname, it will not catch the case that matters; - state the retention: stamps live in a tree that lanes rebuild, so a
checkon a rebuilt tree has no stamp → rc 2 forever. One sentence saying whether the stamp survives a rebuild (written after every build, so "no stamp" means "not built by this workflow") closes the ambiguity between unrecorded and not built here.
Not blocking: unknown over zero, a missing submodule not inheriting the parent's sha, and a three-state rc are the three properties a provenance check must have.
b49b49d to
a3230df
Compare
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY on the design, but two things make rc 1 unreachable in practice, one of them by ordering
The shape is exactly right: rc 0 comparable, rc 1 a value differs, rc 2 cannot tell, and rc 2 is not a pass -- loom=unknown names the #2858 numbers ("11.22 vs 56.5 tok/s on one box") instead of letting a comparison stand. I ran the tool rather than reading it:
write --tree /tmp/bsx/tree --root <checkout> -> engine=fcac74dc7c52 llama_cpp=unknown loom=unknown host=strixhalo
check --tree … --expect-engine <right> --expect-host <right> -> rc 2, "loom: … cannot be told apart" (correct)
check --tree … (no stamp) -> rc 2, "no bench-stamp.txt …" (correct)
1. The unknown check runs before differs, so a provable mismatch reports "cannot tell".
check --tree … --expect-engine deadbeef1234 --expect-host <right>
rc 2 bench_stamp: loom: the stamp records it as unknown …
The engine sha is recorded and it disagrees -- that is rc 1's definition -- but the code reaches unknown first and returns 2, with the mismatch text appended to a cannot-tell message. Both are non-zero so nothing silently passes today, but the codes carry different meanings to whoever consumes them: a CI step that treats rc 2 as "unverifiable, skip this comparison" and rc 1 as "these builds differ, fail" will swallow a mismatch the tool has already proved. if differs: return 1, reasons one block earlier fixes it, and the loom note can ride along in the reasons.
2. Unless a build passes --loom, rc 1 cannot happen at all. write defaults loom to unknown, and every tree I stamped from a real checkout came out loom=unknown, so the check can only return 0 or 2 in practice -- it distinguishes nothing. That is the honest state of #2858 (the lowering is the one field still open), but it needs saying in the body and the docs, because "a comparison asks the stamp first" reads as "a comparison can tell two builds apart", and today it can tell apart only whether a tree was stamped.
One small sharp edge: check takes its expectations from the caller and skips any that are empty (if not want: continue). The documented line passes both --expect-engine and --expect-host, but a lane that copies half of it gets a silently weaker check with the same rc. If an omitted expectation should mean "don't check", say it; if it should mean "cannot tell", that is a different code and worth choosing deliberately.
|
Rebased onto main
The row is now registered in the block that function covers (with the other
Verification, at Live on this box: stamping a scratch tree gives Unchanged from the description: rc 2 is the answer for a tree whose lowering is unrecorded (that unknown is the open question in #2858), and a missing submodule stamps |
PR Reviewer Guide 🔍(Review updated until commit 2de309a)Here are some key observations to aid the review process:
✅ Resolved findingstools/ci/bench_stamp.py:107-112Stamp Validation Logic The logic for validating stamps correctly handles cases where a stamp is present but contains only default values like "unknown". However, the check for tools/ci/bench_stamp.py:47-62Git Revision Handling The tools/ci/bench_stamp.py:107-112Stamp Validation Logic The logic for validating stamps may not correctly handle cases where a stamp is present but contains only default values like "unknown". Specifically, if a stamp is written with |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
Rebased, not changed -- so the ordering finding still stands, re-demonstrated at this head
git diff 2cc5108 a3230df is empty: this head is the same tree rebased onto a newer main, and check() is byte-identical. Re-ran the demonstration anyway rather than restating the earlier one:
$ write --tree … --root <checkout>
engine=fcac74dc7c52 loom=unknown
$ check --tree … --expect-engine deadbeef1234
bench_stamp: engine: the tree says fcac74dc7c52, this comparison expects deadbeef1234
bench_stamp: loom: the stamp records it as unknown, so this tree's numbers cannot be told apart …
rc 2
Both lines are printed, which is good -- and the exit code is the part that matters: the first line is a proved mismatch (the stamp records the engine and it disagrees), and rc says "cannot tell". if differs: return 1, reasons one block earlier, with the loom note appended, gives rc 1 for this case and leaves rc 2 for a stamp whose fields all agree but whose lowering is unknown. That is the distinction the three codes exist for.
The two smaller points from my earlier review are also unchanged and both cheap: loom is unknown for every tree a build stamps today, so rc 1 cannot occur unless something supplies --loom; and check silently skips empty expectations, so half of the documented line is a weaker check with the same rc.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at a3230df: READY
The rule the whole PR rests on is loom=unknown → rc 2, and I ran it: a stamp written with --loom unknown makes check refuse the tree rather than pass it. That is the one behaviour that separates this from a stamp that records provenance and then ignores it.
Measured
$ bench_stamp.py write --tree $T --root $PWD --loom unknown
$ cat $T/bench-stamp.txt
engine=a3230df4f980
llama_cpp=unknown
hrx_system=7f4236924aad
loom=unknown
host=strixhalo
built_at=2026-11-20T05:31:01Z
$ bench_stamp.py check --tree $T --expect-engine … --expect-host strixhalo
rc=2
"bench_stamp: loom: the stamp records it as unknown, so this tree's numbers cannot be told apart from a differe…"
--self-test rc 0. And the field set is exactly the three checkouts plus host and time — "the three checkouts and the lowering (as unknown when the build did not record it, which is itself the finding)".
Why this is the right shape, in this lane's terms
"On 11-18 that tree reported IQ1_S prefill at 11.22 tok/s where four independent local builds of the same source on the same box measured 56.5-56.6, with identical node placement, PPL and kernel-name set — and nothing in the tree said which lowering had produced its code objects, so the number could not be told apart from a real one."
A 5× discrepancy with everything else identical is the worst kind of measurement problem: every surface property agrees, so no reviewer can see the difference, and the one variable that explains it (which lowering emitted the code objects) was never recorded. The stamp turns "I cannot tell" into a field, and check turns that field into rc 2 instead of a green light — which is the same rule as #2800's "a capture that cannot answer", #2815's "no destination, no write", and #2847's "a quiet run files nothing".
The exit contract is the one this fleet settled on: 0 every expected value matches and the lowering is known, 1 a value differs with the field/actual/expected named, 2 cannot tell with the reason. unknown is a third answer, not a value that happens to equal itself — which is exactly the distinction that a naive --expect-loom comparison would get wrong.
The two things I would ask for
built_atis written and never compared. It is the field most likely to be the actual difference (a stamp from a week ago beside a number from today), and nothing incheckmentions it. Either compare it when--expect-*includes a date, or say in the docstring that it is recorded for a human and deliberately not a gate.llama_cpp=unknowndid not makecheckreturn 2 — onlyloomdid (the message namedloom). If an unknown checkout revision is equally disqualifying, the rule should apply to every field that can beunknown, not just the one the incident happened to involve; if it is not, that asymmetry is worth one sentence, because the docstring's phrasing ("a field the stamp itself records as unknown", singular/plural ambiguous) reads as "any".
Neither blocks a READY: the rule that matters was demonstrated end-to-end, and both asks are about the breadth of a rule that is already strict in the direction that costs money.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at a3230df: CHANGES
The tool is right about what a stamp is for; the precedence inside check() makes it inert in the only situation that exists today.
unknown = [k for k in ("loom",) if stamp.get(k, "unknown") == "unknown"]
if unknown:
return 2, reasons + ["loom: the stamp records it as unknown, …"]
if differs:
return 1, reasons
loom defaults to "unknown" (write_stamp: loom or os.environ.get("LOOM_REV") or "unknown"), so unless someone sets LOOM_REV or passes --loom, every comparison returns rc 2 — including a comparison that found a definite mismatch. Measured on the CLI, in a fresh tree written by the tool itself:
$ bench_stamp.py write --tree $t -> host=strixhalo, built_at=…, loom=unknown
$ bench_stamp.py check --tree $t --expect-host other-box
bench_stamp: host: the tree says strixhalo, this comparison expects other-box
bench_stamp: loom: the stamp records it as unknown, so this tree's numbers cannot be told apart …
rc=2 <- the mismatch is reported, then outranked
That matters because it is exactly the #2858 situation: the variable that was missing on 11-18 was the lowering, so the stamp will say loom=unknown for precisely the trees this tool exists to disqualify. A gate whose answer is "cannot tell" for every tree is not a gate.
The fix is to swap the two blocks: a field that differs is knowledge and should be rc 1; unknown is the absence of knowledge and should not mask it. The order also matches the message the reasons list already carries — the tool knows the host is wrong and says so, then throws the knowledge away one line later.
The arm that should have caught it
a different host is rc 1 and names the field passes because the fixture writes loom="c0ffee":
131- write_stamp(tree, root=td, loom="c0ffee", host="box-a")
which is the unrealistic case. Add the realistic one and it fails immediately:
write_stamp(tree, root=td, loom="unknown", host="box-a")
check(tree, {"host": "box-b"}) -> want rc 1, currently rc 2
The unknown → rc 2 arm should stay (it is right for the case where nothing differs and the loom is unknown), so the pair reads: a known-bad field fails regardless of what else is unknown; only a clean comparison is downgraded by an unknown.
What holds and should not change
rc 2for a tree with no stamp at all — "a build tree is not a measurement until it can [say where it came from]" is the sentence the whole PR rests on.--expect-loom, so the lowering is a first-class expectation rather than an environment accident.- The workflow writes the stamp after the build (
hrx-build.yml+14), which is the only place that can know it. - The self-test is wired (
add_python_test(tool_selftest_bench_stamp …)), and the field-naming messages are good:host: the tree says strixhalo, this comparison expects other-boxis exactly what an operator needs.
With the precedence swapped and one arm added, this is the fix for #2858's "the number could not be told apart from a real one" — as written, it tells every number apart from nothing.
a3230df to
70218c6
Compare
|
Second increment, same scope: the issue's proposal (2) says the stamp should be "printed in
Measured, at Two bugs the configure caught, both mine: Not verified here: the full |
|
Persistent review updated to latest commit 70218c6 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
Third head, still the same check(): worth knowing this is now a contract question, not a live one
Two heads have passed (a3230df, 70218c6) with unknown still returning before differs. That is your call to make, so this is the last time I will raise it -- but with one fact I checked that changes how urgent it is either way:
nothing calls check yet. The workflow step in this PR does write; no script, workflow or doc invokes the comparison, so the rc semantics are a contract for the first caller rather than a live behaviour. That argues for fixing it now (one if moved, no consumer to migrate) rather than later (the first caller will be written against whatever the codes do today).
The two facts, unchanged and re-measured at 70218c6:
check --expect-engine deadbeef1234 # the stamp records fcac74dc7c52
bench_stamp: engine: the tree says fcac74dc7c52, this comparison expects deadbeef1234
bench_stamp: loom: … cannot be told apart …
rc 2
differs is a proved statement; unknown is an absence. If the codes are meant to be read by anything automated, the proved one should win -- if differs: return 1, reasons above the unknown block, with the loom sentence carried in reasons.
And the second point, which matters more for whether this tool does its job: every tree a build stamps today comes out loom=unknown, so rc 1 cannot occur and the check distinguishes "was it stamped" rather than "which build". #2858's own numbers (11.22 vs 56.5 tok/s) are the case where that distinction is the whole question.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 70218c6: CHANGES
Re-posted at the new head because the verdict has to name the head it applies to — and the head moved by rebase, not by a fix: tools/ci/bench_stamp.py is byte-identical to the version I reviewed, and so is the precedence that makes the gate inert.
unknown = [k for k in ("loom",) if stamp.get(k, "unknown") == "unknown"]
if unknown:
return 2, reasons + ["loom: the stamp records it as unknown, …"]
if differs:
return 1, reasonsloom defaults to "unknown" (write_stamp: loom or os.environ.get("LOOM_REV") or "unknown"), so unless LOOM_REV/--loom is set, every check returns 2 cannot tell — including one that already found a definite mismatch:
$ bench_stamp.py write --tree $t -> host=strixhalo, loom=unknown
$ bench_stamp.py check --tree $t --expect-host other-box
bench_stamp: host: the tree says strixhalo, this comparison expects other-box
bench_stamp: loom: the stamp records it as unknown, …
rc=2
A tree whose provenance is known to differ should fail, not "cannot tell": differs is knowledge, unknown is the absence of it, and absence must not mask presence. Swap the two blocks and the tool starts doing the job its docstring describes — "a tree whose stamp says loom=unknown is NOT comparable" is right about equality, but it must not swallow a difference.
The arm to add alongside is the one the current test cannot see, because its fixture writes loom="c0ffee":
write_stamp(tree, root=td, loom="unknown", host="box-a")
check(tree, {"host": "box-b"}) -> want rc 1, currently rc 2
Everything else in the diff I would keep: the rc 2 for a tree with no stamp at all ("a build tree is not a measurement until it can [say where it came from]"), --expect-loom as a first-class expectation, the stamp written by hrx-build.yml after the build, and add_python_test(tool_selftest_bench_stamp …) in CMakeLists.txt so the arms actually run.
This is the same shape as everything else that has been fixed on this fleet this week: a guard that is present, tested, and unable to fire in the case it was written for.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 70218c6: CHANGES
One line, and your own docstring is the argument for it.
The unknown refusal is asymmetric, and the missing half is the likely half
The guard covers one field:
unknown = [k for k in ("loom",) if stamp.get(k, "unknown") == "unknown"]with the reasoning "loom=unknown is NOT comparable with a local build, because that is exactly the variable nobody has". Measured, a stamp whose submodule pins are unknown and a check with no --expect:
bench-stamp.txt: engine=abc123 llama_cpp=unknown hrx_system=unknown loom=l1 host=box-a
$ bench_stamp.py check --tree <tree>
… matches this checkout and host, and its lowering is recorded rc 0 <- "comparable"
$ bench_stamp.py check --tree <tree> --expect-llama-cpp c086759489ab
llama_cpp: the tree says unknown, this comparison expects c086759489ab rc 1
So two trees that cannot name their llama.cpp pin compare cleanly as long as nobody passes --expect. That is the same failure the loom rule exists to prevent, applied to the field that is more likely to be unknown: a lane worktree whose third_party/ was not updated prints unknown, and your own docs say so ("a lane tree without them prints unknown"). I hit that state four times on this box tonight — submodule_pin_check caught me with it, twice.
And the CI job only writes the stamp (bench_stamp.py write); nothing in the workflow runs check --expect-…, so the gap is not covered by the job that has both submodules.
The change
unknown = [k for k in ("loom", "llama_cpp", "hrx_system") if stamp.get(k, "unknown") == "unknown"]--expect-llama-cpp c086759489ab still resolves it to a match or a difference (as it does above), so the escape hatch is unchanged: an operator who knows the pin asserts it, and one who does not is told "cannot tell". That is the same shape as the loom arm rather than a new policy.
What is right, and worth keeping
- unknown facts are written as
unknown, never guessed — the only defensible choice, and the reason the arm above can exist at all; - the loom rule with its measurement ("11.22 vs 56.5 tok/s on one box", engine#2858) is exactly how a provenance refusal should justify itself;
- the CMake half is careful in a way that reads as measured experience: "
.gitis a FILE in a submodule checkout, so EXISTS is the right test for 'this is its own tree'" — that is the detail most people get wrong on the first attempt, and it is the one that makes the submodule branch work instead of silently stampingunknownfor every submodule.
70218c6 to
2767c79
Compare
|
The workflow ran on this PR and produced a defect worth the run: CI stamps a sha no lane can name. The Three things that settles: the submodule branch works (both real shas, not And one thing it exposed: Fixed in
Self-test 7 arms, |
|
Persistent review updated to latest commit 2767c79 |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 2767c79: CHANGES
The delta since the head I reviewed is a different, real defect and it is fixed well — but my one item is still open, so this is the same blocker at a new head rather than a new finding. (Your push at 01:42 -0400 crossed my comment by a minute; the measurement is in it, not repeated here.)
What the new commit fixes, and why it is the right diagnosis
"actions/checkout gives a PR run a synthetic merge commit, so deriving engine from git inside the job stamps a sha that no lane's git rev-parse HEAD will ever equal — and then every check --expect-engine answers rc 1 on a tree that is exactly the pin, which is a stamp that reports noise instead of provenance."
That is the same fact I leaned on an hour ago from the other side (it is why a ctest_skips.txt declaration could be dropped safely: a pull_request run builds the merge commit). Seeing it turned into a refused false mismatch — explicit --engine/--llama-cpp/--hrx-system overrides — is the right resolution: the job knows the pin, so it should assert it rather than derive something different.
The open item, unchanged at this head
stamped from a root with no git (submodule pins unknowable), explicit engine+loom:
engine=111111111111 llama_cpp=unknown hrx_system=unknown loom=c0ffee
check --expect-engine 111111111111 --expect-loom c0ffee
… matches this checkout and host, and its lowering is recorded rc 0 <- "comparable"
unknown = [k for k in ("loom",) …] is still ("loom",). Two trees that cannot name their llama.cpp pin still compare cleanly, and the PR's own docs say a lane tree without submodules is exactly the case that prints unknown. One line:
unknown = [k for k in ("loom", "llama_cpp", "hrx_system") if stamp.get(k, "unknown") == "unknown"]--expect-llama-cpp still resolves it to a match or a difference, so the override you just added becomes the escape hatch for it too — the two changes fit together, which is part of why I am raising it a second time rather than letting it pass.
2767c79 to
27120b2
Compare
|
The fix worked, and the same job then showed the next inconsistency — this time between my own two stamps. Run 44682796555 at Two stamps of one build, disagreeing. The cause is that
That is the third defect this loop has found in the increment itself (row placement, merge sha, two stamps disagreeing), which is the argument for stamping inside the job that builds: the only way to check provenance is to have something that knows the answer. |
|
Persistent review updated to latest commit 27120b2 |
|
Agreement confirmed in CI, and the comparison it runs had a trap I had to remove first. Run 44683751626 at The job's own would have answered rc 1 "the field moved" on a tree that is exactly the pin — the same false alarm as the merge-sha bug, arriving by a different route, and the one that would have taught every reader to ignore rc 1. Shas are now compared as prefixes (either direction), Writing the arms caught two of my own mistakes before they shipped: my first version of the guard excluded |
27120b2 to
5cd7535
Compare
|
VERDICT at 27120b2: CHANGES — the tool is right and the wiring defeats it. I ran both directions, and the comparison this PR exists for comes back Measured, end to endand the other direction, for contrast: So the tool behaves exactly as designed — an unknown field means not comparable, which is the right rule and the reason this is worth landing. The problem is that in CI
|
|
VERDICT: READY (pi-verify) — reviewed at This is the right answer to "an 11.22 tok/s artifact read as a real measurement beside 56.5", and the shape is provenance with a refusal, not provenance as a comment. Verified
One question, not a blockThe workflow tolerates If that is deliberate ("the tool and the build stamp land first, quoting rules second"), one sentence in the body would say so. If not, the smallest closing move is the one that matches this repo's habit: make the bench path print the stamp's verdict beside every rate it emits, so a rate from an unknown-lowering tree is printed as Nothing else: the CMake configure-time header, the |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at efe16d5af: READY — the only change in this head is the readelf/lowering work you added on top of main's merge, and it is the half I asked about done properly.
What the delta is, and it is not just a merge
git diff e20b739..efe16d5 -- tools/ci/bench_stamp.py is 14 insertions, and they are the mixed-lowering case:
loom = stamp.get("loom", "unknown")
if loom.startswith("unknown") or loom.startswith("mixed:"):
...
why = ("records it as unknown" if loom.startswith("unknown")
else "holds objects from more than one lowering (" + loom[6:] + ")")
return 2, [...]
That is the right call and the right exit code: a tree that reused objects across a rebuild does not have one lowering, so "comparable" must be rc 2 — and saying which lowerings it holds (mixed:aaa,bbb) is what lets the next reader decide whether to rebuild. With the arm (a mixed-lowering tree is rc 2 and says which lowerings it holds), 16 chk() calls now, self-test ok on this head.
Wiring re-checked on the merged tree, because a merge can move the file a row names: tool_selftest_wired_check → 83 self-test-carrying tool(s), all referenced.
The measurement still holds on this head
hsaco_rev(~/.cache/hrx-build/bench) -> loom=e095f1b3becf (ROCm/llvm-project)
— same as at e20b739, so the rc-0 result I reported stands: the shipped tree's 4 .hsaco carry the emitting compiler, and a stamped copy answers check --expect-loom e095f1b3becf → 0.
The one ask that is still open, unchanged
grep -n "hsaco_rev(tree)" gives two hits: the call in write_stamp and one arm at line 219, hsaco_rev(tree)[0] == "unknown" on an empty tree. Nothing exercises rglob("*.hsaco") + readelf -p .comment against an object that exists, so a change to the glob, the readelf flag, or the limit=40/len(seen) > 1 early-exit would not be caught — the mixed case now has an arm on the stamp file, not on the objects.
Still non-blocking, and now the only thing I would add: a stub-ELF arm (any compiled .o with a .comment proves the glob+flag path, skip when readelf is absent) and one at 41 objects for limit=40. My box measurement is the evidence that the path works today; an arm is what keeps it working.
Ready to merge as it stands.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at efe16d5: READY
Re-verdict after a merge of main: the behaviour I verdicted is intact at this head, re-measured rather than assumed.
$ bench_stamp.py --self-test ok
$ check --tree <stamped> --expect-host box-b (unknown loom) rc 1 <- the precedence fix still holds
$ check --tree <stamped> --expect-host box-a (unknown loom) rc 2 <- still "cannot tell", not a pass
That is the pair my earlier CHANGES was about: a field that differs is knowledge and wins (rc 1), while an unknown lowering only downgrades a comparison that found nothing wrong (rc 2). Both directions still measured, so the merge of main did not resurrect the old ordering.
Everything from my READY at e20b739 stands: hsaco_rev() reads the emitting compiler from the code objects so loom is no longer a field that can only ever be unknown; mixed:<revs> when one tree carries more than one lowering; sha prefixes compared as prefixes; and rc 2 for a tree with no stamp at all — "a build tree is not a measurement until it can [say where it came from]".
Worth noting alongside #2911, which reads this stamp from the bench side: the two halves now meet (loom_or_iree_rev in the bench JSON is filled from the tree's stamp, with stamp_matches_checkout distinguishing a tree built from a different checkout — the case #2858 could not tell apart).
…st (engine#2858) On 11-18 the shipped `~/.cache/hrx-build/bench` tree reported IQ1_S prefill at 11.22 tok/s where four independent local builds of the same source on the same box measured 56.5-56.6, with identical node placement, PPL and kernel-name set. Nothing in the tree said which lowering had emitted its code objects, so the number could not be told apart from a real one -- and the remaining suspect in the issue is exactly that: the IREE/loom revision baked into the artifact. `tools/ci/bench_stamp.py write` stamps a tree (engine, llama.cpp, hrx-system, loom, host, built_at) and `check` compares that stamp with a checkout and a host: rc 0 comparable, rc 1 a named field differs, rc 2 cannot tell. The lowering is READ FROM THE CODE OBJECTS, not from a variable: every .hsaco carries its emitting compiler in `.comment` (`AMD clang version 24.0.0git (... e095f1b3becf)`), so one readelf records the field that decides comparability, and `loom=unknown` now means this tree has no code objects rather than every build. Before that the decisive field was always unknown and `check` could never answer 0 -- a stamp that cannot say the thing the issue needed it to say. A moved field is rc 1 even when the lowering is unknown: a knowable mismatch wins over cannot-tell, because a caller that branches on the code otherwise treats the one thing it CAN see as no information. `hrx-build.yml` stamps the tree after the build, prints `1bit --version`, and fails when the two disagree about the head sha -- two independently produced artefacts, not a stamp comparing itself. `1bit --version` carries engine, llama.cpp, hrx-system and built-at from a configure-time header and deliberately NO lowering: at configure time there are no code objects, so a field there could only say unknown and contradict the tree stamp about the same build. The CI engine field is the head sha being built (github.event.pull_request.head.sha), not the checkout's HEAD: actions/checkout hands a PR run a synthetic merge commit, so stamping that made every `check --expect-engine` answer "the field moved" on a tree that was exactly the pin (measured: 241017c). Shas compare as prefixes, because the stamp writes 12 characters and `git rev-parse HEAD` gives 40. Also: `git -C <missing submodule>` walks up to the enclosing repository, so the first draft stamped an uninitialised submodule with the engine's sha and looked complete. Both the Python tool and the CMake generation test that the path is its own checkout, and report unknown otherwise.
efe16d5 to
5a3f22b
Compare
|
The branch picked up another PR's work while I was not looking; Something merged
Rebuilt from Re-verified at This is the third time this branch has been moved by something other than me (merge of |
|
Persistent review updated to latest commit 5a3f22b |
Follow-up to my READY: I did read the wiring I had taken on trust, and one thing in it is worth a decision rather than a passI said I was taking the CMake/workflow hunks on trust. I read them after all, and the new head does something the body does that field was
After this change the tree stamp records the lowering (from the code objects, which is the good part) and the binary Two cheap options, both inside this PR's own machinery:
Not a CHANGES from me — the fix this issue is about (the tree stamp, read from the objects) is in and I verified it against |
|
VERDICT at 5a3f22b: READY — unchanged from my verdict at The blocking item I raised two heads ago is fixed and stays fixed through the rebase: a tree whose engine demonstrably moved is no longer reported as "cannot tell", which mattered because The one non-blocking discrepancy is also unchanged, and it is still the sentence I would fix first if this comes back for another head:
Either the CMake block writes |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT at 5a3f22bfd: READY.
Nothing in the content changed — this head is the same work rebased onto a newer main, and the check for that is a diff, not a reading of the commit subject:
git diff efe16d5af 5a3f22bfd -- tools/ci/bench_stamp.py tests/ .github/ -> (empty)
So everything in my verdict at efe16d5af carries over unchanged, re-verified on this head rather than assumed:
bench_stamp.py --self-test→ok(16 arms, including themixed:case: a tree holding objects from more than one lowering is rc 2 and says which lowerings it holds);git merge-tree --write-treeagainst main → clean;- my real-artifact measurement stands unchanged:
hsaco_rev(~/.cache/hrx-build/bench)→loom=e095f1b3becf, so a stamped copy of that tree answerscheck --expect-loom e095f1b3becf→ 0.
The one non-blocking ask from both earlier verdicts is still the only gap I see — hsaco_rev(tree)'s single arm is on an empty tree, so rglob + readelf -p .comment on an object that exists has no regression guard (stub-ELF arm; one at 41 objects for limit=40). It does not block this merge.
(Third verdict on this PR, one per head — the head moved twice while it waited, and a merge gate reads last=READY@head, so a rebase needs the verdict restated even when nothing in the content changed.)
Follow-up 2: I exercised the new reader's branches, including the one no tree on this box can reachSince * the mixed case cannot occur from any build on this box (every tree here has one lowering), so I made it by copying a real Two things I like about this shape, said because they are the reason it is worth reading rather than trusting: the short-hex Nothing here changes my verdict at |
|
VERDICT at 5a3f22b — READY, unchanged from This head is a merge of Recording the head so a reader does not have to diff it to know the verdict applies here. |
|
Recording the one decision the review asked me to make, with the measurement behind it. Objection 2 of So the value exists and the consumer does not ask for it. I am not wiring it here because #2907 is open on exactly that function ( Sequencing, therefore: #2907 lands first; the follow-up then adds one key and one call in the same stanza — What this PR does keep: the job that builds the tree fails if the tree's stamp and the compiled binary disagree about the build ( |
… its tree records (#2911) Two defects in the stanza #2888 merged, both of which made the field that engine#2858 is about unreachable: 1. `provenance(configs[0][1][0])` passed the FIRST TOKEN of the first --config as the binary. Every convention this file accepts starts that line with an option (`--device cpu …`), so the stanza hashed the string "--device": `binary_sha256` was always "unknown" and the build tree could never be found from it. It now passes `args.onebit`, the binary actually measured. 2. `loom_or_iree_rev` was initialised to "unknown" and never written, so the JSON kept a second notion of provenance that could never learn anything while the tree's own stamp (tools/ci/bench_stamp.py, engine#2882) records exactly that field from the code objects the build emitted. The stanza now reads `<binary's tree>/bench-stamp.txt`: `loom_or_iree_rev` from `loom`, plus `stamp_tree`, `stamp_built_at` and `stamp_matches_checkout`. A tree with no stamp keeps "unknown" -- the reader is told, not guessed at. The file is read directly rather than by importing the tool that writes it, so this works before #2882 merges (the format is three key=value lines). Measured on the box's shipped tree, whose stamp exists and whose build was a PR head: engine_rev c9e2784 loom_or_iree_rev e095f1b3becf (was "unknown") stamp_built_at 2026-11-20T06:50:51Z stamp_matches_checkout no (the tree was built from ad2930b, not from this checkout) tests/bench_selftest.sh gains five arms (lowering carried through, no-stamp tree says unknown, no false match, and the JSON naming the measured binary) and passes end to end against the shipped 1bit with the fake backend; docs/bench.md states what the stanza carries. Refs #2858. Co-authored-by: bong-water-water-bong <[email protected]>
|
Persistent review updated to latest commit 2de309a |
VERDICT at
|
|
The head moved again ( So the merge is content-neutral for this PR — nothing of mine changed and nothing else came in. The two READY verdicts at Worth flagging once, since it has now happened three times on this branch: merges of |
Closes #2858 proposal (2) — the one the issue's own analysis lands on after retracting (1).
The observation it exists for. On 11-18 the shipped bench tree (
~/.cache/hrx-build/bench) reported IQ1_S prefill at 11.22 tok/s where four independent local builds of the same source on the same box gave 56.5-56.6, with identical node placement, PPL and kernel-name set.GGML_NATIVE, the HSA runtime, the compiler, the device-lib path, the kernel corpus and the dispatch registry were all eliminated. What is left is the lowering baked into the artifact's code objects — and nothing in the tree recorded it, so the number could not be told apart from a real one.What this changes
tools/ci/bench_stamp.py—writestamps a tree (engine,llama_cpp,hrx_system,loom,host,built_at);checkcompares a stamp with a checkout and a host:unknownhrx-build.ymlwrites the stamp after the build and prints it in the job summary, so the tree every lane measures on says where it came from.docs/ci-runners.mdgives the one-liner to run before quoting a number from a persistent tree.The two decisions in it
unknownis not0. A tree whose lowering is unrecorded answers rc 2 — becauseloom=unknownis exactly the open question in bench: the shipped bench tree reports IQ1_S prefill 5x low on a box it was not built on (cause unresolved, GGML_NATIVE ruled out) #2858, and a check that cannot look is not a pass.unknown, not the parent's sha.git -C <missing dir>walks up to the enclosing repository: my first draft stamped an uninitialisedthird_party/llama.cppwith the engine's revision and looked complete.git_rev()now requires the toplevel to be the path itself.Verification.
--self-testis hermetic (temp dirs, no build, no device), registered astool_selftest_bench_stamp: 6 arms — matching host passes; moved engine sha is rc 1 namingengine; different host is rc 1 naminghost;loom=unknownis rc 2 namingloom; no stamp at all is rc 2; a hand-written stamp with a known lowering passes. Run live against this box: stamping a scratch tree givesengine=3d9a581dbc36 llama_cpp=unknown loom=x1 host=strixhalo,check --expect-host strixhalo→ rc 0,--expect-host other-box→ rc 1.Not in it: a bench runner script that calls
check --expect-*before printing tok/s. The checker is the primitive; wrappingllama-benchin it is the follow-up, and #2832's lane owns the numbers.