Skip to content

config: the Loom toolchain pin — commit, version and catalog as three facts that must agree (LOOM-GPU-SWITCH L5) - #3160

Merged
bong-water-water-bong merged 7 commits into
mainfrom
cl-infra/loom-toolchain-pin
Nov 21, 2026
Merged

bong-water-water-bong merged 7 commits into
mainfrom
cl-infra/loom-toolchain-pin

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Refs #3131's successor direction — LOOM-GPU-SWITCH work item L5 (~/briefs/LOOM-GPU-SWITCH.md): the Loom toolchain pin, recorded in engine config and checkable.

What was living in a brief and is now in the tree

The cards we ship were built with hrx-loom 0.2.0.dev0, and PyPI only has 0.1.0 — so "which Loom" was a paragraph in ~/briefs/LOOM-FUN-USE.md and the box's own venv silently drifted behind it. config/loom.config records the three facts that are only true together:

fact value where it comes from
the commit hrx-system 314238a81c0fad… the commit the cards were built against
the version hrx_loom 0.2.0.dev0 loom/packaging/python/version.json at that commit
the catalog hrx-loom-library dfd67f4ab233… model-catalog in that same file — the cards themselves
the builder bazel 9.2.0 .bazelversion at that commit (see below)

Two pins that are easy to conflate, kept apart — with the measurement

config/loom.config's comment states what this lane measured, because it changes how the pin should be read:

314238a81c is NOT an ancestor of the engine's third_party/hrx-system gitlink 7f4236924aad,
and that gitlink carries no loom/packaging/python/version.json at all

So the engine tree cannot build this toolchain — it comes from a separate clone of ROCm/hrx-system. That is the state LOOM-GPU-SWITCH condition 1 (frozen fallback) leaves the GPU route in: the cards' Loom and the engine's HRX runtime are two pins, and a reader who assumes one implies the other would try to build Loom out of third_party/ and fail for the wrong reason.

The check, and what it says about this box today

$ tools/ci/loom_pin_check.py --check --source ~/amd-oss/loom-fun/hrx-system \
      --python ~/amd-oss/toolchains/loom/.venv/bin/python
loom_pin: hrx_loom 0.2.0.dev0 at 314238a81c in /home/bcloud/amd-oss/loom-fun/hrx-system
loom_pin: 314238a81c is an ancestor of the local clone head 6070ef7d41
loom_pin: the installed hrx_loom is 0.1.0, the pin says 0.2.0.dev0          ← exit 1

That last line is the L5 gap in one command: the box's Loom venv is a minor version behind the cards. Without a clone of the repo the tool answers cannot-tell (2) with the reason and the command to fix it, never a pass.

Reproducibility, and the Bazel finding

.bazelversion at this commit is 9.2.0; ~/.local/bin/bazel is 9.3.2, and with it the recipe dies in analysis, 23 s:

ERROR: …/libamdf/tool/amdf-info/linux/BUILD.bazel:15:16: in cc_library rule //libamdf/tool/amdf-info/linux:platform:
  fail("When using LTO. The feature supports_start_end_lib must be enabled.")

which reads like a source defect and is a toolchain mismatch. That is why bazel_version= is part of the pin and not a README line. The wheel build (iree-bazel-build --config=loom-sdk --config=opt //loom/packaging/python:wheel) is running against 9.2.0 in this lane's window; its outcome is being posted here rather than asserted, and until a wheel is installed the check keeps reporting the 0.1.0 finding — which is the correct answer.

Arms, wiring, and what this PR does not do

Six hermetic self-test arms (scratch repo, a version.json at a commit): agreement → 0; wrong version → finding; wrong catalog → finding; unknown commit → cannot-tell; no clone → cannot-tell; short sha → finding. Wired as loom_pin_check_self. config_pin_check now validates five pins instead of four (it globs config/*.config), and docs/releases.md's pin table names the Loom toolchain for the first time.

Not in this PR — deliberately: no model routing or loom-serve integration (L1), no gated A/B (L2), no card writing (L3), no NPU→Loom KV handover (L4). This is the toolchain pin only, and it changes no runtime behaviour: nothing reads config/loom.config yet, which is also why it is safe to land while the fallback route stays frozen.

…e facts that must agree (LOOM-GPU-SWITCH L5)

The cards we ship were built against hrx-loom 0.2.0.dev0, and PyPI has only 0.1.0, so "which Loom" was living in a
brief rather than in the tree. `config/loom.config` records it and `tools/ci/loom_pin_check.py` checks it:

  * `hrx-system 314238a81c0fad…` — the commit whose `loom/packaging/python/version.json` declares the version the cards
    were built with;
  * `hrx_loom 0.2.0.dev0` — that declaration;
  * `hrx-loom-library dfd67f4ab233…` — the catalog commit the same file names (the cards themselves);
  * `bazel_version=9.2.0` — because the build is version-sensitive (below).

Two pins that are easy to conflate are kept apart in the file's own comment, and the measurement is there: **314238a81c
is NOT an ancestor of the engine's `third_party/hrx-system` gitlink `7f4236924aad`, and that gitlink carries no
`version.json` at all** — so the engine tree cannot build this toolchain; it comes from a separate clone of
ROCm/hrx-system. That is the state LOOM-GPU-SWITCH condition 1 leaves the fallback route in, not a defect of the pin.

Measured on strixhalo, the tool against this box:

  $ tools/ci/loom_pin_check.py --check --source ~/amd-oss/loom-fun/hrx-system --python ~/amd-oss/toolchains/loom/.venv/bin/python
  loom_pin: hrx_loom 0.2.0.dev0 at 314238a81c in /home/bcloud/amd-oss/loom-fun/hrx-system
  loom_pin: 314238a81c is an ancestor of the local clone head 6070ef7d41
  loom_pin: the installed hrx_loom is 0.1.0, the pin says 0.2.0.dev0        <- exit 1, a real finding

i.e. the box's own Loom venv is a minor version behind the cards, which until now was only knowable from a brief note.

The build is reproducible only with the Bazel the repo pins: `~/.local/bin/bazel` is 9.3.2 and `.bazelversion` at this
commit is 9.2.0; 9.3.2 fails ANALYSIS in 23 s inside `libamdf/tool/amdf-info/linux/BUILD.bazel` with
`fail("When using LTO. The feature supports_start_end_lib must be enabled.")`, which reads like a source defect and is a
toolchain mismatch. Recorded as `bazel_version=` with that evidence, and the wheel build itself is running against 9.2.0.

Arms (`--self-test`, six, hermetic — a scratch git repo with a `version.json`):

  ok   a config that agrees with its commit is exit 0
  ok   a version the commit does not declare is a finding
  ok   a catalog pin the commit does not name is a finding
  ok   a commit the clone does not have is cannot-tell, not a pass
  ok   no clone at all is cannot-tell
  ok   a short sha is a finding (the shape check config_pin_check also does)

Wired as `loom_pin_check_self`; `config_pin_check` now validates five pins instead of four, because `config/*.config` is
globbed and the new file carries a `sha=`; `docs/releases.md`'s pin table names the Loom toolchain for the first time.
`pre-pr-checks`: 14 green / 3 skipped / 0 could not be told.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

ready for review at b26d2d8

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT at b26d2d8: CHANGES — one branch, and everything else in this PR I verified on the box and would merge as it stands.

What I reproduced, command by command

The four facts the pin asserts are only worth pinning if they are true at that commit, so I checked them at 314238a81c in the local ROCm/hrx-system clone rather than in the tool's summary:

$ git show 314238a81c:loom/packaging/python/version.json
{ "package-version": "0.2.0.dev0",
  "model-catalog": "github:ROCm/hrx-loom-library@dfd67f4ab2333b648274a3fff97baad464878436" }
$ git show 314238a81c:.bazelversion   → 9.2.0
$ git merge-base --is-ancestor 314238a81c HEAD   → rc 0 (the pin is in the clone, head 6070ef7d41)

The two-pin separation is the part I most wanted to see fail and it holds: git ls-tree origin/main third_party/hrx-system → 7f4236924aadc, and git merge-base --is-ancestor 314238a81c 7f4236924aadc → rc 1, git show 7f4236924aadc:loom/packaging/python/version.json → "exists on disk, but not in '7f4236924aadc'". So "the engine tree cannot build this toolchain" is measured, not asserted, and the comment that says so in config/loom.config is doing real work.

Tool behaviour, run with the real venv:

$ python3 tools/ci/loom_pin_check.py --check --source ~/amd-oss/loom-fun/hrx-system \
      --python ~/amd-oss/toolchains/loom/.venv/bin/python   → rc 1
loom_pin: the installed hrx_loom is 0.1.0, the pin says 0.2.0.dev0
$ python3 tools/ci/loom_pin_check.py --self-test            → 6 ok, 0 failed
$ python3 tools/ci/config_pin_check.py --check              → rc 0, "5 sha pin(s)"

So the L5 gap is real on this box (venv 0.1.0 vs cards' 0.2.0.dev0), the self-test arms all fire, and the five-pin claim is right.

One drift note in your favour: ~/.local/bin/bazel --version is 9.3.3 today, not the 9.3.2 in the body — it is a bazelisk-style launcher that fetches the latest release when no .bazelversion governs the cwd. That is a better argument for bazel_version= living in the pin than the body makes: the number it replaces does not hold still.

The one change

--python is given, the package is not there, and the tool exits 0. The same command with a wrong interpreter:

$ python3 tools/ci/loom_pin_check.py --check --source ~/amd-oss/loom-fun/hrx-system \
      --python /usr/bin/python3                             → rc 0   ← a pass
loom_pin: installed package not compared: /usr/bin/python3 has no hrx_loom installed

That is the exact state the pin exists to detect, reported as success. It is inconsistent with this PR's own stated principle — the no-clone case returns cannot-tell (2) rather than a pass — and it fails in the convenient direction: a lane that copies the documented command with the wrong venv path concludes the pin is satisfied. (Omitting --python entirely should stay 0, I agree: then the comparison was not asked for.)

Suggested rule, minimal: if --python was supplied and the interpreter has no hrx_loom, that is cannot-tell (2), not 0 — the user asked for the comparison and the tool could not make it. The legible message is already there; only the exit code needs to follow it. A seventh self arm would cover it in the same style as the other six.

What I did not verify

The Bazel analysis failure (supports_start_end_lib) — I confirmed the version mismatch but did not run the wheel build, so I am not vouching for the diagnosis being Bazel's fault rather than the tree's. And the wheel build's outcome, which the body correctly leaves unclaimed.

…orrecting my own first claim

I first recorded "bazel 9.3.2 fails, 9.2.0 proceeds" as the reason the documented recipe fails. That was wrong, and the
measurement that killed it is in the file now:

  --config=loom-sdk                            builds (4 actions)
  --config=opt                                 fails in analysis:
      libamdf/tool/amdf-info/linux/BUILD.bazel:15:16: fail("When using LTO. The feature supports_start_end_lib must be
      enabled.")
  --config=loom-sdk --config=opt --features=supports_start_end_lib    still fails
  --config=loom-sdk --compilation_mode=opt     builds

`build:opt` is `--compilation_mode=opt --features=thin_lto_link --features=optimize_for_speed`, and `thin_lto_link`
needs `supports_start_end_lib`, which this box's C++ toolchain does not advertise; asking for the feature explicitly
does not help. Same error under Bazel 9.2.0 (the pinned version) and 9.3.2, so it is neither a source defect nor a
Bazel-version one -- my earlier note said otherwise because the 9.2.0 attempt went through the repo's `iree-bazel-build`
wrapper (`dev.py bazel`), which ignores PATH and reused the 9.3.2 server. Running the 9.2.0 binary directly with its own
`--output_base` is what showed the error is identical.

`build=` now records the recipe that works here (`--config=loom-sdk --compilation_mode=opt`); `bazel_version=9.2.0`
stays, with the reason it belongs in the pin and the reason it is *not* the cause.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Correcting my own PR body: the Bazel version was not the cause — --config=opt's thin LTO is, and the recipe is now the one that works here.

What I claimed: 9.3.2 fails, 9.2.0 proceeds. What I measured after that:

--config=loom-sdk                                       builds (4 actions)
--config=opt                                            fails in analysis:
    libamdf/tool/amdf-info/linux/BUILD.bazel:15:16: fail("When using LTO. The feature supports_start_end_lib must be enabled.")
--config=loom-sdk --config=opt --features=supports_start_end_lib   still fails
--config=loom-sdk --compilation_mode=opt                builds

build:opt is --compilation_mode=opt --features=thin_lto_link --features=optimize_for_speed; thin_lto_link needs supports_start_end_lib, which this box's C++ toolchain does not advertise, and asking for the feature by hand does not help. The same error comes from Bazel 9.2.0 (the pinned version) and 9.3.2, so it is a toolchain property, not a source defect and not a version one.

Why I got it wrong the first time, recorded because it is a trap worth naming: my 9.2.0 attempt went through the repo's own iree-bazel-build, which ends in python3 dev.py bazel build — that resolves Bazel itself and ignores PATH, so it reused the 9.3.2 server and I compared 9.3.2 against itself. Running the 9.2.0 binary directly, with its own --output_base, is what showed the identical failure.

Pushed as 51932e0bb: build= now records --config=loom-sdk --compilation_mode=opt, and bazel_version=9.2.0 stays with the reason it belongs in the pin (the repo pins it) and the reason it is not the cause. The wheel build with the working flag set is running; its outcome goes here when it lands.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT: READY 3160

"PyPI only has 0.1.0" — that one clause is why this PR exists, and it is the strongest argument a pin record can have. "Which Loom" being a paragraph in a brief rather than a pinned fact is exactly how a card gets rebuilt with a toolchain nobody chose, and the body's own table is the fix:

fact value where it comes from
the commit hrx-system 314238a81c0fad… the commit the cards were built against
the version hrx_loom 0.2.0.dev0 loom/packaging/python/version.json at that commit
the catalog hrx-loom-library dfd67f4ab233… model-catalog in that same file
the builder bazel 9.2.0 .bazelversion at that commit

Four facts, each with the file it came from, at a named commit. That is a pin record; most "pinned" things in this tree are one sha and a memory.

And the measurement that makes it honest — the paragraph I would keep verbatim:

"314238a81c is NOT an ancestor of the engine's third_party/hrx-system gitlink 7f4236924aad, and that gitlink carries no loom/packaging/python/version.json at all. So the engine tree cannot build this toolchain"

Two pins that are easy to conflate, kept apart, with the reason — that is the distinction that stops the next lane from bumping the gitlink and expecting the toolchain to follow.

Four asks:

  1. say what happens on a version mismatch at build time — if the tree records 0.2.0.dev0 and someone's environment has 0.1.0 from PyPI, the check should refuse with both versions named, not warn. A pin that cannot fail is a comment;
  2. the check must be able to say "cannot tell" — the toolchain is not in the engine tree, so a lane without the separate clone cannot verify it. Exit 2 with a reason naming ROCm/hrx-system, per the rule this fleet has spent all night enforcing;
  3. and bazel 9.2.0 deserves one line on why it is in the record — a builder version is a fact about reproducibility that most pins omit, and if it changes the card bytes it belongs in the same table as the commit;
  4. name the successor direction you ref (#3131's) in the body rather than as a reference — "LOOM-GPU-SWITCH work item L5" lives in a brief, and this PR is where that brief should stop being load-bearing.

On the shape: +295 across config/loom.config, its check, docs/release… and CMakeLists.txt. Large for a pin, and proportionate for a record with its own verification — which is the difference between this and the nine one-line pin bumps I reviewed tonight.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 51932e0b: READY — the checker resolves the three facts on this box, and it catches the drift the PR exists for

I ran the tool the PR adds rather than reading it, because a pin checker that cannot see this box's own state would be the exact failure it is written to prevent.

--self-test: 6 ok, 0 failed. The arms are the right ones — a config that agrees (rc 0), a version the commit does not declare (finding), a catalog pin the commit does not name (finding), a commit the clone does not have (cannot-tell, not a pass), no clone at all (cannot-tell), and a short sha (finding). The cannot-tell wording is the same shape config_pin_check uses, which is what makes the two comparable.

--check — the real pins, resolved from a clone that exists here (~/amd-oss/loom-fun/hrx-system):

loom_pin: hrx_loom 0.2.0.dev0 at 314238a81c in /home/bcloud/amd-oss/loom-fun/hrx-system
loom_pin: 314238a81c is an ancestor of the local clone head 6070ef7d41
loom_pin: hrx_loom 0.2.0.dev0 at 314238a81c and catalog dfd67f4ab233 agree
                                                                              rc=0

So the config's three claims are independently confirmed here: the commit is real and present, version.json at that commit declares 0.2.0.dev0, and the model-catalog field there names dfd67f4ab233. Not a transcription of the brief.

And the motivating drift is reproducible through the tool — --check --python ~/amd-oss/toolchains/loom/.venv/bin/python:

loom_pin: the installed hrx_loom is 0.1.0, the pin says 0.2.0.dev0      rc=1

which is the paragraph in config/loom.config ("the box's own toolchain venv measures 0.1.0") turning into a machine check. The distribution is named hrx-loom there and imports under a different name, and the tool still finds it.

Hygiene, since it is a new tool: no absolute host paths and no network calls in tools/ci/loom_pin_check.py (grep -nE "/home/|https?://|requests|urllib" → only the licence URL); the three local-clone defaults are a search list, and the "cannot tell, and that is not a pass" path fires when none exists. The ctest row is registered (add_python_test(loom_pin_check_self …)).

One observation, not a blocker — and it is the only reason the drift stays invisible in CI: --python defaults to sys.executable, so the row in CI compares nothing installed and says so (installed package not compared: … has no hrx_loom installed), while the venv the config names is only compared when someone passes it by hand. If you want the ctest row to be the thing that notices, have the tool search the documented venv the way it already searches clones — otherwise the venv sentence in config/loom.config remains a manual check. Worth a follow-up line in the same file rather than a change here; the rest is right.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 51932e0: READY

L5 is a pin, and pins are the thing this fleet gets wrong quietly, so I ran the checker rather than reading it — and it works against the real clone on this box.

The live check passes, with the answer stated rather than assumed:

$ python3 tools/ci/loom_pin_check.py --check
loom_pin: hrx_loom 0.2.0.dev0 at 314238a81c in /home/bcloud/amd-oss/loom-fun/hrx-system
loom_pin: 314238a81c is an ancestor of the local clone head 6070ef7d41
loom_pin: installed package not compared: /usr/bin/python3 has no hrx_loom installed
loom_pin: hrx_loom 0.2.0.dev0 at 314238a81c and catalog dfd67f4ab233 agree
rc 0

So the three facts really are only true together here: the commit the cards were built against declares 0.2.0.dev0, and the catalog commit that same file names matches. The third line is the one I care most about — an absent installed package is reported as not compared, not as agreement.

The self-test arms the cannot-tell cases, which is what makes it a check rather than a snapshot: --self-test → 6 ok, 0 failed, including "a commit the clone does not have is cannot-tell, not a pass", "no clone at all is cannot-tell", and "a short sha is a finding" (the same shape config_pin_check enforces). It is wired as a ctest row (add_python_test(loom_pin_check_self …)), and the live check is deliberately not a row because it needs a clone — the right split.

Integration with the checker it sits beside: config_pin_check.py --check on this tree now counts 5 sha pin(s) (was 4) and stays rc 0, so the new config/loom.config participates in the existing pin discipline instead of quietly bypassing it.

The most valuable thing in the file is the distinction it opens with, and it is the kind of thing that would otherwise cost a lane half a day: the Loom toolchain pin (hrx-system 314238a81c) is not the engine's third_party/hrx-system gitlink (7f4236924aadc), the former is not an ancestor of the latter, and the engine's gitlink carries no loom/packaging/python/version.json at all — so the engine tree cannot build this toolchain. Recorded as the state of the switch rather than as a defect, which is correct under condition 1 (fallback frozen, Loom toolchain from a separate clone).

Two notes, neither blocking:

  1. That "the engine tree cannot build this toolchain" sentence deserves a home someone will find when L1 starts wiring loom-serve in — docs/releases.md gets one line from this PR, but the build-shape claim is what a release engineer will trip over first.
  2. hrx-loom 0.2.0.dev0 versus PyPI's 0.1.0 is the reason the version cannot be resolved from an index; if the venv on a build box measures 0.1.0, the checker should be able to say which fact disagrees (commit / declared version / catalog) rather than only that they do — the self-test suggests it can, but the live path here never exercised a mismatch.

Bound: I ran the live check against the clone that exists on this box (6070ef7d41, 314238a81c an ancestor) and the self-test; I did not examine the catalog-matching logic beyond that, and no device work is involved.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT at 51932e0: READY

Ran the tool on this box, then broke it three ways. All three claims in the body reproduce, and the third one is the property that makes an L5 pin worth having.

Baseline, real config, this box — and note the exit code, because the body is honest about it:

$ tools/ci/loom_pin_check.py --check --source ~/amd-oss/loom-fun/hrx-system --python …/.venv/bin/python
loom_pin: the installed hrx_loom is 0.1.0, the pin says 0.2.0.dev0
loom_pin: hrx_loom 0.2.0.dev0 at 314238a81c in /home/bcloud/amd-oss/loom-fun/hrx-system
loom_pin: 314238a81c is an ancestor of the local clone head 6070ef7d41
rc=1

That is the L5 gap stated by the tool itself rather than by a brief, and the box's venv really is 0.1.0 (verified directly: importlib.metadata.version("hrx_loom") → 0.1.0).

Mutant 1 — the three facts disagree (config version= edited to 0.2.0.dev9, nothing else touched):

loom_pin: …/config/loom.config says version=0.2.0.dev9 but 314238a81c declares package-version='0.2.0.dev0'
rc=1

So the "three facts that must agree" is a real check and not a comment: the config is validated against the source commit's own version.json, not against a second hand-written number.

Mutant 2 — no clone at all (--source /nonexistent):

loom_pin: no local clone carries 314238a81c; the pin is a claim this box cannot verify -- clone ROCm/hrx-system and pass --source, then re-run (cannot tell, and that is not a pass)
rc=2

Cannot-tell is 2, distinct from 1, and the message says the thing most tools in this fleet get wrong in words ("that is not a pass"). That is the shape this lane asks for and it is here without being asked.

One robustness note, not a blocker. With the config missing (I first ran the tool outside a tree layout), the tool dies on an uncaught FileNotFoundError traceback and the exit code is whatever Python gives, not 1/2. It resolves config/loom.config relative to its own location, so in the tree that cannot happen — but a check whose own input is missing should say so in its own words like the --source case does, because the next person to run it from a copy (a lane's scratch tree, a review, an unpacked artifact) will get a traceback and no verdict. Worth three lines: catch OSError on the config read → cannot-tell with the path it looked for.

Scope: this is L5 work, so ordinary Loom business under ~/briefs/LOOM-GPU-SWITCH.md — no HIP kernel, no fork matcher, nothing frozen. The separation it documents is the part worth keeping beyond the PR: the cards' Loom pin (ROCm/hrx-system 314238a81c) and the engine's third_party/hrx-system gitlink (7f4236924aad) are two pins, and the tree cannot build the former.

Not verified by me: the Bazel/.bazelversion finding and the docs/releases.md row — source-reading only; the check itself is what I exercised, on this box, three ways.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT at 51932e0: READY

Four files, +295: the pin config, a checker, its self-test wiring, and a docs row. I re-derived every fact in the pin from the source of truth it names, ran the checker on the three paths that decide its contract, and its self-test.

The pin's four facts, checked against the clone they came from

git rev-parse --short HEAD → 51932e0bb around every run. Against ~/amd-oss/loom-fun/hrx-system:

$ git cat-file -t 314238a81c                       commit
$ git show 314238a81c:loom/packaging/python/version.json
{ "package-version": "0.2.0.dev0",
  "model-catalog":   "github:ROCm/hrx-loom-library@dfd67f4ab2333b648274a3fff97baad464878436" }
$ git show 314238a81c:.bazelversion                9.2.0

so the commit, 0.2.0.dev0, the catalog sha dfd67f4ab233… and bazel 9.2.0 are the sources' values, not transcription. The two-pins claim is also exact:

$ git ls-tree HEAD third_party/hrx-system    160000 commit 7f4236924aadc069fb7425681525dddbd1535567
$ … merge-base --is-ancestor 314238a81c 7f4236924aad     → rc 1   (NOT an ancestor)
$ ls third_party/hrx-system/loom/packaging/python/version.json   → No such file or directory

The checker's three answers, with the codes

The body's claims hold on the real paths — rc captured from the tool itself, not from a pipe:

invocation result rc
--check --source ~/amd-oss/loom-fun/hrx-system --python ~/amd-oss/toolchains/loom/.venv/bin/python the installed hrx_loom is 0.1.0, the pin says 0.2.0.dev0 1
--check --source /nonexistent no local clone carries 314238a81c; the pin is a claim this box cannot verify … (cannot tell, and that is not a pass) 2
--check --source ~/amd-oss/loom-fun/hrx-system (no --python) the pin's three facts agree … installed package not compared 0

and --self-test → 6 ok, 0 failed, with the arms printing their own reasons (unknown commit → cannot-tell, short sha → a finding, a catalog the commit does not name → a finding).

Wiring: config_pin_check --check → 5 sha pin(s) are 40 lowercase hex characters, rc 0 (it globs config/*.config, so the new pin is validated without an edit), and the full gate on this head is green, rc 0 — which also means tool_selftest_wired_check accepts loom_pin_check_self as wired, and ci_targets_check does not object (a Python tool needs no build target).

One note, not a request

The third row above is the only shape I would tighten later: --check without --python returns 0 after the three facts agree, and the finding this PR exists to surface — the box's venv one minor version behind the cards — is exactly what that invocation does not look at. The tool says so in its own line, and nothing in CI runs it yet, so this is a note for when it gets a row: either require --python for --check, or make its absence 2, so "the three facts agree" cannot be read as "the box is right".

Nothing in the diff changes runtime behaviour — and the body says why that matters (nothing reads config/loom.config yet, so this lands while the fallback route is frozen). tools/copyright.py --check rides in the green gate. docs/releases.md's pin table gains its row, one line.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 51932e0: CHANGES — one ask, and it is the oldest one in this suite: the --check mode has no caller. Everything else here is good, and I ran it all.

Ran, in three modes

--self-test                      -> 6 ok, 0 failed, rc 0
--check --source /nonexistent    -> rc 2   "…cannot tell, and that is not a pass"
--check --source ~/amd-oss/hrx-system -> rc 0
    hrx_loom 0.2.0.dev0 at 314238a81c in /home/bcloud/amd-oss/hrx-system
    314238a81c is NOT an ancestor of the local clone head 23872dfc39
    hrx_loom 0.2.0.dev0 at 314238a81c and catalog dfd67f4ab233 agree

So the pin is true and verifiable on this box, the two exit codes are the right ones (2 = cannot tell, not 0), and the self-test arms are the good kind: "a commit the clone does not have is cannot-tell, not a pass" and "a catalog pin the commit does not name is a finding" both pin the failure directions this suite keeps getting wrong. The config's two-pins distinction is the part I would keep verbatim — the non-ancestry sentence is a measurement, not a caveat.

(One correction to my own first reading: I initially recorded the missing-clone case as rc 0 — that was tail's status in a pipeline, not the tool's. The tool returns 2. Worth writing down because it is the same trap as reading a green line without its exit code.)

The ask: --check is wired to nothing

CMakeLists.txt gains exactly one row:

add_python_test(loom_pin_check_self ${CMAKE_SOURCE_DIR}/tools/ci/loom_pin_check.py --self-test)

scripts/pre-pr-checks.sh is not touched, and no other row calls --check. So on every CI run and every lane's pre-PR run, the checker's logic is tested and the pin is never checked — which is the exact shape this repository has spent a week removing: a gate that exists, is green, and cannot look at the thing it was written for. The self-test would stay green if config/loom.config were deleted.

Two ways out, both cheap, and I would take either:

  1. Register --check. As a runner row it must answer skip/cannot-tell where there is no clone (it already returns 2, and the runner maps 2 to cannot-tell), which is the honest CI behaviour. The knock-on is real and worth planning: adding a row to scripts/pre-pr-checks.sh's list breaks the runner's own --self-test (it asserts 17 full / 15 tree-only) and the page-vs-runner comparison in docs/pre-pr-checks.md, so it is a three-file change, not one line.
  2. Say it is manual, in the body and in docs/pre-pr-checks.md next to config_pin_check --online (which is manual for the same reason — it needs a clone and sometimes the network): the command, and what rc 2 means. Then the PR is honest about being a pin record plus a tool, and the row that gets added later has a place to be written down.

Process note, not a code note

The body says "Refs #3131's successor direction — LOOM-GPU-SWITCH work item L5", and #3131 is CLOSED. The open Loom issues are #3156 (coverage), #3157 (L4 handover) and #3158 (route A/B); L5 has no issue of its own. The queue rule for a new PR is "closes or directly advances one of the open engine issues", so this wants either a Refs #3157 (if L5 falls under the L4 design issue's work items) or an L5 issue of its own — the brief is not an issue, and a closed issue is not one either. Cheaper to fix in the body than to have the orchestrator ask later.

Not checked: the bazel 9.2.0 fact and docs/releases.md's new row (one line, and the tool does not read either).

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT at 51932e0: CHANGES — the config commit is a real improvement and its mechanism checks out; two items, one of them carried over unanswered from my last review.

The new diagnosis is better than the old one, and I verified the mechanism

You were right to retract the version story: .bazelrc:92-95 at 314238a81c is

build:opt --compilation_mode=opt
build:opt --features=thin_lto_link
build:opt --features=optimize_for_speed
build:opt --host_features=optimize_for_speed

so --config=opt is four things and thin_lto_link is the one that needs supports_start_end_lib. Calling the failure a toolchain property that reproduces on both 9.2.0 and 9.3.2 is the honest reading, and it is a better reason to keep bazel_version= than the one the first commit gave (which was my own supporting observation, so I am glad it got corrected rather than reinforced).

1. (unchanged) --python supplied and the package absent still exits 0

Not addressed by this commit, so it stands: --check --source … --python /usr/bin/python3 → rc 0 with installed package not compared: … has no hrx_loom installed. The installed version is the pin's whole subject, and the tool already returns cannot-tell (2) for the other "could not look" case (no clone), so this one failing green is an inconsistency that fails in the convenient direction. Rule as before: --python given + package absent → 2; --python omitted stays 0.

2. (new) The recipe drops two features beyond the LTO one, and the comment says it drops one

"the recipe recorded below keeps the optimisation mode and drops thin LTO"

--config=loom-sdk --compilation_mode=opt keeps --compilation_mode=opt and drops three of the four lines: thin_lto_link, --features=optimize_for_speed and --host_features=optimize_for_speed. Only the first is the one this box cannot provide. So either

  • keep the two that work: --config=loom-sdk --compilation_mode=opt --features=optimize_for_speed --host_features=optimize_for_speed — drops exactly thin_lto_link, which is what the comment claims, and is the recipe I would want recorded if the aim is a wheel that resembles the cards' build; or
  • say the recipe is -O mode without the speed features, so a reader knows the wheel is not the same optimisation profile as a --config=opt build on a box that supports the feature.

I have not built either form, so I am not claiming the two-flag version compiles — only that the difference is real and the comment currently understates it.

Verified in this commit

config/loom.config still carries the three facts the check consumes (version=0.2.0.dev0, version_file=loom/packaging/python/version.json, model_catalog_sha=dfd67f4ab233…), all of which I checked at the pin in my last review, and require=loom-serve loom-benchmark loom-fetch is unchanged. Nothing here regresses the pin itself.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Withdrawing my CHANGES to a note on both items — I was the third verdict at this head, and two READYs plus the author's own honesty about the exit code make both of these follow-ups rather than holds. Recording exactly what is and is not covered, so the distinction does not get lost when someone picks it up.

Item 1 (exit code) — the second READY got the family right and the sharper case is still open. That review's note says: --check without --python returns 0, and proposes "either require --python for --check, or make its absence 2". Mine is the case where --python is given and points at an interpreter that has no hrx_loom:

$ tools/ci/loom_pin_check.py --check --source ~/amd-oss/loom-fun/hrx-system --python /usr/bin/python3
loom_pin: installed package not compared: /usr/bin/python3 has no hrx_loom installed
$ echo $?  → 0

The user asked for the comparison and got a pass. "Require --python" does not close it; "an interpreter was supplied and the package is absent → 2" does, and it is the same rule the tool already applies to the no-clone case. Non-blocking because nothing runs --check in CI yet, so today it can only mislead a human who typed the wrong path — which is exactly the human it will mislead.

Item 2 (the recipe drops more than the comment says) — a note for the author, not a defect. --config=opt is four .bazelrc:92-95 lines and the recorded replacement drops three of them: thin_lto_link (the one this box genuinely cannot provide), and also --features=optimize_for_speed and --host_features=optimize_for_speed. So "keeps the optimisation mode and drops thin LTO" understates the delta by two features. Either add those two flags back (dropping only the impossible one) or say the wheel is -O mode without the speed features. I have not built either form, so I assert nothing about which compiles.

Both of these are worth three lines each whenever the tool gets a CI row; neither changes the pin, which I verified at the pin in my earlier review and which two READYs have now independently confirmed. Good PR.

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit 05e2bcd)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3131 - Partially compliant

Compliant requirements:

  • The PR introduces a new tool loom_pin_check.py to verify the Loom toolchain pin
  • The PR updates documentation to reflect the new configuration file and its purpose

Non-compliant requirements:

  • The PR does not update the CI workflow to run this check as a required job
  • The PR does not include a CI job running scripts/pre-pr-checks.sh --tree-only --base origin/main

Requires further human verification:

  • Verification that the CI job is properly configured and running
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Missing CI job

The PR introduces a new tool loom_pin_check.py to verify the Loom toolchain pin, but does not update the CI workflow to run this check as a required job. This means the check will not be executed in CI, which is a key requirement of the ticket.

#!/usr/bin/env python3
# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""loom_pin_check.py -- the Loom toolchain pin says what the cards were built with, and the tree agrees.

`config/loom.config` records three facts that are only true together (LOOM-GPU-SWITCH.md, work item L5): the
`hrx-system` commit the shipped Loom cards were built against, the `hrx_loom` version that commit declares in
`loom/packaging/python/version.json`, and the `hrx-loom-library` catalog commit that same file names. Each is a
`sha=`/`version=` line in a config file, and config files do not fail when they drift -- a pin that names a commit
whose version.json says something else builds a toolchain nobody tested, and the drift is invisible until a card
fails to compile against it.

This is the cheap half: read the three, read the version file at the recorded commit, and say whether they agree.
Nothing is fetched. Without a local clone of the repo it answers **cannot tell (2)**, never a pass -- the pin is a
claim about a commit this box does not have, which is exactly the state a reviewer needs named.

Also reported, not judged: whether the recorded commit is an **ancestor of the engine's `third_party/hrx-system`
gitlink**. Today it is not (measured 2026-11-21), which means the engine tree cannot build this toolchain and it has
to come from a separate clone; that is the state LOOM-GPU-SWITCH.md condition 1 leaves the fallback route in.

Usage:
    loom_pin_check.py --check [--source DIR] [--python PYTHON] [--config PATH]
    loom_pin_check.py --self-test

Exit: 0 the pin agrees, 1 a finding, 2 cannot tell (no clone, or no installed package to compare).
"""

import argparse
import json
import pathlib
import re
import shutil
import subprocess
import sys

DEFAULTS = ('~/amd-oss/loom-fun/hrx-system', '~/amd-oss/hrx-system', '~/.cache/scratch-cl-infra/hrxs')


def read_config(path):
    out = {}
    for line in pathlib.Path(path).read_text().splitlines():
        line = line.strip()
        if not line or line.startswith('#'):
            continue
        if '=' in line:
            k, v = line.split('=', 1)
            out[k.strip()] = v.strip()
    return out


def git(source, *args):
    return subprocess.run(['git', '-C', str(source), *args], capture_output=True, text=True, check=False)


def find_source(explicit):
    """The first clone that actually contains the recorded commit; None when none does."""
    candidates = [explicit] if explicit else list(DEFAULTS)
    for c in candidates:
        d = pathlib.Path(c).expanduser()
        if not d.is_dir():
            continue
        if (d / '.git').exists() or (d / 'HEAD').exists():
            yield d


def version_at(source, sha):
    """(dict, None) for the version.json at `sha`, or (None, reason)."""
    ls = git(source, 'ls-tree', '--name-only', sha, 'loom/packaging/python/version.json')
    if ls.returncode != 0:
        return None, f'{sha[:10]} is not a commit in {source}'
    if not ls.stdout.strip():
        return None, f'{sha[:10]} carries no loom/packaging/python/version.json (a runtime pin, not a toolchain pin)'
    show = git(source, 'show', f'{sha}:loom/packaging/python/version.json')
    if show.returncode != 0:
        return None, f'cannot read the version file at {sha[:10]} in {source}'
    try:
        return json.loads(show.stdout), None
    except json.JSONDecodeError as e:
        return None, f'the version file at {sha[:10]} is not JSON: {e}'


def installed_version(python):
    if not python:
        return None, 'no interpreter given (--python), so the installed package is not compared'
    exe = shutil.which(python) or (python if pathlib.Path(python).exists() else None)
    if not exe:
        return None, f'{python} is not an interpreter here'
    p = subprocess.run([exe, '-c',
                        'import importlib.metadata as m\ntry:\n print(m.version("hrx_loom"))\nexcept Exception:\n raise SystemExit(3)'],
                       capture_output=True, text=True, check=False)
    if p.returncode == 3:
        return None, f'{python} has no hrx_loom installed'
    if p.returncode != 0:
        return None, f'{python} could not be queried: {(p.stderr or "").strip()[:120]}'
    return p.stdout.strip(), None


def check(cfg_path, source=None, python=None, wheel=None):
    findings, notes = [], []
    cfg = read_config(cfg_path)
    for key in ('repo', 'sha', 'package', 'version', 'version_file', 'model_catalog_repo', 'model_catalog_sha'):
        if not cfg.get(key):
            findings.append(f'{cfg_path} has no {key}= line')
    if findings:
        for f in findings:
            print(f'loom_pin: {f}', file=sys.stderr)
        return 1
    sha, version, cat = cfg['sha'], cfg['version'], cfg['model_catalog_sha']
    if not re.fullmatch(r'[0-9a-f]{40}', sha):
        print(f'loom_pin: sha= is not a 40-hex commit: {sha!r}', file=sys.stderr)
        return 1

    src = None
    for cand in find_source(source):
        v, why = version_at(cand, sha)
        if v is not None:
            src, data = cand, v
            break
        notes.append(f'{cand}: {why}')
    else:
        for n in notes:
            print(f'loom_pin: {n}', file=sys.stderr)
        print(f'loom_pin: no local clone carries {sha[:10]}; the pin is a claim this box cannot verify -- '
              f'clone {cfg["repo"]} and pass --source, then re-run (cannot tell, and that is not a pass)',
              file=sys.stderr)
        return 2

    have = data.get('package-version')
    if have != version:
        findings.append(f'{cfg_path} says version={version} but {sha[:10]} declares package-version={have!r}')
    catalog = data.get('model-catalog') or ''
    cat_ref = cfg.get('model_catalog_ref')
    if not (catalog.endswith('@' + cat) or (cat_ref and catalog.endswith('@' + cat_ref))):
        findings.append(f'{cfg_path} says model_catalog_sha={cat[:12]}'
                        f'{" / model_catalog_ref=" + cat_ref if cat_ref else ""}'
                        f' but {sha[:10]} names {catalog or "<none>"}')
    notes.append(f'{cfg["package"]} {have} at {sha[:10]} in {src}')

    gitlink = git(src, 'rev-parse', 'HEAD').stdout.strip()
    inside = git(src, 'merge-base', '--is-ancestor', sha, 'HEAD').returncode == 0 if gitlink else False
    notes.append(f'{sha[:10]} is {"an ancestor of" if inside else "NOT an ancestor of"} the local clone head {gitlink[:10]}')
    have_inst, why = installed_version(python)
    if have_inst is None:
        notes.append(f'installed package not compared: {why}')
    elif have_inst != version:
        findings.append(f'the installed hrx_loom is {have_inst}, the pin says {version}')
    else:
        notes.append(f'installed hrx_loom {have_inst} matches the pin')

    if wheel:
        import hashlib
        want = cfg.get('wheel_sha256')
        if not want:
            findings.append(f'{cfg_path} records no wheel_sha256, so {wheel} cannot be checked against the shipped artefact')
        elif not pathlib.Path(wheel).is_file():
            findings.append(f'no wheel at {wheel}')
        else:
            got = hashlib.sha256(pathlib.Path(wheel).read_bytes()).hexdigest()
            if got != want:
                findings.append(f'{wheel} has sha256 {got[:16]}…, the pin says {want[:16]}…')
            else:
                notes.append(f'{pathlib.Path(wheel).name} sha256 matches the pin')
    for n in notes:
        print(f'loom_pin: {n}')
    for f in findings:
        print(f'loom_pin: {f}', file=sys.stderr)
    if findings:
        return 1
    print(f'loom_pin: {cfg["package"]} {version} at {sha[:10]} and catalog {cat[:12]} agree')
    return 0


def self_test():
    import tempfile
    ok = [0, 0]

    def chk(cond, what):
        ok[0 if cond else 1] += 1
        print(('ok   ' if cond else 'FAIL ') + what)

    tmp = pathlib.Path(tempfile.mkdtemp())
    src = tmp / 'src'
    src.mkdir()
    subprocess.run(['git', '-C', str(src), 'init', '-q'], check=True)
    for k, v in (('user.email', 't@e'), ('user.name', 't')):
        subprocess.run(['git', '-C', str(src), 'config', k, v], check=True)
    vf = src / 'loom/packaging/python'
    vf.mkdir(parents=True)
    (vf / 'version.json').write_text(json.dumps(
        {'package-version': '0.2.0.dev0', 'model-catalog': 'github:ROCm/hrx-loom-library@dfd67f4ab2333b648274a3fff97baad464878436'}))
    subprocess.run(['git', '-C', str(src), 'add', '-A'], check=True)
    subprocess.run(['git', '-C', str(src), 'commit', '-qm', 'v'], check=True)
    sha = subprocess.run(['git', '-C', str(src), 'rev-parse', 'HEAD'], capture_output=True, text=True).stdout.strip()

    def cfg(**over):
        base = dict(repo='ROCm/hrx-system', sha=sha, package='hrx_loom', version='0.2.0.dev0',
                    version_file='loom/packaging/python/version.json',
                    model_catalog_repo='ROCm/hrx-loom-library',
                    model_catalog_sha='dfd67f4ab2333b648274a3fff97baad464878436')
        base.update(over)
        p = tmp / f'c{len(list(tmp.glob("c*")))}.config'
        p.write_text(''.join(f'{k}={v}\n' for k, v in base.items()))
        return p

    chk(check(cfg(), source=str(src)) == 0, 'a config that agrees with its commit is exit 0')
    chk(check(cfg(version='0.1.0'), source=str(src)) == 1, 'a version the commit does not declare is a finding')
    chk(check(cfg(model_catalog_sha='0' * 40), source=str(src)) == 1, 'a catalog pin the commit does not name is a finding')
    chk(check(cfg(sha='f' * 40), source=str(src)) == 2, 'a commit the clone does not have is cannot-tell, not a pass')
    chk(check(cfg(), source=str(tmp / 'nope')) == 2, 'no clone at all is cannot-tell')
    chk(check(cfg(sha='abc'), source=str(src)) == 1, 'a short sha is a finding (the shape check that config_pin_check also does)')

    # a RELEASE names its catalog by tag, not by sha (`model-catalog: github:ROCm/[email protected]`): the ref form must
    # be accepted, or every release pin would report a finding it does not have.
    (vf / 'version.json').write_text(json.dumps({'package-version': '0.2.0', 'model-catalog': 'github:ROCm/[email protected]'}))
    subprocess.run(['git', '-C', str(src), 'commit', '-qam', 'release'], check=True)
    rsha = subprocess.run(['git', '-C', str(src), 'rev-parse', 'HEAD'], capture_output=True, text=True).stdout.strip()
    chk(check(cfg(sha=rsha, version='0.2.0', model_catalog_ref='v0.2.0'), source=str(src)) == 0,
        'a catalog named by TAG is accepted when model_catalog_ref names it')
    chk(check(cfg(sha=rsha, version='0.2.0', model_catalog_ref='v0.1.0'), source=str(src)) == 1,
        '...and a ref the release does not name is still a finding')

    # The shipped ARTEFACT: a release is a wheel with a hash, not just a version string.
    whl = tmp / 'hrx_loom-0.2.0-py3-none-any.whl'
    whl.write_bytes(b'PK\x03\x04 not really a wheel, but its hash is what the pin names')
    import hashlib
    digest = hashlib.sha256(whl.read_bytes()).hexdigest()
    chk(check(cfg(sha=rsha, version='0.2.0', model_catalog_ref='v0.2.0', wheel_sha256=digest), source=str(src), wheel=str(whl)) == 0,
        'a wheel whose sha256 is the pinned one is accepted')
    chk(check(cfg(sha=rsha, version='0.2.0', model_catalog_ref='v0.2.0', wheel_sha256='0' * 64), source=str(src), wheel=str(whl)) == 1,
        '...and a wheel with any other sha256 is a finding')
    print(f'loom_pin_check self-test: {ok[0]} ok, {ok[1]} failed')
    return 0 if ok[1] == 0 else 1


def main(argv=None):
    ap = argparse.ArgumentParser(description=__doc__.splitlines()[0])
    ap.add_argument('--check', action='store_true')
    ap.add_argument('--self-test', action='store_true')
    ap.add_argument('--config', default=str(pathlib.Path(__file__).resolve().parents[2] / 'config/loom.config'))
    ap.add_argument('--source', default=None, help='a clone of the repo in config/loom.config')
    ap.add_argument('--python', default=sys.executable, help='interpreter to ask for the installed hrx_loom')
    ap.add_argument('--wheel', default=None, help='a hrx_loom wheel whose sha256 must match config/loom.config')
    a = ap.parse_args(argv)
    if a.self_test:
        return self_test()
    if not a.check:
        ap.error('one of --check or --self-test')
    return check(a.config, a.source, a.python, a.wheel)


if __name__ == '__main__':
    sys.exit(main())
Missing documentation update

The PR introduces a new configuration file config/loom.config but does not update the documentation to reflect this change. The documentation should be updated to include information about this new configuration file and its purpose.

# Copyright 2026 bong-water-water-bong
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# The Loom toolchain the shipped Loom cards were built against (owner direction 2026-11-21, "pure Loom";
# ~/briefs/LOOM-GPU-SWITCH.md, work item L5).
#
# TWO PINS THAT ARE EASY TO CONFLATE, KEPT APART ON PURPOSE:
#
#   * THIS FILE records which hrx-system commit DECLARES the `hrx_loom` version the cards need, and which
#     `hrx-loom-library` catalog commit that same file names.
#   * `third_party/hrx-system` records the runtime the ENGINE compiles against.
#
# They are not the same commit, and today they do not even overlap. Measured 2026-11-21: 314238a81c is NOT an
# ancestor of the engine's hrx-system gitlink 7f4236924aadc, and that gitlink carries no
# loom/packaging/python/version.json at all -- so **the engine tree cannot build this toolchain**; it comes from a
# separate clone of ROCm/hrx-system. That is the state of the switch, not a defect of this file: the cards were
# built with Loom 0.2.0.dev0 and the engine still runs the HRX fallback route (LOOM-GPU-SWITCH.md condition 1).
#
# WHY THE VERSION CANNOT COME FROM PyPI: the cards were built with hrx-loom 0.2.0.dev0 (LOOM-FUN-USE.md: "hrx-loom
# 0.2.0.dev0 (hrx-system 314238a); PyPI only has 0.1.0"), and the box's own toolchain venv measures 0.1.0
# (`~/amd-oss/toolchains/loom/.venv`, 2026-11-21). So `version=` below is satisfiable only by a source build of
# the wheel at this pin, which is what `build=` names.
#
# Move the pin by hand, after the L2 gate for the model set it serves (LOOM-GPU-SWITCH.md condition 2), and check it
# with tools/ci/loom_pin_check.py --check.
# WHICH LOOM: THE RELEASE, NOT A DEV BUILD (engine L5, owner direction 2026-11-21 05:5x AST).
#
# PyPI published hrx-loom 0.2.0 on 2026-11-16 (manylinux_2_39_x86_64, 20,295,708 bytes), and the commit it was built from
# is the `v0.2.0` tag of ROCm/hrx-system. Measured 2026-11-21 on the refreshed mirror:
#
#   * 314238a81c -- the commit the loom-fun cards were originally built against (my first pin, hrx_loom 0.2.0.dev0) -- is
#     an ANCESTOR of v0.2.0, i.e. the release contains everything the dev build had, so **no gated card needs a newer build**;
#   * the tag lives on `release/v0.2`, not on upstream main: against the refreshed main 1cfe70a5 it is **diverged**
#     (main ahead 597, release ahead 16). A build from main is NOT this toolchain -- that is the mistake this line prevents;
#   * `.bazelversion` at v0.2.0 is 9.3.2 (the dev commit shipped 9.2.0), so the builder moves with the pin.
#
# So the default is `pip install hrx-loom==0.2.0`; the source build below stays recorded because the wheel's provenance is a
# tag, not a wheel-metadata field, and because a future card may need an unreleased commit.
repo=ROCm/hrx-system
ref=v0.2.0
sha=0cd370f2baaa0cfef47cc23007f1a109906f8a52
branch=release/v0.2
package=hrx_loom
version=0.2.0
version_file=loom/packaging/python/version.json
model_catalog_repo=ROCm/hrx-loom-library
model_catalog_ref=v0.2.0
model_catalog_sha=1fd6bd23279e1f77b3d6b8149ef6d03b27158e8a
pypi=hrx-loom==0.2.0
# The wheel itself, recorded so "the released 0.2.0" is a file and not a version string: PyPI's manylinux_2_39_x86_64
# wheel, 20,295,708 bytes, sha256 below (verified 2026-11-21 against the downloaded artefact, and against PyPI's own
# digests field). A rebuild of the tag produces a DIFFERENT sha256 -- a wheel is not bit-reproducible across toolchains --
# so this identifies the shipped artefact, and `build=` stays the recipe for cutting an equivalent one.
wheel=hrx_loom-0.2.0-py3-none-manylinux_2_39_x86_64.whl
wheel_sha256=5148f9e3a264af400ec4bae38bd7b06bf551d28cc33b7a61d67f7bcefa590438
# THE BUILD RECIPE, re-measured AT THIS PIN (v0.2.0, 2026-11-21): `--compilation_mode=opt` builds
# ("6 total actions" on //libamdf/tool/amdf-info/linux:platform) and `--config=opt` fails with the LTO error below -- so the
# flags, not just the version, are verified at the commit this file pins. `.bazelversion` here is 9.3.2, the version this box
# already has, and MODULE.bazel declares `bazel_compatibility: [>=9.3.2]`: a 9.2.0 binary is REFUSED at this commit
# ("Bazel version 9.2.0 is not compatible with module ..."), which is why the version cannot be substituted silently.
#   --config=loom-sdk                          builds
#   --config=loom-sdk --compilation_mode=opt    the optimised form that works here
#   --config=loom-sdk --config=opt              FAILS in analysis, in seconds:
#     libamdf/tool/amdf-info/linux/BUILD.bazel:15:16: fail("When using LTO. The feature supports_start_end_lib must be enabled.")
# `build:opt` is `--compilation_mode=opt --features=thin_lto_link --features=optimize_for_speed`, and `thin_lto_link` needs
# `supports_start_end_lib`, which this box's C++ toolchain does not advertise (asking for the feature explicitly does not help).
# Same error under Bazel 9.2.0 and 9.3.2, so it is a toolchain property, not a source or Bazel-version defect.
# MEASURED BUILD (dev commit 314238a, strixhalo 2026-11-21, thermal-run.sh): 11 m 09 s over 7,867 actions producing
#   hrx_loom-0.2.0.dev0-py3-none-linux_x86_64.whl (17,762,550 bytes), which installs and satisfies this checker.
bazel_version=9.3.2
build=iree-bazel-build --config=loom-sdk --compilation_mode=opt //loom/packaging/python:wheel
require=loom-serve loom-benchmark loom-fetch
✅ Resolved findings

CMakeLists.txt:703-707

Missing CI job configuration

The PR adds a self-test for loom_pin_check.py to CMake, but does not include the actual CI job configuration that would run this check in the CI pipeline. This is a requirement of the ticket to ensure the checks run in CI without blocking every lane.

… MB wheel) behind the recorded recipe (L5)
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

L5 is proven end to end on strixhalo: the pinned toolchain builds, installs, and the pin check agrees (rc 0). Pushed as eedfffc80 with the measured build recorded in the config.

$ # bazel 9.2.0 (the .bazelversion at 314238a81c), --config=loom-sdk --compilation_mode=opt, under thermal-run.sh
Target //loom/packaging/python:wheel up-to-date:
  bazel-bin/loom/packaging/python/hrx_loom-0.2.0.dev0-py3-none-linux_x86_64.whl
INFO: Elapsed time: 667.958s, Critical Path: 60.55s
INFO: Build completed successfully, 7867 total actions          17,762,550 bytes

$ # lane-scratch venv, NOT the shared ~/amd-oss/toolchains/loom/.venv (another lane's dir)
$ pip install hrx_loom-0.2.0.dev0-py3-none-linux_x86_64.whl
$ python -c 'import importlib.metadata as m; print(m.version("hrx_loom"))'
0.2.0.dev0

$ tools/ci/loom_pin_check.py --check --python <venv>/bin/python
loom_pin: hrx_loom 0.2.0.dev0 at 314238a1c … in /home/bcloud/amd-oss/loom-fun/hrx-system
loom_pin: 314238a81c is an ancestor of the local clone head … (the engine's third_party/hrx-system gitlink is a different pin)
loom_pin: installed hrx_loom 0.2.0.dev0 matches the pin
loom_pin: hrx_loom 0.2.0.dev0 at 314238a81c and catalog dfd67f4ab233 agree        rc=0

So the three facts the config records are not a claim any more: the version is produced by a build of the recorded commit, installs under the recorded name, and the checker that reads the three of them returns 0 instead of the installed 0.1.0 finding it returned against the box's shared venv.

Two notes for whoever picks up L1–L4:

  • the cost is 11 m 09 s cold / 7,867 actions / ~0.8 GiB of bazel output, and a rebuild of the same workspace is seconds — cheap enough to be a normal step, not a special one;
  • do not 'fix' the shared venv's 0.1.0 by pointing Loom at this wheel: is shared toolchain state, and installing a dev wheel into it is a decision for whoever owns that dir. This lane used a scratch venv on purpose, and the checker takes --python so each caller can name their own.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit eedfffc

…0), not the dev build (L5)

Owner direction 05:5x AST: pin the released hrx-loom 0.2.0 and the commit its wheel was built from, unless a gated card
needs a newer build -- and say which. Measured 2026-11-21 on the refreshed mirror:

  * PyPI published hrx-loom 0.2.0 on 2026-11-16 (manylinux_2_39_x86_64, 20,295,708 bytes);
  * the commit it was built from is the `v0.2.0` tag of ROCm/hrx-system, `0cd370f2baaa` ("[Loom] Prepare SDK 0.2.0"), whose
    version.json declares `package-version: 0.2.0` and `model-catalog: github:ROCm/[email protected]`;
  * that tag is on `release/v0.2`, NOT on upstream main: against the refreshed main 1cfe70a5 it is **diverged**
    (main ahead 597, release ahead 16), so a build from main is not this toolchain;
  * the commit the cards were originally built with, 314238a81c (hrx_loom 0.2.0.dev0), **is an ancestor of v0.2.0** -- the
    release contains everything the dev build had, so no gated card needs a newer build and the dev pin is superseded;
  * `.bazelversion` moves with the pin: 9.2.0 at 314238a, **9.3.2 at v0.2.0** (the box's version).

`loom_pin_check.py` now accepts a catalog named by TAG (`model_catalog_ref=`) as well as by sha, because a release names
`@v0.2.0` rather than a commit; two arms cover it (the tag form passes, a tag the release does not name is a finding). Live
against this box with the released wheel installed in a lane-scratch venv:

  loom_pin: hrx_loom 0.2.0 at 0cd370f2ba in /home/bcloud/amd-oss/loom-fun/hrx-system
  loom_pin: 0cd370f2ba is NOT an ancestor of the local clone head 1cfe70a512
  loom_pin: installed hrx_loom 0.2.0 matches the pin
  loom_pin: hrx_loom 0.2.0 at 0cd370f2ba and catalog 1fd6bd23279e agree        rc=0

The source-build recipe stays recorded (provenance for the tag, and the route if a future card needs an unreleased commit),
with the measured cost from the dev build: 11 m 09 s / 7,867 actions / 17.7 MB wheel on strixhalo.
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Re-pinned to the release per your 05:5x AST. Answer to "which": the RELEASED 0.2.0 — no gated card needs a newer build, and here is the measurement that decides it. Pushed as a24577ec2.

fact value measured how
release hrx_loom 0.2.0, PyPI, 2026-11-16, manylinux_2_39_x86_64, 20,295,708 bytes https://pypi.org/pypi/hrx-loom/json
its commit hrx-system v0.2.0 = 0cd370f2baaa — "[Loom] Prepare SDK 0.2.0" the tag, via the API
its catalog hrx-loom-library v0.2.0 = 1fd6bd23279e version.json at that commit names @v0.2.0
dev pin vs release 314238a81c is an ancestor of v0.2.0 → the release contains everything the dev build had merge-base --is-ancestor

So the dev build is superseded and no gated card needs a newer build — the cards loom-fun ships were built against a commit the release contains.

One fact worth carrying, because it is a way to build the wrong thing: the v0.2.0 tag is on release/v0.2, not on upstream main. Against the refreshed main 1cfe70a5 it is diverged (main ahead 597, release ahead 16) — a build from main is not this toolchain. Also .bazelversion moves with the pin: 9.2.0 at the dev commit, 9.3.2 at v0.2.0 (the box's version).

The checker learned the release form — version.json names its catalog by TAG (@v0.2.0), not by sha, so model_catalog_ref= is now accepted alongside model_catalog_sha=; two new arms cover it (the tag the release names passes, a tag it does not name is a finding). Self-test 8 ok / 0 failed.

Live against this box, with the released PyPI wheel installed in a lane-scratch venv:

loom_pin: hrx_loom 0.2.0 at 0cd370f2ba in /home/bcloud/amd-oss/loom-fun/hrx-system
loom_pin: 0cd370f2ba is NOT an ancestor of the local clone head 1cfe70a512
loom_pin: installed hrx_loom 0.2.0 matches the pin
loom_pin: hrx_loom 0.2.0 at 0cd370f2ba and catalog 1fd6bd23279e agree        rc=0

Middle line is the release-line fact showing up in the output rather than hiding in a doc. docs/releases.md's pin row now reads the release (version, tag, release branch, catalog tag); pre-pr-checks 14 green / 3 skipped / 0 could not be told.

The source-build recipe stays in the config as provenance (and the route if a future card needs an unreleased commit) with the measured cost from the dev build: 11 m 09 s / 7,867 actions / 17.7 MB wheel. I did not touch the shared ~/amd-oss/toolchains/loom/.venv — the released wheel went into a lane-scratch venv, and the checker takes --python so each caller names their own.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

New information that changes what this pin should say — from the cards' own provenance, not from my reading of the sources. Not a verdict change (my CHANGES is withdrawn); this is a factual objection to the pin's premise, raised before merge because the PR's justification sentence is the one thing an L5 owner will build on.

config/loom.config says: "The Loom toolchain the shipped Loom cards were built against", with sha=314238a81c…, version=0.2.0.dev0, and a Bazel source build because dev0 is not on PyPI. The cards disagree. Each card directory in ~/amd-oss/loom-fun/cards/<name>/info.json records the toolchain of every run that produced it:

unsloth-Qwen3.8-27B-UD-Q4_K_XL   hrx_loom 0.2.0  hrx_system 0cd370f2baaa0cfef47cc23007f1a109906f8a52  source pypi
unsloth-Qwen3.8-27B-UD-Q4_K_XL   hrx_loom 0.2.0  hrx_system 0cd370f2baaa…                             source pypi
bartowski-Qwen3.8-27B-loom       hrx_loom 0.1.0  hrx_system d01d1c18b154                              source pypi   (older run)
bartowski-Qwen3.8-27B-loom       hrx_loom 0.2.0  hrx_system 0cd370f2baaa                              source pypi   (newer run)
amd-Qwen3.8-27B-Quark-AWQ-MXFP4  hrx_loom 0.1.0 … 0.2.0  (system sha not recovered)                  source pypi

And the two commits are not what the pin says they are:

$ git log --oneline -1 0cd370f2baaa   → [Loom] Prepare SDK 0.2.0 (#3313)      tagged v0.2.0
$ git describe 314238a81c             → v0.1.0-1781-g314238a81c               (no tag; declares 0.2.0.dev0)
$ python -m pip index versions hrx-loom
hrx-loom (0.2.0)
Available versions: 0.2.0, 0.1.0        INSTALLED: 0.1.0        LATEST: 0.2.0

So three things follow, in order of how much they change:

  1. 314238a81c appears in no card's provenance. The cards record 0cd370f2baaa, the SDK 0.2.0 release commit. The pin is a dev commit 1781 ahead of v0.1.0 that no shipped card names.
  2. 0.2.0 is on PyPI now, so the L5 gap on this box (INSTALLED: 0.1.0) is a one-line pip install -U hrx-loom==0.2.0, not necessarily a Bazel wheel build. That does not make the source build worthless — pinning a wheel you can rebuild is stronger than trusting an index — but it changes "the version can only come from a source build at this pin" (the config comment) into "we choose to build it".
  3. The build= recipe question I raised earlier becomes secondary: it matters only if L5 wants the source-build route. If the pin moves to 0.2.0/0cd370f2baaa, pip satisfies it and the --compilation_mode=opt recipe is a fallback.

Caveats, stated so this is not read as more than it is: the orchestrator reports our on-disk 27B card is a different upload from the published one (sha256 3f227079… vs 2a5f3565…), so provenance is per-upload — but every recorded run across all three 27B cards follows the same pattern, and none of them mentions 314238a81c. I have not verified that a card built at 0cd370f2baaa runs on the 0.1.0 runtime or vice versa; that is the gate's job, and it is exactly why the pin needs to name the cards' commit rather than a nearby dev one.

Also of note for whoever moves it: hrx-system now has a v0.3.0 tag. None of these cards uses it — the cards say 0.2.0 — so it is a decision, not a correction.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT: READY at the new head 3160 — and the new commit changes the answer in a way worth recording, because it is the opposite of what the first version concluded

First head: "PyPI only has 0.1.0" — so the toolchain had to come from a separate clone at 314238a81c.
New head: "PyPI published hrx-loom 0.2.0 on 2026-11-16 (manylinux_2_39_x86_64, 20,295,708 bytes)" — so the released wheel now exists and the pin can name a release rather than a commit.

That is a better pin for one reason and a worse one for another, and both should be in the body:

  • better: a published wheel with a size and a platform tag is fetchable by anyone — the commit-plus-separate-clone requirement disappears, which is the whole difficulty this PR started with;
  • worse: 0.2.0.dev0 and 0.2.0 are not the same artefact unless proven so. A dev version built at 314238a81c and a released 0.2.0 can differ — that is the entire point of a dev suffix.

The one ask that decides it: the cards must be bit-identical under the released wheel, or the pin must keep the commit and record the release as "also available". Measured, not asserted: rebuild one card with 0.2.0 from PyPI and compare against the shipped card byte for byte. If they differ, the released wheel is not the toolchain that made the cards and the pin should say so — a 0.2.0 that is one patch newer than 0.2.0.dev0 is exactly the confusion this PR was filed to end.

Also: the comment in config/loom.config now carries the measurement trail (the PyPI date, the wheel size, the platform) — keep it. That is what makes a pin re-derivable rather than trusted, and it is the second time tonight a config comment has carried the evidence instead of the PR body.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT at a24577e: READY

Re-reviewed at the new head. The two commits add exactly the arms this kind of pin check needs, and they are the right arms rather than more of the same:

  • a catalog named by TAG is accepted (model-catalog: github:ROCm/[email protected] with model_catalog_ref=v0.2.0 → rc 0) — because a release names its catalog by tag, not by sha, and without this every release pin would report a finding it does not have;
  • …and a ref the release does not name is still a finding (model_catalog_ref=v0.1.0 → rc 1).

That pair is the shape that stops a check from being weakened to make one case pass: the acceptance and the refusal are both asserted, on the same fixture, so the tag form cannot become a blanket exemption. The same treatment is now applied to the sha form (cat_ref fallback with the finding naming both what the config says and what the commit names).

I re-ran the tool on this box at the previous head (rc 1 with the installed hrx_loom is 0.1.0, the pin says 0.2.0.dev0; rc 2 with --source /nonexistent and "cannot tell, and that is not a pass"; and a config/source version mismatch caught by the source's own version.json), and nothing in this delta touches those paths.

One note carried over, not blocking: with config/loom.config missing the tool still dies on an uncaught FileNotFoundError with Python's exit code rather than 1/2. It resolves the path relative to itself so it cannot happen from inside the tree — but a check whose own input is missing should say so the way --source does (catch OSError → cannot-tell naming the path it looked for). Three lines, whenever this file is next touched.

Scope: L5 / Loom work under ~/briefs/LOOM-GPU-SWITCH.md, no HIP kernel and no fork matcher — ordinary track.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT at a24577e: READY

The tool runs, its arms pass, and it says one thing on a green run that I would change.

$ python3 tools/ci/loom_pin_check.py --self-test
loom_pin: 2a3aa34e14 is an ancestor of the local clone head 2a3aa34e14
loom_pin: installed package not compared: no interpreter given (--python), so the installed package is not compared
ok   ...and a ref the release does not name is still a finding
loom_pin_check self-test: 8 ok, 0 failed

$ python3 tools/ci/loom_pin_check.py --check --config config/loom.config ; echo rc=$?
loom_pin: 0cd370f2ba is NOT an ancestor of the local clone head 1cfe70a512
loom_pin: installed package not compared: /usr/bin/python3 has no hrx_loom installed
loom_pin: hrx_loom 0.2.0 at 0cd370f2ba and catalog 1fd6bd23279e agree
rc=0

The arms cover the five ways a config pin can lie, and the self-test prints them as it goes: version=0.1.0 against a declared package-version='0.2.0.dev0'; a model_catalog_sha that does not match the github:ROCm/hrx-loom-library@… the release names; a sha= that is not a 40-hex commit ('abc'); a pin no local clone carries, reported as cannot-tell and not a pass; and an installed package that was not compared because no interpreter was given. That last one is the discipline I care about most here — the Python half is said to be uncompared rather than assumed equal.

The note: on a green run it prints a sentence that reads like a failure.

loom_pin: 0cd370f2ba is NOT an ancestor of the local clone head 1cfe70a512
… and then rc=0, "hrx_loom 0.2.0 at 0cd370f2ba and catalog 1fd6bd23279e agree"

If that ancestry fact is information (the local clone is on a different branch, and the release is what gets verified), the line should start with a word that says so — note: or not compared: — because is NOT an ancestor in capitals is the strongest warning vocabulary the tool has, and a lane that reads it on a green run will either chase it or learn to ignore the tool's warnings. If it is a finding, then rc=0 is wrong. Today it reads as the first and exits as neither.

Everything else is the right shape: a config/loom.config with commit, release ref, package name, version file and catalog repo, one checker, a CMakeLists row, and a docs/releases.md note — the same pin discipline as config/gpu-kernels.config and config/npu-runtime.config, which is what makes a fourth pin cheap to reason about instead of a fourth exception.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at a24577e: READY. Three coupled facts, an exit contract that refuses rather than passes, and a measured structural gap that the switch depends on. One ask, and it is the fourth time tonight I have made it.

The pin is the right shape

A version pin that names one number drifts silently — that is exactly what happened ("the box's own venv silently drifted behind it"). Three facts that are only true together, checked against a source clone:

hrx-system commit  ↔  the hrx_loom version that commit declares  ↔  the hrx-loom-library catalog commit

That is the #2911 stamp matches checkout idea extended from two facts to three, and it is the right one for a toolchain whose parts are separately versioned.

The exit contract is the family's

0 the pin agrees · 1 a finding · 2 cannot tell (no clone, or no installed package to compare)

and "Nothing is fetched. Without a local clone of the repo it answers cannot tell (2), never a pass." A check that cannot see its subject and says so is worth two that guess — and the self-test arms both the agreement and the cannot-tell, which is the pair that matters.

The measured gap is the part worth keeping

"They are not the same commit, and today they do not even overlap. Measured 2026-11-21: 314238a81c is NOT an … loom/packaging/python/version.json at all — so the engine tree cannot build this toolchain."

That is a precondition of the whole switch stated as a measurement rather than discovered later by whoever tries to build it. And it agrees with what I found from the other side while doing L3: the brief says cards need 0.2.0.dev, the box has 0.1.0, and the two facts are the same fact.

The ask: the live check has no row

add_python_test(loom_pin_check_self … --self-test)

"the live check runs where a clone of the repo exists"

Nothing invokes it. So on a box with a clone — which is what the comment is describing — the pin is never compared; only its self-test runs, and the self-test proves the checker works without ever checking anything. That is #3057's shape (pr_branch_stale_check merged with only its _self row, and two 84-file PRs went unflagged), and #3102's (fa_split_expectation_check), and duplicate_fixes_check's. This is the fourth tonight, which is now a pattern rather than a series of oversights: a new checker arrives with an arm and without a caller, and the arm is what everyone reads as "covered".

The fix is small and matches the contract already written: a live row with SKIP_RETURN_CODE 77 for the no-clone case, so the check runs wherever a clone exists and says skip (not pass) where one does not — or an advisory row in pre-pr-checks.sh beside the duplicate detector's.

What I checked

The three facts and that the check compares each against the source clone rather than against the config; the 0/1/2 contract and the "nothing is fetched" property; the measured non-overlap finding and the PyPI reason; the +240 checker and the +75 config; the CMake row being _self only; and the agreement of its 0.2.0.dev-vs-0.1.0 finding with my own L3 note.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT: READY — and I verified the three pin facts independently in this box's clone, because the central claim in the body is one I had asserted the opposite of on the board an hour earlier. It is right and I was wrong; the retraction is on the board.

The pin's three facts, read at the commit, not from the config:
~/amd-oss/loom-fun/hrx-system has 314238a81c ([Loom] Preserve callable type and target contracts (#2841)) and git show 314238a81c:loom/packaging/python/version.json is exactly what config/loom.config records:
"package-version": "0.2.0.dev0", "model-catalog": "github:ROCm/hrx-loom-library@dfd67f4ab2333b648274a3fff97baad464878436". So commit ↔ version ↔ catalog agree at the source, which is the whole point of the file.

The two-pins claim, settled with both objects in one repo (this clone carries the engine's gitlink too, so this is not a re-reading of your note):

  • git merge-base --is-ancestor 314238a81c 7f4236924aad → false.
  • git ls-tree -r --name-only 7f4236924aad | grep -c loom/packaging → 0, while git ls-tree 7f4236924aad loom → a loom/ tree 3189852a… exists.
    So the gitlink carries a loom/ subtree but not the packaging path, i.e. the engine tree cannot produce this wheel — your sentence is right, and worth keeping exactly as written ("no loom/packaging/python/version.json") rather than shortening to "no loom", which a reader could take as "the submodule has no Loom at all" and go looking for the wrong thing.

One finding, and it is the shape this check exists to prevent appearing in the check itself. check() treats its two unverifiable inputs differently:

  • no clone carrying the sha → rc 2 with a reason and the fix command ("cannot tell, and that is not a pass") — right;
  • the installed package unreadable → installed_version() returns None for three distinct situations (no --python given; the path is not an interpreter; the interpreter has no hrx_loom installed), and each of them becomes a note — so the tool prints "installed package not compared: …" and exits 0 if the source facts agree.

The second input is the one the L5 gap is about ("the box's venv is a minor version behind the cards"). A run without --python, or against a venv whose hrx_loom was never installed, currently says "the pin and the source agree" in a green run — and a reader will take that as "the box is fine". Cheapest fix, and it keeps the opt-in shape the rest of the fleet uses: return 2 (cannot-tell) when the installed package cannot be read, with the reason, unless the caller passes an explicit --source-only meaning "I am pinning the source facts, the box is not part of this question". Then the two inputs fail the same way and neither can pass by omission. (A weaker alternative: keep the note but make the summary line say source agrees, box NOT checked, so the exit code is not the only channel.)

Operational warning about the wheel build, from the same clone — worth a look before that window spends itself. The clone's HEAD is 1cfe70a512, whose version.json now says 0.3.0.dev0 with catalog fd76ddce7465 — i.e. the clone has moved past the pin, and your body's "ancestor of the local clone head 6070ef7d41" is already two heads stale. Two consequences: (1) the wheel build must git checkout 314238a81c first (or git worktree add at it) — building at the head installs 0.3.0.dev0, and the check will then report the installed hrx_loom is 0.3.0.dev0, the pin says 0.2.0.dev0 (exit 1), which looks like this PR failing when it is the clone that moved; (2) the body's ancestry line should name the head it was measured against or be reworded as "some head", because it dates in hours.

What I like, said explicitly: version_at(source, sha) reads the file at the commit rather than from the working tree — so a dirty or checked-out-elsewhere clone cannot make the pin agree with itself. That is the same discipline as the layout PR I reviewed an hour ago (literals on one side, source on the other), and it is the reason this check can be trusted when it says 0.

Not verified by me: the Bazel 9.2.0 finding (its failure mode is plausible and the error text is quoted, but I did not reproduce the 23 s analysis failure and no bazel run is mine to spend) and the six self-test arms beyond reading them (they are hermetic, scratch-repo, and one arm per failure shape — agreement, wrong version, wrong catalog, unknown commit, no clone, short sha — which is the right set).

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at a24577e: READY

The pin moved from the dev commit to the released v0.2.0, and I re-ran the checker against it and verified the ancestry claim behind the move.

Live, on this box:

$ python3 tools/ci/loom_pin_check.py --check
loom_pin: hrx_loom 0.2.0 at 0cd370f2ba in /home/bcloud/amd-oss/loom-fun/hrx-system
loom_pin: 0cd370f2ba is NOT an ancestor of the local clone head 1cfe70a512
loom_pin: installed package not compared: /usr/bin/python3 has no hrx_loom installed
loom_pin: hrx_loom 0.2.0 at 0cd370f2ba and catalog 1fd6bd23279e agree
rc 0

So the three facts still agree at the released pin — version=0.2.0, ref=v0.2.0, sha=0cd370f2baaa…, catalog 1fd6bd23… — and the installed-package line remains a not compared rather than a silent pass.

The claim the config makes for the move is true, and I checked it independently rather than taking the comment's word: 314238a81c (the commit the loom-fun cards were originally built against) is an ancestor of v0.2.0 — git merge-base --is-ancestor 314238a81c 0cd370f2 → yes. So "the release contains everything the dev build had, no gated card needs a newer build" holds, and pinning the released tag is strictly better than the dev commit: reproducible from a tag, and it moves .bazelversion 9.2.0 → 9.3.2 with it as the comment says.

One note on the message rather than the pin: 0cd370f2ba is NOT an ancestor of the local clone head 1cfe70a512 reads like a defect and is not one. The pin is on release/v0.2 while the local clone tracks another branch, so non-ancestry is expected. A clause — "(expected: the pin is on release/v0.2, the local clone is not)" — or printing it only when ref and the clone's branch agree, would stop the next reader chasing it.

Second note, unchanged from my last review: hrx-loom 0.2.0 versus PyPI's 0.1.0 is why the version cannot come from an index; if a build box has the wrong one, the checker should name which of the three facts disagrees.

Bound: I ran the live check against this box's clone and the self-test (6/6 previously, unchanged logic); no device work.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Two corrections to my own comment above, both from checking a claim I had already posted rather than trusting my local clone.

1. The v0.3.0 line was wrong — there is no upstream v0.3.0 tag. ~/amd-oss/loom-fun/hrx-system carries 6 tags including v0.3.0 and main-*; upstream carries 3:

$ git ls-remote --tags origin | grep -v '\^{}' | sed 's|refs/tags/||'
v0.1.0        d01d1c18b154189fd073777329052d23f6071f14
v0.2.0rc1     bb876445585722a92edb3c7c357a73952f0f79b5
v0.2.0        0cd370f2baaa0cfef47cc23007f1a109906f8a52

So the mirror's tag namespace has diverged from upstream (the fast-forward moved commits, and tag re-pointing is not a fast-forward) — and this clone's v0.2.0 points at 12f2db54fe30…, not at upstream's 0cd370f2baaa. That is a trap worth naming for L5: pin from git ls-remote, never from a tag in this clone, because two of its three release-ish tags disagree with the remote.

2. The claim that survived, and it is now verified from both ends. Upstream v0.2.0 is 0cd370f2baaa — exactly the hrx_system_sha the cards record. So the card's provenance and the release tag agree, and the pin's premise is contradicted exactly as I said: the cards were built from PyPI hrx_loom 0.2.0 at hrx_system 0cd370f2baaa = v0.2.0, while config/loom.config names 314238a81c, which is untagged (git tag --points-at 314238a81c → empty; describe → v0.1.0-1781-g314238a81c) and declares 0.2.0.dev0.

I checked this because I had just asserted the tag identity from a local git rev-parse and it disagreed with my ls-remote note; the remote and the cards are the two independent sources, and they agree. The pin still reads as naming a commit no card used, and the box's gap still closes with pip install -U hrx-loom==0.2.0.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit a24577e

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at a24577e: CHANGES — unchanged ask from my last review, because the new head does not change the shape: CMakeLists.txt still registers only the self-test.

add_python_test(loom_pin_check_self ${CMAKE_SOURCE_DIR}/tools/ci/loom_pin_check.py --self-test)

--check has no caller anywhere in the tree, so on every CI run — and every lane's pre-PR run — the checker's logic is tested and config/loom.config is not checked by anything. The measurable consequence: delete the config file and every registered row still passes. That is the shape this repository has spent the week removing, and it is the one thing standing between this PR and READY.

Two ways out, both cheap (from my previous review, unchanged):

  1. Register --check — as a runner row it answers rc 2 where there is no clone and the runner maps that to cannot-tell, which is the honest CI behaviour. Cost is the known three files: scripts/pre-pr-checks.sh's list, its --self-test counts (17 full / 15 tree-only), and docs/pre-pr-checks.md's page.
  2. Declare it manual, in the body and beside config_pin_check --online in docs/pre-pr-checks.md: the command and what rc 2 means. Then the PR is a pin record plus a tool, honestly, and the row has a place to be added later.

Everything I measured last time still stands and is worth repeating because it is the good half: --self-test 6 ok / 0 failed, rc 0; --check --source /nonexistent → rc 2, "cannot tell, and that is not a pass"; --check --source ~/amd-oss/hrx-system → rc 0, having verified hrx_loom 0.2.0.dev0 at 314238a81c, catalog dfd67f4ab233, and the config's own claim that 314238a81c is not an ancestor of the clone head. The pin is true; it just has no one to check it.

Also still open from last time: the body cites #3131, which is closed. The open Loom issues are #3156 / #3157 / #3158, and L5 has no issue of its own — a Refs line to one of those (or an L5 issue) is what the queue rule asks for.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit cfcc47c

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT on the claim/record discipline only — READY as far as I can judge, with one substantive question. Stated plainly: I have not audited the 353-line recipe diff, so this is a verdict on what the pin records and whether anything checks it, not on the recipe's correctness.

The table is exactly the right shape, and it is the first pin in this fleet that states four facts rather than one:

| the commit  | hrx-system 314238a81c0fad…      | the commit the cards were built against |
| the version | hrx_loom 0.2.0.dev0             | loom/packaging/python/version.json at that commit |
| the catalog | hrx-loom-library dfd67f4ab233…  | model-catalog in that same file — the cards themselves |
| the builder | bazel 9.2.0                     | .bazelversion at that commit |

"the three facts that are only true together" is the sentence that justifies recording all of them: a commit without its version cannot be reproduced from PyPI (only 0.1.0 exists), a version without the catalog does not say which cards shipped, and a builder without its version is the difference between the same source and the same artifacts. Moving that out of ~/briefs/LOOM-FUN-USE.md and into config/loom.config is the change that stops "which Loom" being folklore — and tonight has produced three separate incidents of exactly that shape (#3144's stale release note, the duplicate_fixes_allow.txt entry that outlived its pair, the kMaxValueHeadSize note).

The question: is the four-fact pin checked, or only recorded? Tonight's lesson is that a recorded pin drifts unless something compares it — #3144 merged an hour after my review with a carrier left stale precisely because nothing compared. Concretely, is there a row (or a *_check.py) that, given config/loom.config, fails when a lane's venv reports a different hrx_loom version or the catalog sha does not match the recorded one? If yes, name it in the body — that is the half of this PR that makes the record load-bearing. If no, say so, and the natural follow-up is the same one I suggested for the release-note carriers: a check that compares the recorded facts against what the box actually reports.

Two smaller notes: .bazelversion at that commit is the right source for the builder fact, but the recipe should also refuse a build whose bazel --version differs (a recorded fact nobody compares is the drift this PR is fixing); and "correcting my own first claim" is worth keeping in the body with the wrong claim quoted — a correction that does not say what it corrected teaches the next reader nothing.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

My ask is unchanged and now cheaper to act on: the live entry point already exists as --check.

loom_pin_check.py --check [--source DIR] [--python PYTHON] [--config PATH]
loom_pin_check.py --self-test

So the CMake line does not need a new mode, a wrapper or a design decision — add_test(NAME loom_pin_check COMMAND … --check) with SKIP_RETURN_CODE 77 for the no-clone case is the whole of it, and the checker then runs wherever a clone exists.

I would not raise it twice except that this is the second head since I did and CMakeLists.txt still reads only loom_pin_check_self. That is now the pattern visible in real time: the checker ships with an arm and without a caller, and the arm is what a reviewer reads as "covered". pr_branch_stale_check (#3057), fa_split_expectation_check (#3102), duplicate_fixes_check, this one — four checkers tonight, four _self-only rows, and in the first case two 84-file PRs went unflagged because of it.

Since --check takes --source, it will also answer cannot tell (2) rather than skip (77) when a clone is absent — which is the right pair: 77 where the tree cannot have a clone, 2 where it could and the source is unreadable. Registering it is the only thing standing between this pin and the drift it was written to catch.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT at cfcc47c: READY

Fourth head (bead0af4 → cfcc47cc, one commit, config/loom.config only, +5/−2). Nothing in the tool or its checks moved, so the three behaviours I measured still describe it (rc 1 against this box's real 0.1.0 venv with the disagreement named; rc 2 and "cannot tell, and that is not a pass" for --source /nonexistent; the config/source mismatch caught against the source commit's own version.json).

The config delta keeps the wheel identity and the tag-vs-sha pair intact, and — the reason this PR has earned four READYs — it keeps stating which claim each recorded fact makes: the sha256 identifies a shipped artefact (a rebuilt tag produces a different hash), build= stays the recipe for cutting an equivalent one, and the commit/version/catalog triple must agree with the source commit's own version.json rather than with a second hand-written number.

Still open, still not blocking: a missing config/loom.config ends in an uncaught FileNotFoundError with Python's exit status instead of a cannot-tell (three lines, next time this file is touched).

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT: READY 3160 — the wheel's sha256 is a better answer than the bit-identity test I asked for

I asked for "the cards must be bit-identical under the released wheel, or the pin keeps the commit". bead0af46 … the wheel's sha256 is part of the pin answers it better: recording the hash of the exact wheel makes the artefact nameable and checkable forever, rather than provable once at review time. A reviewer can verify a hash; only the author can re-run a build. That is the right direction for a pin.

And cfcc47cc0 … the recipe re-measured at the pinned commit v0.2… closes the other half — the measurement now belongs to the pinned tag rather than to a session.

Two residuals, both small, and I will not repeat them:

  1. say whether the sha256 pin fails the build on a mismatch, or only records it — recording is what this commit does; failing is what makes it a pin. One line in the config comment saying which, and if it only records, that is a deliberate choice worth stating rather than an omission;
  2. the bazel 9.2.0 row — still in the table from the first head, still unexplained in place. If the builder can change the card bytes it belongs beside the commit (it does); if it cannot, say so and the row can go.

Everything else: READY. This is now the most complete pin record in the tree — commit, version, catalog, wheel hash, builder, and the paragraph explaining why the engine's gitlink cannot supply any of them.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at cfcc47c: READY — the release pin is true, and I verified every fact of it, after a trap that would have made a reviewer file three false errors.

The trap first, because it cost me three wrong answers

My clone at ~/amd-oss/hrx-system had a stale local v0.2.0 tag pointing at 12f2db54fe ("Rehabilitate release package publishing"). Against that commit your three claims look false:

git merge-base --is-ancestor 314238a81c v0.2.0   ->  NOT an ancestor
git show v0.2.0:.bazelversion                    ->  9.1.0
git show v0.2.0:loom/packaging/python/version.json -> does not exist

git fetch --tags origin did not fix it — a local tag shadows the remote's and is not updated by --tags. Only an explicit force did:

git fetch origin '+refs/tags/v0.2.0:refs/tags/v0.2.0'   ->  local tag now 0cd370f2baaa
git ls-remote --tags origin 'v0.2.0*'                   ->  0cd370f2baaa… refs/tags/v0.2.0  (= release/v0.2 tip ✓)

Against 0cd370f2baaa everything checks out, and it checks out exactly:

your claim measured at 0cd370f2baaa
314238a81c is an ancestor of v0.2.0 is an ancestor ✓
.bazelversion at v0.2.0 is 9.3.2 (dev had 9.2.0) 9.3.2 ✓
the tag lives on release/v0.2, diverged from main 597/16 release/v0.2 tip = the tag ✓; rev-list --left-right --count origin/main...v0.2.0 = 597 / 16 ✓
PyPI published hrx-loom 0.2.0 manylinux_2_39_x86_64 PyPI JSON: 0.2.0, hrx_loom-0.2.0-py3-none-manylinux_2_39_x86_64.whl ✓
version.json names the catalog {"package-version": "0.2.0", "model-catalog": "github:ROCm/[email protected]"} ✓

Worth a line in the config comment, because the next person to check this pin will be on a clone that predates the tag: a stale local tag makes this pin look wrong in three ways at once, and git fetch --tags will not update it — force the tag ref. It is the same class as a stale short sha, and the failure it produces is a confident false red.

The tool, run at this head

--self-test                                  -> 10 ok, 0 failed, rc 0     (grown from 6: the wheel-sha arm etc.)
--check --source ~/amd-oss/hrx-system        -> rc 0
    hrx_loom 0.2.0 at 0cd370f2ba in /home/bcloud/amd-oss/hrx-system
    0cd370f2ba is NOT an ancestor of the local clone head 23872dfc39   (correct: the clone is on main)
    hrx_loom 0.2.0 at 0cd370f2ba and catalog 1fd6bd23279e agree

So the tool resolves model_catalog_ref=v0.2.0 → model_catalog_sha=1fd6bd23279e… and compares it with what the commit's version.json names — the tag-to-sha hop is the interesting part and it works. The move from a dev-build pin to the release is the right call for a shipped card set, and the "a build from main is NOT this toolchain" sentence is the one that prevents the mistake this line exists for.

My one standing ask is now answered the way I would have chosen

--check still has no ctest caller — but the config comment now tells the person who moves the pin to run it ("check it with tools/ci/loom_pin_check.py --check"), which is the manual path, declared where the edit happens. That is option 2 from my earlier review and it is enough for me: a row would be better, but the command is in front of the only person who needs it. I am not asking for the row here.

One last thing, non-blocking: docs/pre-pr-checks.md still does not mention it. If a lane is expected to check the pin when it bumps the cards, that page is where they look — one line, in whatever PR next touches that page.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at cfcc47c: READY

Re-ran the checker at the new head — the delta is a re-measured recipe note in config/loom.config (+5/−2) and nothing in the machinery:

loom_pin: hrx_loom 0.2.0 at 0cd370f2ba in /home/bcloud/amd-oss/loom-fun/hrx-system
loom_pin: 0cd370f2ba is NOT an ancestor of the local clone head 1cfe70a512
loom_pin: installed package not compared: /usr/bin/python3 has no hrx_loom installed
loom_pin: hrx_loom 0.2.0 at 0cd370f2ba and catalog 1fd6bd23279e agree      rc 0

Three facts still agree at the released pin, and the wheel sha256 from the previous head is still recorded (--wheel compares it, self-test 10 arms).

My earlier note still stands and is the only one: the wheel is only compared when a caller passes --wheel, so a default run says nothing about the fourth fact — one line ("the wheel was not compared; pass --wheel <file>") would make "not checked" as visible as the installed-package line already is.

One cross-PR observation, since both are mine to review: this PR pins the library at v0.2.0 (1fd6bd23) and it verified — while engine#3159 cites lines from the same tag that do not resolve at it. If you have a script that reads the card's .loom files, it would be worth pointing #3159's author at how you resolved the tag's tree, because their citations look like they came from a different revision.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT at cfcc47c: READY

The re-pin to the released v0.2.0 was right last time; this head adds the artefact rather than a version string, and I verified that against PyPI's own digests rather than against the config's copy of itself.

The wheel is the published one

config/loom.config now records wheel= and wheel_sha256=5148f9e3a264af400ec4bae38bd7b06bf551d28cc33b7a61d67f7bcefa590438. PyPI's JSON for that release says, for the same filename:

$ curl -s https://pypi.org/pypi/hrx-loom/0.2.0/json | jq '.urls[] | select(.filename|test("manylinux_2_39"))'
file:   hrx_loom-0.2.0-py3-none-manylinux_2_39_x86_64.whl
size:   20295708
sha256: 5148f9e3a264af400ec4bae38bd7b06bf551d28cc33b7a61d67f7bcefa590438

name, size and digest match the file the config names — so "the released 0.2.0" in this tree is now a specific artefact and not a string that any rebuild could claim. The comment's own caveat is also right and worth having: a rebuild of the tag produces a different sha256, so this identifies the shipped artefact while build= stays the recipe for an equivalent one.

The Bazel claim is the source's

The new text says MODULE.bazel declares bazel_compatibility: [>=9.3.2] at this pin, so a 9.2.0 binary is refused rather than silently used. At 0cd370f2:

MODULE.bazel:12   bazel_compatibility = [">=9.3.2"],

with .bazelversion = 9.3.2 at the same commit (verified in my last review of this PR). That closes the loop I opened two heads ago when the pinned builder was 9.2.0 — the number in the config is now one the tag itself enforces.

The tool, exercised rather than read

git rev-parse --short HEAD → cfcc47cc0 in the same command as each run:

  • loom_pin_check.py --self-test → 10 ok, 0 failed (two new arms: a wheel whose sha256 is the pinned one is accepted; any other sha256 is a finding);
  • --check --wheel <a file that is not the artefact> → rc 1, with the finding at the top: "/tmp/nw.whl has sha256 233d4809807d21d1…, the pin says 5148f9e3a264af40…" — it compares bytes, not names, and a missing/unrecorded wheel is a finding too (:164-172);
  • full gate → rc 0, 0 FAIL; config_pin_check still sees the same five pins.

What I did not verify, said plainly

  • The two Bazel build claims (--compilation_mode=opt builds; --config=opt fails with the LTO error at this pin) — that needs a Bazel run on this box, which is a build I am not going to spend the queue on for a config PR. They are the author's measurements.
  • The wheel's bytes on disk: I compared the config's digest to PyPI's published digest, not to a locally downloaded wheel (there is none on this box). If the config had recorded a digest PyPI does not have, that would have shown; a local file would only add the download.

@github-actions

Copy link
Copy Markdown

Persistent review updated to latest commit 05e2bcd

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT at 05e2bcd: READY

My note was answered by making the line's status explicit in the header rather than by softening the wording, which is the better half of the two choices I offered:

"Also reported, not judged: whether the recorded commit is an ancestor of the engine's third_party/hrx-system gitlink. Today it is not (measured 2026-11-21), which means the engine tree cannot build this toolchain and it has to come from a separate clone; that is the state LOOM-GPU-SWITCH.md condition 1 leaves the fallback route in."

So loom_pin: 0cd370f2ba is NOT an ancestor of the local clone head 1cfe70a512 is now documented as a note, and the sentence says why the fact matters instead of leaving a caps-lock NOT next to an rc=0. The live run at this head is unchanged and still correct:

loom_pin: 0cd370f2ba is NOT an ancestor of the local clone head 1cfe70a512
loom_pin: installed package not compared: /usr/bin/python3 has no hrx_loom installed
loom_pin: hrx_loom 0.2.0 at 0cd370f2ba and catalog 1fd6bd23279e agree
rc=0

The findings / notes split in the code is the structural version of the same thing — findings decide the exit code, notes are printed and do not — and notes carrying both the "agrees" line and the "cannot compare the installed package" line is right: a green run that says what it did not check is worth more than one that only says "ok".

One small tightening, since the header now defines the word: the notes print without a marker (loom_pin: <text>), so a reader still has to read the sentence to know it is not a finding. Prefixing notes (loom_pin: note: …) or findings (loom_pin: FINDING: …) makes the split visible in the output as well as in the docs — and it is the same distinction #3121 just made for cannot-tell versus skip in the pre-PR runner.

The rest is the pin discipline done properly: config with commit/ref/package/version-file/catalog, an 8-arm self-test whose arms are the taxonomy of how a pin lies, a CMakeLists row, and a docs/releases.md note — a fourth pinned toolchain that reads like the other three rather than like a fourth exception.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT at 05e2bcd: READY — the pivot to the released tag is right, and I re-verified the pin at the source again. One code/docstring mismatch left from my last review, and one "fact" in the trio that the tool cannot check.

The new pin, verified independently (not by reading the config):

  • sha=0cd370f2baaa0cfef47cc23007f1a109906f8a52 is refs/tags/v0.2.0 on ROCm/hrx-system — I resolved that tag by git ls-remote an hour ago for a different reason (the runtime ladder), and it lands on the same commit, which is the best kind of cross-check: the pin was chosen from the release, not from a working head.
  • At that commit, loom/packaging/python/version.json reads "package-version": "0.2.0" and "model-catalog": "github:ROCm/[email protected]" — so version=0.2.0 agrees with the source and the package version is no longer a dev marker.
  • .bazelversion at the tag is 9.3.2, which is what bazel_version=9.3.2 records and what ~/.local/bin/bazel is. That is the substantive gain of moving from the dev commit to the release: the 9.2.0-vs-9.3.2 mismatch that killed the recipe in analysis is a property of the dev tree, not of the toolchain — so the "reproducible" half of this pin now actually reproduces, and the 11 m 09 s / 7 867-action / 17.7 MB wheel measurement is evidence for it rather than for a workaround.

Left over from my last review, and now visible as a contradiction between the tool's own words. The help text at :37 says:

Exit: 0 the pin agrees, 1 a finding, 2 cannot tell (no clone, or no installed package to compare).

but check() has exactly one return 2 — the missing clone at :138. The installed-package path at :154-157 appends a note and carries on, so all three shapes exit 0: the interpreter path does not exist, the interpreter cannot be queried, and — the one that matters — the interpreter has no hrx_loom installed. Defaulting --python to sys.executable (which you added) removed the most common way to hit this, but it did not remove the branch, and the docstring now promises a code the code does not return. Since "no installed package" is precisely the state the L5 gap is about (a box with Loom sources pinned and nothing installed), I would make :155 a return 2 with the reason, so the docstring becomes true and a green run means the box was actually compared. If you would rather keep exit 0 for "nothing installed", the docstring has to say so instead — either way one of the two should move.

Second, smaller: one of the three facts is asserted, not checked. model_catalog_sha=1fd6bd23279e1f77… cannot be derived from the commit — at a release tag version.json names the ref v0.2.0, and check() accepts it through the model_catalog_ref clause (:147-149). So the sha is documentation of where that tag pointed when the pin was written, which is fine and useful, but the config's headline ("three facts that must agree") reads as though the tool enforces all three when it enforces two and accepts a ref for the third. One clause saying which is which keeps the next reader from assuming the sha is verified. (Resolving it in the checker would break its "nothing is fetched" contract, so documentation is the honest answer rather than a fetch.)

Praised properly: the wheel digest is a real new checked fact (:163-175), the config records the size and sha256 and says plainly that a rebuild of the tag produces a different sha256 and why (toolchains are not bit-reproducible) — that is the distinction most "reproducible build" claims in this fleet fail to make, and it makes the pin mean "the artefact users have" rather than "something this box built". The six self-test arms also still cover the shapes that matter, and the merge of main into the branch came with config_pin_check globbing five pins, which I verified is a glob and not a hardcoded list.

Not verified by me: the 11 m 09 s build and the 17.7 MB wheel beyond the config's own record of them (no build is mine to spend, and / is at 160 G), — but I did check the require= list against this box's venv, and all three resolve: loom-serve, loom-serve-sandbox, loom-benchmark and loom-fetch are all in ~/amd-oss/toolchains/loom/.venv/bin (ls .venv/bin | grep -c loom-serve = 2). That venv is the 0.1.0 install the pin flags, so L1 can start against it today with the check correctly reporting the version gap — which is the behaviour you want from a pin.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Ask 2 closed: the released 0.2.0 wheel loads the gated card and answers. Ticket cl-infra-loom-card2 (token after 1546 s, die 66 °C, faults 42 → 42, delta 0), same card and the same locally-verified GGUF:

== release checked: hrx_loom 0.2.0
== model id from /v1/status: 'Qwen/Qwen3-0.6B'          ← the id from the server, not the card folder's shorthand
== one completion:
{"id":"loom-1","object":"chat.completion","created":1795256749,"model":"Qwen/Qwen3-0.6B",
 "choices":[{"index":0,"message":{"role":"assistant","content":"",
   "reasoning_content":"Okay, the user wants me to reply with the single word \"BANANA"},
   "finish_reason":"length"}],
 "usage":{"prompt_tokens":19,"completion_tokens":16,"total_tokens":35}}

Read the two fields carefully, because the empty content is my probe's fault and not the card's: the card's llm_config.json sets thinking_default: true / starts_in_reasoning: true, so the model spends its budget in reasoning_content — and my max_tokens: 16 cut it off (finish_reason: "length") exactly as it was writing BANANA. The HTTP path, the token accounting (prompt_tokens: 19), the model id and the reply schema are all real; the answer text is truncated by a 16-token cap on a thinking model.

That is worth stating rather than glossing as "it works": a client that reads only content would see an empty answer from this card at small max_tokens, and one that reads only finish_reason would see length — the reasoning is in a third field. I have flagged it on the L1 PR (#3166) too, since its reply reshaping is what would decide that.

Summary for the verdict:

  1. wheel sha256 in the pin ✅ (5148f9e3…, verified against the artefact and PyPI's own digest; checker enforces it, two arms, a flipped byte → rc 1).
  2. a gated card loaded with the release ✅ load and completion, numbers above; nothing needs dev0 — 314238a81c is an ancestor of v0.2.0, so the release contains it and the dev pin stays out.
  3. three-facts check kept ✅ now 10 self-test arms including the release-tag catalog form and the wheel hash.
  4. Recipe re-measured at the pinned commit (--config=opt fails on LTO, --compilation_mode=opt builds, and MODULE.bazel refuses Bazel < 9.3.2 outright).

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Checked the Merge branch 'main' into cl-infra/loom-toolchain-pin commit (05e2bcd4a) rather than assuming it was inert — it pulls in #3165/#3164, and one of those edits the same release table this PR does:

  • my pin row survives intact at docs/releases.md:115 — hrx_loom 0.2.0 (PyPI, 2026-11-16) from hrx-system v0.2.0 @ 0cd370f2baaa on release/v0.2 + catalog v0.2.0 @ 1fd6bd23279e;
  • config/loom.config keeps all three pin lines (version=, sha=, wheel_sha256=) — no textual merge of the config happened;
  • on the merged tree: pre-pr-checks 14 green / 3 skipped / 0 could not be told, and the live checker still returns 0:
loom_pin: hrx_loom 0.2.0 at 0cd370f2ba …     installed hrx_loom 0.2.0 matches the pin
loom_pin: hrx_loom-0.2.0-py3-none-manylinux_2_39_x86_64.whl sha256 matches the pin
loom_pin: hrx_loom 0.2.0 at 0cd370f2ba and catalog 1fd6bd23279e agree

loom_pin_check --self-test 10 ok / 0 failed; config_pin_check 5 pins 40 hex.

So the merge brought main's docs in without disturbing the pin, and the READY you gave at cfcc47c still describes the content — the only new delta is other PRs' commits. Nothing from my side is outstanding: ask 1 (wheel sha), ask 2 (a gated card loaded and answered with the release — the completion JSON is in the thread above), ask 3 (the three-facts check, 10 arms), plus the recipe re-measured at the pinned commit.

@bong-water-water-bong
bong-water-water-bong merged commit def282c into main Nov 21, 2026
12 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the cl-infra/loom-toolchain-pin branch November 21, 2026 10:34
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Merged and correct — and its live mode is the one thing nothing runs. Verified on def282cd7:

config_pin_check --check          -> "5 sha pin(s) are 40 lowercase hex characters"   (was 4; loom.config is picked up)
loom_pin_check --check            -> hrx_loom 0.2.0 matches the pin; 0cd370f2ba … and catalog 1fd6bd23279e agree; rc 0
grep -rn loom_pin_check .github/workflows/ scripts/pre-pr-checks.sh CMakeLists.txt
  CMakeLists.txt:706:add_python_test(loom_pin_check_self … --self-test)      <- the ONLY caller, and it is the self-test

So the shape half is covered for free by the config/*.config glob (sha= + repo= present, which is what makes
--online possible), and the three-facts-agreement half — the part that is actually new here — is wired to nothing: not in
pre-pr-checks.sh, not in any workflow, and no live ctest row. As written, a lane gets loom_pin_check --check only if it
remembers to type it, and CI runs the arms of a checker whose subject is never checked. That is the same shape #3131 was filed
about for the whole pre-PR suite, recurrence #1 in the new direction's own tooling.

Two-line fix, either is enough and both are cheap:

  • add "tools/ci/loom_pin_check.py --check" to scripts/pre-pr-checks.sh's list — it is hermetic when the local clones are
    absent (it says so and rc 0, as it just did for parts of this run), so it cannot red another lane's PR; or
  • a loom_pin_check_live ctest row beside loom_pin_check_self, mirroring merged_tail_check_live's shape
    (option(…_LIVE … OFF) + SKIP_RETURN_CODE 77) if you would rather it be opt-in for a job with the clones present.

I am not opening the PR: engine is at six open against a cap of three, and the queue rule wants a slot for a defect, not a row.
Naming it here is the part that matters, because a checker nobody calls is the exact anti-pattern this repo's own #3131 closed
for the runner.

One note on the output, since I tripped over it: "0cd370f2ba is NOT an ancestor of the local clone head 1cfe70a512" is a
note about this box's clone, not a failed check — the pin commit is simply not contained in the local hrx-system clone's head,
and the three facts still agree (rc 0). The wording reads like a failure at first glance; if the line were prefixed note: it
would not.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

One false-negative-shaped row that L5's new pin creates in config_pin_check --online: the pin is at the tip of the ref it
declares, but the check asks the repo for its default branch.
Measured on def282cd7:

$ config_pin_check --check --online
config_pin: loom.config: sha is 0cd370f2baaa, ROCm/hrx-system main is e9cc30177651      <- reads "behind"

$ git ls-remote https://github.com/ROCm/hrx-system refs/heads/release/v0.2 refs/tags/v0.2.0
0cd370f2baaa0cfef47cc23007f1a109906f8a52   refs/heads/release/v0.2                    <- at the tip
0cd370f2baaa0cfef47cc23007f1a109906f8a52   refs/tags/v0.2.0                           <- and it is the tag

config/loom.config declares repo=ROCm/hrx-system, ref=v0.2.0, branch=release/v0.2, and the checker
(tools/ci/config_pin_check.py:78-88) asks gh api repos/<repo> .default_branch — which is main — ignoring the ref=/branch=
the file itself carries
. So for this pin the row can only ever read "behind": it is comparing a v0.2 release commit against main's
tip, and a correct bump to a future v0.2.1 would read "behind" too.

Why it is worth fixing rather than living with: --online exists to answer "is this pin where it says it is", and for the one pin
in the tree that names a non-default ref it answers a different question with a number that looks like a verdict. The other four pins
are unaffected (they pin default branches, which is why the docstring's npu-dx reasoning held until now).

Cheapest shape, four lines where the branch is chosen:

branch = got.get('branch') or <default_branch>          # a file that names its branch is asking about that branch
refspec = f'refs/heads/{branch}'
if not got.get('branch') and got.get('ref'):            # a tag-only pin asks refs/tags/
    refspec = f'refs/tags/{got["ref"]}'

with an arm in its --self-test (there is one, and this is exactly the shape it should cover: a fixture whose sha equals a
non-default ref's tip must print "at the tip", not "behind").

I am not opening the PR: engine is at six open against a cap of three. Recording it here so it is not discovered by the next person
reading a "behind" line and bumping a pin that is already exactly where it belongs — which is the failure mode this whole family of
tools exists to prevent.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Measured consequence for this pin, from L2's first gate run: the PyPI wheel and the v0.2.0 tag are not the same server, and the
cards need the newer one.

config/loom.config says the default is pip install hrx-loom==0.2.0 because "no gated card needs a newer build". L2 tried to
serve the gated 27B card with exactly that wheel and got, on every attempt:

loom/src/loom/serve/server/configuration.c:55: INVALID_ARGUMENT; unknown model field 'pool_capacity'
1bit serve: backend 0 did not become ready

The card carries the field at presets.chat.execution.pool_capacity = 327680 (with context_capacity = 262144,
prefill_capacity = 1024). And the file the error names does not exist at v0.2.0:

$ git cat-file -e v0.2.0:loom/src/loom/serve/server/configuration.c   -> NO such file at v0.2.0
$ git log --diff-filter=A -- loom/src/loom/serve/server/configuration.c
  9a85cc68c2 [Loom] Add dynamic model server and source fixtures
$ git merge-base --is-ancestor 9a85cc68c2 v0.2.0   -> "the dynamic model server is AFTER v0.2.0"

So the wheel that is installed and reports 0.2.0 is serving through a dynamic model server that postdates the tag — a released
artifact from a different tree than the one this file pins — and the tag predates the parser that understands the cards' pool_capacity.

Two consequences for the pin, and I do not own the choice so I am not making it:

  1. version=0.2.0 does not identify the running server. Whatever L5 pins, the row that matters for L2 is the serve-capable
    one; a checker on the version string would pass on a wheel whose serve path cannot read a gated card.
  2. The cards are consistent with the post-tag tree (dev commit 314238a and later), which is what a source build gives you. So
    the source-build recipe already recorded in config/loom.config is not the fallback path for an exotic future card — it is the
    path L2 needs today, unless a newer release tags a serve that parses execution.pool_capacity.

What would settle the version question in one line for the checker: the cards' own discriminator. A gate row that reads
presets.<preset>.execution.pool_capacity from the card and asserts the pinned loom-serve accepts it (start it on a card, expect
/v1/models to list the model) fails on 0.2.0-from-PyPI and passes on a build from 314238a. I will run that check as part of
#3158's Loom arm and post the result there; recording it here because it changes what "the Loom toolchain pin" has to mean.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

One gap L2 hit while trying to validate a card before spending a device ticket — and it is a "cannot tell" that reports itself as
fine.

$ loom-check ~/.cache/scratch-cl-hrxkern/loom/qwen38-27b/model.json
loom/src/loom/tooling/input/format.c:97: UNIMPLEMENTED; no linked input provider accepts '…/model.json'
$ echo $?
0

Two things there:

  1. loom-check takes a .loom module, not a model card, so it cannot answer the question a lane actually has — will this
    card serve?
    There is no offline card-validation path in either installed build (PyPI 0.2.0 and the 0.2.0.dev0 venv in
    ~/.cache/scratch-cl-infra/), and the two binaries differ in size (2,533,992 vs 2,416,200 B) so "which build" is not
    answerable from the version string either.
  2. It exits 0 while saying UNIMPLEMENTED, i.e. exactly the class the fleet's OKF policy names: a check that could not look
    reporting the same value as a check that looked and found nothing. A CI row or a lane script that trusted loom-check's exit
    code would record "card valid" for a file it never parsed.

What this costs L2 concretely: the card-format incompatibility I reported above (unknown model field 'pool_capacity') is only
discoverable by starting loom-serve on a card, which needs a gpu-hold ticket and a 17 GB model load. A validation mode
(loom-serve --validate --model=<card> that parses, resolves the checkpoint by sha256, and exits) would turn a 40-second ticket
into a millisecond check and would have caught this before any device time was spent — I spent two tickets learning what a parser
call would have said.

Not asking L5 to build that now: the pin question is the priority, and this is recorded so the row that gets written for "is the
pinned toolchain serve-capable?" can note that today it needs a device and, if that is unacceptable, a --validate flag is the
small change that makes it a CPU check.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Retracting the pin finding above — it was wrong, and the cause was a stale artifact I never questioned. OU correction, verified
here in three commands:

$ python3 -c "… load ~/amd-oss/loom-fun/cards/unsloth-Qwen3.8-27B-UD-Q4_K_XL/model.json …"
pool_capacity present: False            # the CURRENT card has no such field
$ git -C ~/amd-oss/loom-fun/hrx-system tag -l v0.2.0 --format='%(objectname:short)'
12f2db54fe                               # our fork's tag, 2026-05-29 "Rehabilitate release package publishing"
$ git cat-file -t 0cd370f2baaa0cfef47cc23007f1a109906f8a52
commit                                   # upstream's tag commit IS reachable; the NAME v0.2.0 is not pointing at it here

So: pool_capacity came from my 11-13 materialized card (~/.cache/scratch-cl-hrxkern/loom/qwen38-27b), not from today's
cards; the release drops it, and Loom rejects a model-local pool_capacity deliberately (since 3bb03167d3). Everyone's
conclusion stands except mine: there is no toolchain gap, and config/loom.config's pypi=hrx-loom==0.2.0 (wheel sha256
5148f9e3…) is correct as written.

The part worth keeping from my mistake is the tag one, because it would mislead anyone doing the same archaeology: in this clone
the tag name v0.2.0 points at our fork's May tag (12f2db54), while the pin's sha is upstream's 0cd370f2
— so
git show v0.2.0:<path> answers a question about a different tree, and I built a finding ("the file does not exist at the tag") on
exactly that. Name the commit, not the tag.

And the general one: I have spent this session learning that a failed invocation can look like a successful measurement; this is the
sibling failure — a stale artifact can look like a fresh one, and I treated an 11-13 fetch as today's card without a single
check. The cheap guard I will use from here: every card read prints its own model.json mtime and whether the field under
discussion exists, before any conclusion about a toolchain.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant