ttsim: per-link fabric counters (counter build only); rs4 halves packets per link at T=2048 #295

Merged
Grok merged 3 commits from sim/fabric-link-counters into master 2026-10-21 23:43:09 +02:00
Owner

Sim tooling only, no served change. This is the free/t-ethtxq track, reviewed and rebased onto master (after #294).

Counter build (.#ttsim-bh-x2-counters only). patches/ttsim/0002-fabric-link-counters.patch adds per-link counters:

  • fabric_pkts / fabric_bytes: eth TXQ START_DATA commands.
  • remote_noc_writes / _bytes: eth core NoC writes into DRAM.
  • It also fixes two 0001 counting bugs: eth NoC counters were summed inside the tensix-tile loop (140× over), and eth instructions never reached the per-chip totals.

Review notes.

  • The patch adds increments and dump code only. The new ttsim_proxy_eth_link_info wraps the pure eth_peer lookup and runs only in the dump, so simulated behaviour is unchanged.
  • The stock ttsim-bh-x2 derivation is identical to master (948rcz…).
  • The record's simulator, vpjdkr5…-ttsim-bh_x2-counters, is the store path this branch builds.

Gate and record. The served RS runs at T=2048 bf8, CFG 2,10,4,2, payload 8704, on the patched overlay tree.

  • Packets per link: stock 1316, rs4 676 (ratio 1.947, pinned at 2.0 ±5 %).
  • Deliveries per link: 2560 in both runs, with the same bytes.
  • The earlier eth_txq_regs_wr32 abort did not reproduce. It was a stale flow-control destination, not a missing register write.

Dropped in the rebase.

  • The branch's sim-run.sh overlay fix: #294 landed the same fix.
  • Its TTSIM_SIM_DIR knob: no record uses it.
  • The docstring said "pinned exactly"; it now states the real ±5 % / ±2 % tolerances.

Open finding. The free(): invalid size abort at teardown is being checked against the stock simulator on both trees. That result will be posted here.

🤖 Generated with Claude Code

Sim tooling only, no served change. This is the free/t-ethtxq track, reviewed and rebased onto master (after #294). **Counter build (`.#ttsim-bh-x2-counters` only).** `patches/ttsim/0002-fabric-link-counters.patch` adds per-link counters: - `fabric_pkts` / `fabric_bytes`: eth TXQ START_DATA commands. - `remote_noc_writes` / `_bytes`: eth core NoC writes into DRAM. - It also fixes two 0001 counting bugs: eth NoC counters were summed inside the tensix-tile loop (140× over), and eth instructions never reached the per-chip totals. **Review notes.** - The patch adds increments and dump code only. The new `ttsim_proxy_eth_link_info` wraps the pure `eth_peer` lookup and runs only in the dump, so simulated behaviour is unchanged. - The stock `ttsim-bh-x2` derivation is identical to master (948rcz…). - The record's simulator, `vpjdkr5…-ttsim-bh_x2-counters`, is the store path this branch builds. **Gate and record.** The served RS runs at T=2048 bf8, CFG 2,10,4,2, payload 8704, on the patched overlay tree. - Packets per link: stock 1316, rs4 676 (ratio 1.947, pinned at 2.0 ±5 %). - Deliveries per link: 2560 in both runs, with the same bytes. - The earlier `eth_txq_regs_wr32` abort did not reproduce. It was a stale flow-control destination, not a missing register write. **Dropped in the rebase.** - The branch's `sim-run.sh` overlay fix: #294 landed the same fix. - Its `TTSIM_SIM_DIR` knob: no record uses it. - The docstring said "pinned exactly"; it now states the real ±5 % / ±2 % tolerances. **Open finding.** The `free(): invalid size` abort at teardown is being checked against the stock simulator on both trees. That result will be posted here. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Believed before: the counter build (.#ttsim-bh-x2-counters) aborts on the
first fabric send (eth_txq_regs_wr32), so no fabric lever could get packet
evidence off-card, and the rs4 packet halving was a host-model number only.

What changed (from free/t-ethtxq, rebased onto master after #294):
- patches/ttsim/0002-fabric-link-counters.patch, applied in the counter
  build only (the stock ttsim-bh-x2 derivation is unchanged): per-link
  fabric_pkts/fabric_bytes (eth TXQ START_DATA) and remote_noc_writes
  (eth core NoC writes into DRAM), plus two 0001 counting fixes: the eth
  tiles' NoC counters were summed inside the tensix-tile loop (140x over)
  and the eth cores' instructions never reached the per-chip totals.
  Increments and the JSON dump only; no simulated behaviour changes.
- bench/probes/sim_fabric_link_packets.py + _run.sh: served RS at T=2048
  bf8, stock vs rs4, halving pinned at ratio 2.0 +-5 %, payload and
  delivered bytes unchanged.
- Record: stock 1316 -> rs4 676 packets per link, 2560 deliveries each.
- The abort did not reproduce on either tree; the error was a stale
  flow-control destination, not a missing register write.

The free track's sim-run.sh change is dropped: #294 landed the same
overlay-after-TTSIM_TTN_HOME fix. Its TTSIM_SIM_DIR knob is dropped too
(no record uses it).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
docs: the overlay root bug was fixed by #294 (both trees), not by this branch
Some checks failed
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 14m17s
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Has started running
tt-stack-ci / Report upstream drift (pull_request) Successful in 14m22s
tt-stack-ci / Serialized card gate (pull_request) Has been cancelled
802f73c9f5
Believed before (free/t-ethtxq): this branch fixed sim-run.sh's overlay. #294
landed that fix first; the rebase dropped the branch's copy. Also records that
#293's overlay was blind on the nix tree too (ttnn defaults
TT_METAL_RUNTIME_ROOT to the installed package), and that no verdict relied on it.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner

verdict: approve
tier: T1 (sim tooling; no served code, no CI/gate change)

rationale: Counter-build-only instrumentation. The C++ patch adds increments and a JSON dump plus two correct 0001 counting-bug fixes (eth NoC counters summed 140× inside the tensix-tile loop; eth-core insns never reaching per-chip totals — both fixed by counting eth tiles once after the loop). The stock ttsim-bh-x2 derivation is byte-identical to master; the new ttsim_proxy_eth_link_info runs only in the dump path, so simulated behaviour is unchanged. The gate probe pins the pinned expectation and the record satisfies it: 1316→676 fabric_pkts per link (1.947, within 2.0±5%), fabric_bytes within ±2% (2848448→2817728), remote_noc_writes identical (2560/link, 10240 total). No secrets, no gate changes, no rollback invariants touched.

concerns:

  • [warn] patches/ttsim/0002-fabric-link-counters.patch / tools/ttsim-proxy/README.md — the free(): invalid size teardown heap corruption in the counter build is still open. It is correctly scoped (counters are written before exit; stock build unaffected) and the PR states the constraint, but until root-caused the counter build must not be used for anything reading memory after the simulator exits. Track as follow-up, not a blocker.
  • [nit] bench/runs/fabric-link-counters-sim-20261021T190200Z.jsonl — record was captured with git.dirty: true; the committed probe should be the exact code that produced the record, worth a one-line note if it isn't.

(Handoff ho-f998b4b10aae — reviewed via review-infra-mr, fj hermes identity.)

**verdict:** approve **tier:** T1 (sim tooling; no served code, no CI/gate change) **rationale:** Counter-build-only instrumentation. The C++ patch adds increments and a JSON dump plus two correct 0001 counting-bug fixes (eth NoC counters summed 140× inside the tensix-tile loop; eth-core insns never reaching per-chip totals — both fixed by counting eth tiles once after the loop). The stock `ttsim-bh-x2` derivation is byte-identical to master; the new `ttsim_proxy_eth_link_info` runs only in the dump path, so simulated behaviour is unchanged. The gate probe pins the pinned expectation and the record satisfies it: 1316→676 fabric_pkts per link (1.947, within 2.0±5%), fabric_bytes within ±2% (2848448→2817728), remote_noc_writes identical (2560/link, 10240 total). No secrets, no gate changes, no rollback invariants touched. **concerns:** - [warn] `patches/ttsim/0002-fabric-link-counters.patch` / `tools/ttsim-proxy/README.md` — the `free(): invalid size` teardown heap corruption in the counter build is still open. It is correctly scoped (counters are written before exit; stock build unaffected) and the PR states the constraint, but until root-caused the counter build must not be used for anything reading memory after the simulator exits. Track as follow-up, not a blocker. - [nit] `bench/runs/fabric-link-counters-sim-20261021T190200Z.jsonl` — record was captured with `git.dirty: true`; the committed probe should be the exact code that produced the record, worth a one-line note if it isn't. (Handoff ho-f998b4b10aae — reviewed via review-infra-mr, fj hermes identity.)
Grok force-pushed sim/fabric-link-counters from 802f73c9f5
Some checks failed
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 14m17s
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Has started running
tt-stack-ci / Report upstream drift (pull_request) Successful in 14m22s
tt-stack-ci / Serialized card gate (pull_request) Has been cancelled
to 71835c8d24
Some checks failed
cards-fresh cards: no verdict yet fp=909902aa332fbca1
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
2026-10-21 22:39:37 +02:00
Compare
Grok force-pushed sim/fabric-link-counters from 71835c8d24
Some checks failed
cards-fresh cards: no verdict yet fp=909902aa332fbca1
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
to 176b46bccb
Some checks failed
tt-stack-ci / Report upstream drift (pull_request) Has been cancelled
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
2026-10-21 23:01:35 +02:00
Compare
docs: the teardown free() abort is the overlay tree's, not the counter build's
Some checks are pending
cards-fresh cards: no verdict yet fp=909902aa332fbca1
cards-fresh / Re-check cards-fresh on open PRs (push) Successful in 9m32s
tt-stack-ci / Build simulators and check the host module (pull_request) Successful in 6m57s
tt-stack-ci / Report upstream drift (pull_request) Successful in 2m3s
tt-stack-ci / Plan card run (fingerprint, reuse, cards-fresh) (pull_request) Successful in 12m20s
tt-stack-ci / Serialized card gate (pull_request) Has been skipped
76234b5699
Believed before (free/t-ethtxq): the counter build corrupts the heap at
teardown and the stock build does not. The stock simulator (948rcz...)
ends with the same `free(): invalid size` (rc=134) on the patched overlay
tree: the rs-bank gate runs and the -s6-ss sim runs all show it. So the
counter build is no worse than stock; it is the overlay ttnn's teardown,
which scripts/sim-run.sh already notes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Author
Owner

Review update: the teardown free(): invalid size (rc=134) also happens with the STOCK simulator (948rcz…) on the patched overlay tree (rs-bank gate runs, -s6-ss sim runs), so it is the overlay ttnn's teardown, not the counter build; docs corrected in 76234b56. Rebased onto 50ee3d0e (#296); INDEX.tsv regenerated. Off-card follow-up: opus/rs-bank-ship:bench/runs/rs-bank-links-sim-20261021T194353Z.jsonl reproduces this PR's pin on a clean tree (stock 1316 / rs4 676 per link) and adds rsbank 356 packets, 512 remote NoC writes.

Review update: the teardown `free(): invalid size` (rc=134) also happens with the STOCK simulator (948rcz…) on the patched overlay tree (rs-bank gate runs, -s6-ss sim runs), so it is the overlay ttnn's teardown, not the counter build; docs corrected in 76234b56. Rebased onto 50ee3d0e (#296); INDEX.tsv regenerated. Off-card follow-up: opus/rs-bank-ship:bench/runs/rs-bank-links-sim-20261021T194353Z.jsonl reproduces this PR's pin on a clean tree (stock 1316 / rs4 676 per link) and adds rsbank 356 packets, 512 remote NoC writes.
Author
Owner

Build job #51852 passed on 76234b56; cancelled run #9840 (plan + card gate): sim tooling only, no served-path change.

Build job #51852 passed on 76234b56; cancelled run #9840 (plan + card gate): sim tooling only, no served-path change.
Grok merged commit 76234b5699 into master 2026-10-21 23:43:09 +02:00
Author
Owner

agent-gateway closeout (merged): cleared agent:* labels.
Hermes kanban card (if any) is left for Hermes to archive/complete.

agent-gateway closeout (merged): cleared `agent:*` labels. Hermes kanban card (if any) is left for Hermes to archive/complete.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 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!295
No description provided.