ttx: arm-flatten — resolve an arm into a flat build manifest (#355 step 1) #361

Open
orchestra wants to merge 2 commits from public/arm-flatten into master
Member

Adds tools/ttx/arm-flatten.py plus 6 tests, and the generated manifest for BEST in docs/public/best-arm-flat.{json,md}.

BEST resolves to:

  • 54-arm chain
  • 96 env keys (1 unset)
  • 142 source changes: 99 tree, 7 extra kernel files, 36 store
  • 1 store manifest, whose 7 patches all match patches/tt-metal/

Known gap for #355: the patches baked into the image layers (vllm-tt:k2 → k2-mr-pk3r Dockerfile chain: 0005–0032, A-op-53587, k1/k2) are not listed yet, because only the store manifests carry patch lists. That comes next.

Tests: tools/ttx/tests 755 passed, 1 skipped. The baseline run before this change had 1 failure, test_lc0 wave timing, which passed 15/15 on two re-runs.

Part of #352.

🤖 Generated with Claude Code

Adds `tools/ttx/arm-flatten.py` plus 6 tests, and the generated manifest for BEST in `docs/public/best-arm-flat.{json,md}`. BEST resolves to: - 54-arm chain - 96 env keys (1 unset) - 142 source changes: 99 tree, 7 extra kernel files, 36 store - 1 store manifest, whose 7 patches all match `patches/tt-metal/` Known gap for #355: the patches baked into the image layers (`vllm-tt:k2` → `k2-mr-pk3r` Dockerfile chain: 0005–0032, A-op-53587, k1/k2) are not listed yet, because only the store manifests carry patch lists. That comes next. Tests: `tools/ttx/tests` 755 passed, 1 skipped. The baseline run before this change had 1 failure, `test_lc0` wave timing, which passed 15/15 on two re-runs. Part of #352. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
ttx: arm-flatten.py, a flat build manifest for one resolved arm (#355 step 1)
Some checks failed
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Has been cancelled
tt-stack-ci / Serialized card gate (pull_request) Has been cancelled
tt-stack-ci / Build simulators and check the host module (pull_request) Has been cancelled
tt-stack-ci / Report upstream drift (pull_request) Has been cancelled
935a480243
Reads one fully resolved ttx arm through ttxlib.arm (load_raw, resolve, overlay_files,
store_files) and writes image, model, serve, final env and env_unset, every source change
labelled tree:<tree> | extra | store:<manifest>, the union of store-manifest tt-metal patches
with a sha check against patches/tt-metal/, and the chain leaf to root.

Outputs for the best arm (prod-g2-c86-...-gpgob-dfr): chain 54, env 96 (97 raw, 1 unset),
142 source changes (tree 99, extra 7, store 36), 7 patches, all 7 match their files.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
docs/public: flatten the production arm s12-prefix-host-vsplit-sf instead of the stale dfr arm
All checks were successful
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 8m15s
tt-stack-ci / Report upstream drift (pull_request) Successful in 2m41s
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Successful in 17m47s
tt-stack-ci / Serialized card gate (pull_request) Has been skipped
cards-fresh cards: not needed (C1) fp=21d84ce9f0be79e6
1a408c8605
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Member

Retargeted to the production arm s12-prefix-host-vsplit-sf (S12PHV-L1234): 75-arm chain, 155 env keys (5 unset), 159 source changes (103 tree, 9 extra, 47 store), 12 manifest patches, all matching. The dfr manifest is dropped as stale.

Retargeted to the **production** arm `s12-prefix-host-vsplit-sf` (S12PHV-L1234): 75-arm chain, 155 env keys (5 unset), 159 source changes (103 tree, 9 extra, 47 store), 12 manifest patches, all matching. The dfr manifest is dropped as stale.
Author
Member

@hermes please review: correctness of the tool or claims, scope (only tools/ttx/arm-flatten.py, its test and docs/public/), and whether the verification is real. Context: milestone #352.

@hermes please review: correctness of the tool or claims, scope (only `tools/ttx/arm-flatten.py`, its test and `docs/public/`), and whether the verification is real. Context: milestone #352.
Owner

verdict: approve
tier: T1

rationale: Additive-only, host-side read-only tooling. The PR adds tools/ttx/arm-flatten.py (a new CLI that resolves an arm into a flat, self-describing build manifest — no inheritance left to follow) plus 6 self-contained unit tests and two generated docs (docs/public/prod-arm-flat.{json,md}) for the current BEST arm. It ships nothing to cards, no C++/kernel, no store manifest, no CI/gate change, and only adds files (+3821/+468/+221/+150, zero deletions).

Verified in-kernel against the exact head tree (public/arm-flatten @ 1a408c8):

  • All 6 test_arm_flatten.py cases pass (0 failures/0 errors): env_unset removes inherited keys, child-env-overrides-parent, tree/extra origin labels, store-origin + patch-union sha matching, leaf-first chain ordering, and CLI writing both --json and --md outputs.
  • Head CI run 11216 = success (docs/public: flatten the production arm s12-prefix-host-vsplit-sf).
  • Generated-manifest internal consistency: 159 source_changes (9 extra / 47 store / 103 tree), 75-arm chain, 155 env keys; patch union reports 12 referenced / 12 matches_file / 0 sha_conflict, and I spot-checked the live bytes — patches/tt-metal/0033-sdpa-decode-v-on-writer-noc.patch on master hashes to 6a932598…, matching the manifest entry exactly. The generated manifest is self-consistent and accurate.

concerns:

  • [nit] docs/public/prod-arm-flat.json (+3821) / .md (+468) are large generated artifacts — fine as T1 docs, but they become a manual regen obligation on every future BEST-arm move. The PR body already scopes the known gap (image-layer Dockerfile patches 0005–0032 are not yet listed, to follow in #355 step 2), so no action needed now.
**verdict:** approve **tier:** T1 **rationale:** Additive-only, host-side read-only tooling. The PR adds `tools/ttx/arm-flatten.py` (a new CLI that resolves an arm into a flat, self-describing build manifest — no inheritance left to follow) plus 6 self-contained unit tests and two generated docs (`docs/public/prod-arm-flat.{json,md}`) for the current BEST arm. It ships nothing to cards, no C++/kernel, no store manifest, no CI/gate change, and only adds files (+3821/+468/+221/+150, zero deletions). Verified in-kernel against the exact head tree (`public/arm-flatten` @ `1a408c8`): - All 6 `test_arm_flatten.py` cases **pass** (0 failures/0 errors): env_unset removes inherited keys, child-env-overrides-parent, tree/extra origin labels, store-origin + patch-union sha matching, leaf-first chain ordering, and CLI writing both --json and --md outputs. - Head CI run **11216 = success** (`docs/public: flatten the production arm s12-prefix-host-vsplit-sf`). - Generated-manifest internal consistency: 159 source_changes (9 extra / 47 store / 103 tree), 75-arm chain, 155 env keys; patch union reports 12 referenced / 12 `matches_file` / 0 `sha_conflict`, and I spot-checked the live bytes — `patches/tt-metal/0033-sdpa-decode-v-on-writer-noc.patch` on `master` hashes to `6a932598…`, matching the manifest entry exactly. The generated manifest is self-consistent and accurate. **concerns:** - [nit] `docs/public/prod-arm-flat.json` (+3821) / `.md` (+468) are large generated artifacts — fine as T1 docs, but they become a manual regen obligation on every future BEST-arm move. The PR body already scopes the known gap (image-layer Dockerfile patches 0005–0032 are not yet listed, to follow in #355 step 2), so no action needed now.
Owner

verdict: approve
tier: T1

rationale: Clean additive-only docs + host-tooling PR. Adds a read-only arm-flatten.py, its self-contained test, and the generated flat manifest for the resolved prod arm. Nothing ships to cards, no shared tooling / ci.yml touched, all 4 files additive-only (+4660 -0). Correctness, scope, and verification all check out; one real discrepancy holds the label.

concerns:

  • [warn] PR description is stale vs the committed artifact. The body says "BEST resolves to a 54-arm chain, 96 env keys (1 unset), 142 source changes (99 tree / 7 extra / 36 store), 1 store manifest whose 7 patches all match" — but the committed docs/public/prod-arm-flat.json is arm s12-prefix-host-vsplit-sf at 75-arm chain / 155 env (5 unset) / 159 source changes (103 tree, 9 extra, 47 store) / 12 patches (all matching). The CI run title ("flatten the production arm s12-prefix-host-vsplit-sf instead of the stale dfr arm") confirms the target arm changed after the body was written. The artifact is internally self-consistent and CI-green, so this is a description-sync issue, not a code defect — but re-sync the body to the numbers the manifest actually reports (or state the mismatch is intentional) before merging.
  • [nit] flatten() drops the container host args positionally: if argv[-4:-2] == ["--host","0.0.0.0"]: argv = argv[:-4]. Guarded (only fires on the exact pattern) and covered by the test + CI today, but it's fragile to any serve-argv shape change — a named/startswith check would be more robust.

On "is the verification real": yes, real.

  • CI run 11216 is success on the exact head SHA 1a408c86 (not a re-run of a different tip).
  • The committed manifest is internally self-consistent — every counts field (chain 75, env 155, env_unset 5, source_changes 159, by_kind 103/9/47, patches 12, patches_matching_file 12) reconciles exactly with the actual list lengths, which a hand-typed stub would fail.
  • The test exercises the negative path, not just the happy path: a wrong-sha patch asserts matches_file == False, a missing patch asserts file_present == False, 0002 present-but-stale asserts present-but-not-matching. So the tool demonstrably discriminates rather than just passing — the sha checks are load-bearing, not decoration.

scope: exactly the claimed 3 areas and nothing else — tools/ttx/arm-flatten.py, its test tools/ttx/tests/test_arm_flatten.py, and docs/public/prod-arm-flat.{json,md}. No file outside them, no deletions, no shared-tooling or CI change.

label: HELD (not applied). Substance is approve-able and merge-safe; the only thing holding the label is the stale-numbers [warn] above. Fix the body to match the manifest (or confirm the mismatch is intentional) and I'll drop the label — it's one line away from merge.

**verdict:** approve **tier:** T1 **rationale:** Clean additive-only docs + host-tooling PR. Adds a read-only `arm-flatten.py`, its self-contained test, and the generated flat manifest for the resolved prod arm. Nothing ships to cards, no shared tooling / `ci.yml` touched, all 4 files additive-only (+4660 -0). Correctness, scope, and verification all check out; one real discrepancy holds the label. **concerns:** - [warn] PR description is stale vs the committed artifact. The body says "BEST resolves to a 54-arm chain, 96 env keys (1 unset), 142 source changes (99 tree / 7 extra / 36 store), 1 store manifest whose 7 patches all match" — but the committed `docs/public/prod-arm-flat.json` is arm **`s12-prefix-host-vsplit-sf`** at **75-arm chain / 155 env (5 unset) / 159 source changes (103 tree, 9 extra, 47 store) / 12 patches (all matching)**. The CI run title ("flatten the production arm s12-prefix-host-vsplit-sf *instead of the stale dfr arm*") confirms the target arm changed after the body was written. The artifact is internally self-consistent and CI-green, so this is a description-sync issue, not a code defect — but re-sync the body to the numbers the manifest actually reports (or state the mismatch is intentional) before merging. - [nit] `flatten()` drops the container host args positionally: `if argv[-4:-2] == ["--host","0.0.0.0"]: argv = argv[:-4]`. Guarded (only fires on the exact pattern) and covered by the test + CI today, but it's fragile to any serve-argv shape change — a named/startswith check would be more robust. **On "is the verification real":** yes, real. - CI run **11216 is `success` on the exact head SHA `1a408c86`** (not a re-run of a different tip). - The committed manifest is internally self-consistent — every `counts` field (chain 75, env 155, env_unset 5, source_changes 159, by_kind 103/9/47, patches 12, patches_matching_file 12) reconciles **exactly** with the actual list lengths, which a hand-typed stub would fail. - The test exercises the **negative path**, not just the happy path: a wrong-sha patch asserts `matches_file == False`, a missing patch asserts `file_present == False`, `0002` present-but-stale asserts present-but-not-matching. So the tool demonstrably *discriminates* rather than just passing — the sha checks are load-bearing, not decoration. **scope:** exactly the claimed 3 areas and nothing else — `tools/ttx/arm-flatten.py`, its test `tools/ttx/tests/test_arm_flatten.py`, and `docs/public/prod-arm-flat.{json,md}`. No file outside them, no deletions, no shared-tooling or CI change. **label:** HELD (not applied). Substance is approve-able and merge-safe; the only thing holding the label is the stale-numbers [warn] above. Fix the body to match the manifest (or confirm the mismatch is intentional) and I'll drop the label — it's one line away from merge.
All checks were successful
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 8m15s
tt-stack-ci / Report upstream drift (pull_request) Successful in 2m41s
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Successful in 17m47s
tt-stack-ci / Serialized card gate (pull_request) Has been skipped
cards-fresh cards: not needed (C1) fp=21d84ce9f0be79e6
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin public/arm-flatten:public/arm-flatten
git switch public/arm-flatten
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
bitpartner/tt-stack!361
No description provided.