Skip to content

feat(ironwood): tpu7x 8 logical device enumeration + dual-chiplet CDI/exporter metadata (#21) - #47

Merged
saariuslystoned merged 7 commits into
mainfrom
feat/21-ironwood-tpu7x-8dev-d2d
Dec 1, 2026
Merged

saariuslystoned merged 7 commits into
mainfrom
feat/21-ironwood-tpu7x-8dev-d2d

Conversation

@saariuslystoned

@saariuslystoned saariuslystoned commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #21, #16 (provisional PCI IDs 0x1ae0:0x0075 and 0x1ae0:0x0076 remain pending live Day-1 lspci -nn / /dev/vfio/* hardware verification).

Summary

  • libopentpu (ot_pjrt.cpp, ot_device.cpp, ot_vfio.cpp, opentpu.h, opentpu_host_test.cpp): Aligns tpu7x-4t / tpu7x-4t-single (4 PCI functions × 2 chiplets = 8 logical devices across 4 packages, serpentine 2x2 coordinates (0,0,0), (1,0,0), (1,1,0), (0,1,0), core_on_chip 0/1, D2D pairs (0,1)..(6,7)) against tpu7x-4t-2fn (8 PCI functions × 1 chiplet across 4 packages).
  • ops/tpu-cdi (freetpu_cdi.py, test_freetpu_cdi.py, README.md): Aligns complete-chip accounting and visibility masks across 4 × 1-fn dual-chiplet and 2-fn Ironwood layouts while enforcing cross-source sysfs chip_id vs --chip-id-map collision checks and preserving distinct 1-to-1 logical maps.
  • ops/tpu-exporter (tpu_exporter.py, test_tpu_exporter.py, README.md): Wires package/chiplet and 768 GiB nominal HBM accounting (4 × 2 × 96 GiB) into production metrics and tightens validate_chip_id_map / ownership conflict handling across mixed generations and 1-fn / 2-fn layouts.
  • llama-cpp-cloudtpu & CI (.github/workflows/ci.yml, ggml-cloudtpu.cpp, pjrt_runtime.*, test_cloudtpu_host.cpp): Fixes cloudtpu_env_config.spmd_chips_raw overlay build, strict SPMD parsing/bounds validation, standalone resolve_spmd_chips_spec CTest, and overlay test-backend-ops negative checks (1x, 9, 17).
  • Day-1 Scripts & Regression Suite (tools/ironwood-day1/*, docs/cloud-tpu/*): Hardens Step 00/01/02/03 Python + POSIX awk parity (sysfs package/NUMA normalization, unlisted DID promotion/clamping, 0xff0000 class priority, pre-open unsupported-device refusal) and adds test_ironwood_day1.py with a compiled libfake_pjrt native C++ PJRT probe fixture.

Proof Block

  • Exact Head SHA: c24c9a2911b29d9d67eca5540699f07d26d798e3 (base: b6ee1688cf6c53ae88ad4b62e85d81952b856bd8)
  • Remote CI (runs/46769640735): GREEN — Clean-Room & OSS Boundary Audit (11s, SUCCESS) & Host Build, Header Checks & Self-Tests (5m25s, SUCCESS; incl. full llama.cpp overlay + negative SPMD checks).
  • Exact-Head Autoreview (P0 gate): PASS (overall: patch is correct (0.95), 0 findings across 2/2 passes [0.95, 0.98]).
  • Local gpt-6.2-astra (ultrafast) Adversarial Loop: Completed 18 full rounds (R1–R18) resolving PJRT 4×2 pairing, CDI/exporter cross-source collisions, GGML spmd_chips_raw, and Day-1 Python/POSIX awk parity; all 4 R18 findings fixed & verified locally (R19 halted mid-run at 63,722 tokens on ChatGPT quota exhaustion; exact-head gpt-6.1-sol P0 autoreview + GitHub Actions CI subsequently passed cleanly).
  • Local Verification (HEAD=c24c9a2):
    • make -C libopentpu verify-header-host host test: PASS (ALL_HOST_TESTS_PASSED, opentpu_vfio_smoke --mock, OPENTPU_MATMUL_PROOF_PASSED).
    • cmake -S libopenbuenos + ctest: 5/5 Passed; make -C libopenbuenos verify-header-host host test: PASS; cmake -S freetile + ctest: PASS.
    • ./llama-cpp-cloudtpu/build.sh standalone: 2/2 Passed (cloudtpu_host_tests, pjrt_runtime_guards_tests); C11/C++17 header syntax checks (litebuf_vii_wire.h, openbuenos_shim.c): PASS.
    • python3 ops/tpu-cdi/test_freetpu_cdi.py -v: 34/34 OK.
    • python3 ops/tpu-exporter/test_tpu_exporter.py -v: 26/26 OK.
    • for s in tools/ironwood-day1/*.sh; do bash -n "$s"; done && python3 tools/ironwood-day1/test_ironwood_day1.py -v: 4/4 OK (with compiled libfake_pjrt).
    • python3 router/freetpu_router.py --self-test --verbose: 197/197 OK + 3 example configs OK; test_select_tree_lut.py: 7/7 OK; tools/{emit_custom_gemm,dgc0_builder,spline_0x640,pack_int4}.py self-tests: PASS (external-corpus verify_*.py skipped without FREETPU_CORPUS_DIR, matching CI).
    • Clean-room audit (218 files: tracked + test_ironwood_day1.py) & git diff --check: PASS (0 violations).

…dening

- parse_hex_u64: require *end==\0 (fail-closed on trailing junk e.g. 0x75JUNK)
- ot_pjrt_client_create: guard zero/absurd pci/chiplet dims, overflow check on pci_funcs*chiplets_per_func, enforce total_logical <=64, double check for mock & live paths
- freetpu_cdi.tpu_topology_metadata: fail-closed on non-str/unhashable gens (None/int/list/dict), correct Optional[int] hint, add PEP8 blank line
- build_cdi_spec: emit chiplets-per-pkg/hbm for homogeneous shared-iommu-group selectors (Ironwood dual-chiplet gap), keep mixed-generation suppression
- No public-roads violations; ASan+UBSan clean; all Python tests pass
@saariuslystoned

Copy link
Copy Markdown
Collaborator Author

Adversarial Hardening & Public-Roads Audit Receipt (26ec5d86)

  • Prior PR head: f58cd0e9 → Hardened head: 26ec5d86
  • 3 bugs fixed: ot_vfio.cpp parse_hex_u64 trailing-junk bypass (0x75JUNK → fail-closed *end == '\0'), ot_pjrt.cpp total_logical overflow/div0 + <=64 guard, freetpu_cdi.py fail-closed on non-str/unhashable gens + homogeneous dual-chiplet metadata emission.
  • Verification: make -C libopentpu test + ASan+UBSan ALL_HOST_TESTS_PASSED, 34 CDI + 26 exporter + 62 adversarial stress checks PASS, public-roads diff scan clean.

…n, Day-1 suite

Refs #21, #16

- libopentpu: align tpu7x-4t-single (4 PCI fns x 2 chiplets = 8 logical devices across 4 packages, core_on_chip 0/1, serpentine D2D order) vs tpu7x-4t-2fn (8 fns); keep 0x0075/0x0076 provisional pending Day-1 lspci.
- ops/tpu-cdi & ops/tpu-exporter: enforce unified physical/logical package accounting across 1-fn & 2-fn Ironwood layouts, 768 GiB nominal HBM (4x2x96 GiB), and cross-source map collision validation.
- llama-cpp-cloudtpu & ci: fix ggml-cloudtpu spmd_chips_raw build/parsing, add standalone & overlay SPMD checks, and add Day-1 regression suite + libfake_pjrt native probe fixture with Python/awk parity.
@saariuslystoned
saariuslystoned merged commit 8420aff into main Dec 1, 2026
2 checks passed
@saariuslystoned
saariuslystoned deleted the feat/21-ironwood-tpu7x-8dev-d2d branch December 1, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant