Remove internal optimization/verification docs (not part of the card)
Browse filesFiles changed (4)
- OPT_BASELINE.mdDeleted-561
- OPT_REPORT.mdDeleted-691
- VERIFICATION_2026-10-08.mdDeleted-210
- VERIFICATION_OPT_2026-10-11.mdDeleted-157
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561# diffusion-planner-p150 baseline on the p150 (before optimization)
Date 2026-10-08. Code is the baseline commit `5541833` (first correct port, no optimization): the port's last commit`34b6049` plus ttaw re-vendored to 0.17.1 and two measurement scripts, `code/scripts/bench.py` (rewritten: the fullstage table) and `code/scripts/profile_ops.py` (new). `git diff 34b6049 5541833` touches no model code (`tt/`,`host/`, `reference/`, `api.py`, `device.py`, `io.py`, `server/` are unchanged).tt-metal `44d66500520` (v0.80.0-dev20261006-78) + the ETH-dispatch patch (workspace `patches/tt-metal-eth-dispatch.patch`,sha256 `08d0ddf6…45cc`, 4 files; `eth_patch: true` in every log). ttaw 0.17.1 @ common `290f22b`(`code/tt_diffusion_planner/ttaw/VENDORED.json`; `vendor.py --check`: 0 differences). Weights`AutowareFoundation/diffusion_planner` @ `423efde67f5` (tag `v5.0`). Input: `code/tt_diffusion_planner/samples/kashiwanoha_dense.npz`(one planning instant on the kashiwanoha test map: 88 neighbours, 123 lanes, 17 route lanes, 60 line strings, ego at6 m/s), batch 1. The stage bench also runs `straight_road.npz` (shipped) and one public-data instant, nuScenesv1.0-mini `scene-0103_kf14` (42 neighbours, 103 lanes, 7 route lanes, 10 polygons, 26 line strings; CC BY-NC-SA 4.0,used locally, never shipped).
Configuration of every number unless a row says otherwise: ETH dispatch, 1 CQ, 12×10 grid(`device.compute_with_storage_grid_size()` printed in each log), one p150b (KMD 2.10.0, firmware bundle 19.13.1.0).AICLK 1350 MHz: sysfs `tt_aiclk` was sampled every 50 ms during every bench, median 1350 MHz and min 1343 MHz. Boardpower had a median of 76 W and a max of 86 W, at 63-68 °C. The profiler CSV header also gives 1350 MHz. The host isshared (AMD EPYC-Rome, 8 vCPUs, up to 8 other agents, load average 8-12 during these runs), so host-side stages arequoted as p50 / p99 (min).
## After optimization (the current release, 2026-10-11)
Everything below this section is the baseline of the first release and stays as measured. The optimized release(rounds 1-5 of `OPT_REPORT.md`, verified in `VERIFICATION_OPT_2026-10-11.md`, re-measured for the republish on`bc966b4` with ttaw 0.23.2; same configuration: ETH dispatch, 1 CQ, 12×10, AICLK 1350 MHz, the stage bench above):
| | baseline (`5541833`, 2026-10-08) | current (2026-10-11) ||---|---|---|| device latency per plan (one trace replay + sync), shipped sample | 102.13 ms p50 | **20.05 ms** p50 (p99 20.08) || back-to-back replays, shipped sample (88 neighbours) | 102.04 ms = 9.80 plans/s | **20.00 ms = 50.0 plans/s** (5.1×) || back-to-back replays by agent bucket (r32 / r64 / r96 / r128 / r192 / full) | 102.04 ms for every scene | 17.44 / 19.25 / 20.00 / 21.11 / 22.30 / 26.65 ms (the last three from `OPT_REPORT.md` round 5) || `model(inputs=arrays)` end to end, shipped sample | 117.90 ms p50 (p99 134.56) | **26.73 ms** p50 (p99 27.48) || `model(inputs=<.npz path>)` | 124.76 ms | 32.27 ms || host pre · pack · host tensors · H2D · D2H · host post | 4.75 · 0.45 · 2.41 · 1.14 · 0.58 · 4.32 ms | 2.45 · 0.52 · 1.57 · 0.76 · 0.22 · 1.39 ms || programs per plan (traced replay profile) | 6,282 | 1,418 at r96 (kernel 19.64 ms, op-to-op gaps 0.89 ms, span 20.54 ms) || traces / trace buffers | 1 / 74.6 MB | 6 (full capacity + 5 agent buckets) / 60.3 MB || `from_pretrained` load, empty / warm JIT cache | 315 s / 8.6 s | 352 s / 12.9 s || served `/predict` `timing_ms.total` (uvicorn on the host) | 123.1 ms median | 37.2 ms median || accuracy: 44 device tests; 99 scenes worst ego max / mean (gates 1.0 / 0.3 m), turn, neighbours (gate 1.5 m) | 44 / 44; 0.313 / 0.143 m, 99 / 99, ≤ 0.086 m | 44 / 44; 0.346 / 0.154 m, 99 / 99, ≤ 0.094 m (two gated precision changes: `OPT_REPORT.md` r2.3, r3.2) |
Where the 82 ms went (same-session back-to-back A/B deltas of `OPT_REPORT.md`, largest steps): the encoder's batched channel matmuls on 4-8 cores (round 1,−23.4 ms), the precision cost recovered with custom `generic_op` kernels (fused fp32 LayerNorm −15.5 ms, K-concatenatedsplit matmul −7.0 ms, fused fp32 attention −5.4 ms, softmax and glue fusions; rounds 2-3), L1 residency (round 4,−3.5 ms) and exact agent-bucket compaction (round 5, −6.6 ms on this scene). Logs: `logs/diffusion-planner/republish/`(`bench_recheck.json`, `device_suite.log`, `load_*.json`, `served_bench.json`).
## Summary
| | baseline ||---|---|| device latency per plan (one trace replay + sync) | **102.13 ms** p50, 104.81 p99, 102.05 min || back-to-back replays (device time per plan) | **102.04 ms** = 9.80 plans/s; the same on all three scenes (dense capacities) || `model(inputs=arrays)` end to end | **117.90 ms** p50, 134.56 p99, 112.87 min (`.npz` path: 124.76 ms) || programs per plan (device profiler, traced replay) | **6,282** (309 unique programs; the fake-ttnn count was 6,408) || device kernel sum / op-to-op gaps / span (profiled replay) | 99.27 / 4.39 / 103.66 ms. Kernel-bound, not gap-bound: the median program runs 5.76 µs, and 4,126 programs under 10 µs add up to 19.2 ms || largest single sink | the encoder's channel-MLP and pre-projection matmuls on 4-D `[1, E, T, C]` activations, which run on **4-8 cores**: 90 programs, **25.8 ms** (the 10 slowest programs of the plan are all neighbour-mixer channel matmuls, ~970 µs each) || cost of the numerics defaults (PORT_LOG decision 11), re-measured | **+33.4 ms** over the round-1 defaults (68.64 ms b2b) and **+58.3 ms** over the fastest graph (43.74 ms, which fails the gates). Per knob: decoder split matmuls 20.2, fp32 LayerNorm 18.1, fp32 matmul attention 15.5, encoder split matmuls 6.0 ms || dispatch / CQ (D14) | ETH-1CQ stays. WORKER is equal (−0.17 ms on 11×10). 2 CQs cost +9.8 ms on ETH (±0 on WORKER) || accuracy | 44 device tests, every gate value and all 99 per-scene e2e numbers identical to the port's final run |
## How to run
```bashROOT=/home/ubuntu/experiments/tt-models; cd $ROOT/bundles/diffusion-planner-p150; source $ROOT/bin/tt-env.shexport PYTHONPATH=$PWD/code:$PYTHONPATH HF_HUB_OFFLINE=1 # weights: $DIFFUSION_PLANNER_WEIGHTS_DIR > workspace assets > HF cache# accuracy gates (per-module PCC + end-to-end agreement vs the fp32 CPU reference; 99 scenes with the workspace goldens)$ROOT/bin/devrun -t 1800 -- env TTAW_GATES_READONLY=1 python -m pytest -q -s \ code/tt_diffusion_planner/tests/test_pcc_device.py code/tt_diffusion_planner/tests/test_e2e_device.py# stage breakdown (load / host_pre / pack / host_in / H2D / trace / D2H / host_post / e2e / b2b: p50, p99, min; AICLK)$ROOT/bin/devrun -t 900 -- python code/scripts/bench.py --iters 100 --json /tmp/bench.json \ --input code/tt_diffusion_planner/samples/kashiwanoha_dense.npz --input code/tt_diffusion_planner/samples/straight_road.npz \ --input $ROOT/research/diffusion-planner/public_data/inputs/nuscenes/scene-0103_kf14.npz# dispatch / CQ matrix: the same per configuration, one process each: --dispatch eth|worker --num-cqs 1|2# numerics cost: the same with DIFFUSION_PLANNER_SPLIT_MATMUL / _LN_FP32 / _ATTN_MATMUL set (timing only, see below)# device profile: one eager plan (stage + layer-kind signposts) and one traced replay, between signposts$ROOT/bin/devrun -t 3600 -- python -m tracy -r -p -v --op-support-count 16000 --no-web-server \ -o $ROOT/generated/profiler/diffusion-planner_baseline code/scripts/profile_ops.pytt-perf-report <ops_perf_results_*.csv> --start-signpost trace --end-signpost trace_end --arch p150python $ROOT/logs/diffusion-planner/baseline/scripts/analyze_profile.py <the same csv> out.json --md out.md```
The job scripts of this baseline are in `logs/diffusion-planner/baseline/scripts/` (workspace):
- `windowA.sh` (one devrun window, 04:35-04:58 UTC): job 1, the device suite and the alloc-tracking run; then job 2, the bench and the dispatch / CQ matrix.- `windowB.sh` (05:54-06:15 UTC): job 3, the numerics ablation; job 4, the Tracy profile; job 5, the ttnn-visualizer captures.- `host_suite.sh`, `analyze_profile.py`, `profile_breakdown.py`, `tables.py`, `fake_flops.py`, `visualizer_*.py`.
The plan issues 6,282 programs, more than the profiler's default 1,000-program buffer. So the profile runs with`--op-support-count 16000`: 48 B per program per RISC, about 77 MB of DRAM per channel. `ttnn.ReadDeviceProfiler` iscalled before and after each section, and nothing was dropped (no full-buffer warning).
## Accuracy (baseline)
Re-run on this commit after re-vendoring ttaw 0.11.0 -> 0.17.1, with the gates read-only:
- device suite: **44 passed** in 48.6 s, and 44 passed again under `TT_METAL_TRACE_ALLOC_TRACKING=1`;- every gate value and every per-scene number of the 99 scenes is identical to the port's final run (job 19, ttaw 0.11.0);- host suite on the fake ttnn: 105 passed, 46 skipped (the 44 device tests, the ORT module, one dead test).
Logs: `logs/diffusion-planner/baseline/device_suite.log`, `alloc_tracking.log`, `e2e_device.json`, `host_suite.log`.
| check | gate | baseline ||---|---|---|| `enc.ego` / `enc.neighbor` / `enc.lane` / `enc.route` / `enc.polygon` / `enc.line_string` PCC vs the fp32 reference (valid rows, 2 samples) | ≥ 0.999 | 0.999972 / 0.999952 / 0.999992 / 0.999998 / 0.999994 / 0.999998 || `enc.goal` / `enc.ego_shape` / `enc.turn` PCC | ≥ 0.999 | 0.999991 / 1.000000 / 0.999995 || `enc.encoding` PCC (valid tokens) | ≥ 0.999 | 0.999978 || `dec.eval` PCC (teacher-forced decoder, min over the 11 evaluations x 2 samples) | ≥ 0.999 | ≥ 0.9999995 (prints 1) || end-to-end ego trajectory vs the reference, max over 99 scenes (2 samples, 5 research scenes, 92 nuScenes-mini instants): max / mean displacement | ≤ 1.0 m / ≤ 0.3 m | 0.313 m / 0.143 m (both on nuScenes scene-0103_kf14) || turn-indicator command identical | = 1.0 | 99 / 99 || neighbours: median per-agent max displacement, max over scenes | ≤ 1.5 m | 0.086 m || CPU reference vs ONNX Runtime on the shipped ONNX (checks the reference itself; research venv, PORT_LOG 5.1) | ≥ 0.9999 | final x0 PCC �� 0.9999999999982 (7 scenes), ≥ 0.99999999983 (92 nuScenes instants); 48 tests passed |
## Performance (warm, batch 1, 100 iterations per stage)
`code/scripts/bench.py --iters 100` (job 2, `matrix_eth-1cq.{log,json}`):
- `trace` is one replay of the whole plan plus a device sync, as served;- `b2b` is the device time per plan over 50 back-to-back replays (3 rounds);- `e2e` is `model(inputs=<decoded arrays>)`, and `e2e_path` is `model(inputs=<.npz path>)`.
Values are ms, p50 / p99 (min).
| stage | kashiwanoha_dense (shipped default) | straight_road (shipped) | nuScenes scene-0103_kf14 (public data) ||---|---:|---:|---:|| `load`: `.npz` decode + schema check (path inputs only) | 7.02 / 18.20 (5.79) | 6.75 / 16.81 (5.86) | || `host_pre`: the node's pre-processing | 4.76 / 12.55 (3.84) | 4.32 / 12.58 (3.57) | 4.25 / 6.16 (3.74) || `pack`: the 19 persistent trace inputs | 0.45 / 4.52 (0.36) | 0.44 / 1.06 (0.38) | 0.43 / 0.69 (0.34) || `host_in`: TILE host tensors | 2.41 / 6.80 (2.02) | 2.41 / 6.79 (2.00) | 2.31 / 3.35 (1.92) || H2D (19 tensors, 3.6 MB) + sync | 1.14 / 6.32 (0.90) | 1.09 / 5.43 (0.91) | 1.03 / 2.72 (0.90) || **device trace, one blocking plan** | **102.13 / 104.81 (102.05)** | 102.14 / 104.32 (102.07) | 102.13 / 102.19 (102.05) || **back-to-back trace replays, per plan** | **102.04** (rounds 102.09, 102.04, 102.04) = 9.80 plans/s | 102.04 | 102.04 || D2H (one packed read, 460 KB) | 0.58 / 4.24 (0.31) | 0.59 / 1.50 (0.36) | 0.56 / 0.75 (0.30) || `host_post`: the node's post-processing | 4.32 / 11.54 (3.57) | 3.91 / 9.47 (3.29) | 3.93 / 6.96 (3.50) || **e2e `model(inputs=arrays)`** | **117.90 / 134.56 (112.87)** | 126.58 / 144.70 (114.23) | 114.52 / 122.91 (113.05) || e2e `model(inputs=path)` | 124.76 / 147.74 (118.99) | 121.92 / 143.29 (118.41) | |
- **Timing breakdown.** `model(...).timing_ms` p50 (kashiwanoha): - preprocess 4.77 ms; - device 106.83 ms (`host_in` + H2D + replay + D2H + unpack); - postprocess 4.36 ms; - total 117.35 ms.- **Start-up.** The first call after `from_pretrained` takes 118.2 ms (1.0x). `from_pretrained` takes 11.6 s with a warm kernel cache: ~5.1 s to open the device, 0.75 s to build (read the ONNX weights and upload them), 5.8 s to warm up and capture.- **The device time does not depend on the scene.** All three scenes take 102.13-102.14 ms. Every plan computes the full capacities whatever the scene holds (no compaction): - 320 neighbours, 140 lanes, 25 route lanes, 10 polygons and 60 line strings in the encoder; - 352 decoder rows (321 agents); - 576 tokens (564 real).- **Host overhead.** Around the trace the host adds ~15.8 ms per in-process request: pre 4.8 + pack 0.5 + host_in 2.4 + H2D 1.1 + D2H 0.6 + post 4.3 ms, plus the schema check. Handing over an `.npz` path adds 7 ms.- **Noise.** The p99 / mean spread of every host stage (and of `e2e`) comes from the shared host. Straight_road's e2e p50 is higher than kashiwanoha's only because other agents loaded the CPU during that loop. The device numbers (`trace` min, `b2b`) are stable to ±0.05 ms.- **Memory.** 309 unique programs; the trace buffers hold 74.6 MB of DRAM; 48.1 MB of weights and constants are uploaded.
## Dispatch / CQ matrix (D14)
One process per configuration, all in one lock window (job 2, `matrix_<tag>.{log,json}`); default sample, 100iterations.
| config | grid | trace p50 / p99 (min) | b2b per plan | e2e p50 / p99 (min) | H2D p50 | D2H p50 | load (JIT cache) | first call ||---|---|---:|---:|---:|---:|---:|---:|---:|| **ETH-1CQ (default)** | 12x10 | **102.13** / 104.81 (102.05) | **102.04** | **117.90** / 134.56 (112.87) | 1.14 | 0.58 | 11.6 s (warm) | 118.2 || ETH-2CQ | 12x10 | 112.02 / 112.96 (111.94) | 111.87 | 125.64 / 141.03 (123.65) | 1.02 | 0.50 | 11.0 s (warm) | 125.0 || WORKER-2CQ | 11x10 | 102.03 / 106.28 (101.90) | 101.88 | 126.63 / 142.67 (114.26) | 0.94 | 0.52 | 417.6 s (cold) | 114.7 || WORKER-1CQ | 11x10 | 101.97 / 104.53 (101.89) | 101.87 | 116.10 / 135.84 (112.62) | 0.98 | 0.58 | 446.1 s (cold) | 113.6 || ETH-1CQ, repeated last | 12x10 | 102.14 / 102.37 (102.07) | 102.04 | 117.35 / 124.73 (114.13) | 1.14 | 0.63 | 9.4 s (warm) | 117.8 |
- **WORKER vs ETH: equal, so ETH stays the default.** WORKER dispatch is 0.17 ms (0.17 %) faster per plan, on 110 cores instead of 120. Two effects cancel: - The 12th column hardly matters to this graph (Grid usage below). The 3,775 programs that do use all 120 cores are short element-wise programs, bound by a fixed cost per program, not by the core count. The 25.8 ms of 4-8-core matmuls do not use the grid at all. - WORKER saves ~0.5 µs of dispatch per program (probe P1).
That is not "clearly better", so ETH stays the default (D14, `serve.env`). Re-measure once the op count drops, when the 12th column should start to pay (DISPATCH.md).- **CQ count: 1.** - On ETH, a second CQ makes the replay itself +9.8 ms (+9.6 %) per plan, about +1.6 µs per program. - On WORKER it costs nothing (101.88 vs 101.87 ms). So the penalty belongs to the patched ETH 2-CQ dispatch topology. It was not profiled here; `--profile-dispatch-cores` would show it. - What 2 CQs could hide is the upload of the next plan while the trace runs: ~1.1 ms of H2D per 117 ms request, and only when requests are pipelined.
Decision: **1 CQ** (the D14 default); `DIFFUSION_PLANNER_NUM_CQS=1` stays pinned.- A WORKER open recompiles every kernel: 7 min here, for both CQ counts. The served configuration never pays this.- No drift over the 21-minute window: ETH-1CQ measured 102.13 ms first and 102.14 ms last (trace p50), and 102.04 / 102.04 ms (b2b).
## What the numerics defaults cost (precision ablation)
Job 3 (`precision_<tag>.{log,json}`) ran one process per configuration on ETH-1CQ with the default sample: 30iterations, and b2b over 3 x 30 replays. The configurations differ only by the `DIFFUSION_PLANNER_*` knobs. **Thisis timing only: no gate was run here, and only `shipped` is gate-clean.** The PORT_LOG evidence for three of theothers:
- the round-1 defaults fail `ego.mean_err_m` on nuScenes scene-0103_kf14 (0.347 m > 0.3, job 11);- bf16 SDPA instead of the fp32 matmul attention (PORT_LOG's "decoder split alone", the same knobs) gives 0.74 / 0.33 m (max / mean) on scene-0103_kf14, over the 0.3 m mean gate (job 13, `logs/diffusion-planner/split_error_decsplit.json`);- the fastest graph (fused LN, no split, SDPA) fails `enc.ego` (0.99856 / 0.99261, job 4).
The decoder-split, encoder-split and fused-LN removals were never gated.
| config | `SPLIT_MATMUL` | `LN_FP32` | `ATTN_MATMUL` | trace p50 | b2b | vs shipped | unique programs | trace buffers ||---|---|---|---|---:|---:|---:|---:|---:|| **shipped** (decision 11) | `enc.island.*,enc.pre.*,dec.*` | `enc.mixer.*,dec.*` | `enc.fusion.attn,dec.*` | 102.11 | 102.04 | | 309 | 74.6 MB || bf16 SDPA instead of fp32 matmul attention | same | same | none | 86.64 | 86.57 | −15.47 | 305 | 69.9 MB || no split matmuls in the decoder | `enc.island.*,enc.pre.*` | same | same | 81.93 | 81.85 | −20.19 | 283 | 50.4 MB || no split matmuls in the encoder | `dec.*` | same | same | 96.08 | 96.02 | −6.02 | 209 | 72.9 MB || fused `ttnn.layer_norm` everywhere | same | none | same | 84.03 | 83.94 | −18.10 | 304 | 43.9 MB || round-1 defaults (PORT_LOG job 11: 68.7 ms) | `enc.island.*,enc.pre.*,dec.preproj.*` | `enc.mixer.*,dec.*` | none | 68.72 | 68.64 | **−33.40** | 287 | 50.4 MB || fastest graph (PORT_LOG job 4: 43.7 ms) | none | none | none | 43.79 | 43.74 | −58.30 | 173 | 16.2 MB |
- **Precision cost of the shipped defaults.** It is **33.4 ms** over round 1, which reproduces PORT_LOG's 102.1 vs 68.7 ms. Over the fastest graph it is 58.3 ms.- **The knobs add up almost exactly.** The four single-knob removals sum to 59.8 ms, against 58.3 ms with all of them off.- **On the card this cost is the first optimization target:** it is the price of the accuracy the nuScenes e2e gate needs. Items 2-4 below recover it with fused kernels that keep the fp32-level accuracy. They do not relax precision: precision policy §9.3, and every numerics change re-checked on all 99 scenes. Item 1 is a separate sink of similar size that this profile found, unrelated to precision.
## Host vs device, and every host<->device transfer per plan
Host, per plan: numpy, the node's own pre- and post-processing (the PLAN.md 2.12 host rows). There is no hostfallback inside the plan.
- `load`: decodes the `.npz` and checks the 15 raw tensors against `INPUT_SCHEMA` (names, shapes, finite values). Only `model(inputs=<path>)` does this; the server decodes its JSON / base64 body instead.- `host_pre` (`host.prepare`): - normalization (all-zero rows kept) and the speed masks; - the encoder's pre-matmul input plumbing: history truncation, velocity zeroing, validity masks, position features with the ONNX `atan2` decomposition and the pseudo-heading quirk, point deltas; - the decoder masks and `x_T`.- `pack` (`tt.inputs.plan_inputs`) builds the 19 persistent trace inputs: the input columns of the exact affine rewrites, the 576-token arrays, the key-bias rows, and `cs` / `y0` on 352 rows.- `host_in`: converts them to ttnn host tensors (TILE layout, host tilization).- `host_post` (`host.make_output`): denormalization, trajectory velocity / force-stop / acceleration, the predicted paths of the non-empty neighbour rows, the turn-indicator decision.
Device: everything else, as ONE metal trace (`plan`):
- the encoder: 6 mixer trunks, entity heads, small encoders, token assembly, 6 fusion blocks;- the hoisted cross K / V;- 11 x (DiT evaluation + fp32 DPM-Solver++(2M) update + prefix constraint);- the turn head and the output pack.
**H2D per plan: 19 `copy_host_to_device_tensor` into the persistent inputs** (CQ0; with 2 CQs, CQ1 + events): 1.19 MBlogical, 3.60 MB as TILE-padded fp32 / bf16.
| input | shape | dtype | logical B | TILE-padded B ||---|---|---|---:|---:|| `neighbor_x` | [1, 320, 6, 9] | fp32 | 69,120 | 1,310,720 || `lane_x` | [1, 140, 20, 8] | fp32 | 89,600 | 573,440 || `cs` (current states in the t = 0 columns) | [1, 1, 352, 324] | fp32 | 456,192 | 495,616 || `y0` (`x_T * mask0`; zeros at temperature 0) | [1, 1, 352, 324] | fp32 | 456,192 | 495,616 || `line_string_x` | [1, 60, 20, 6] | fp32 | 28,800 | 245,760 || `route_x` | [1, 25, 20, 8] | fp32 | 16,000 | 102,400 || `polygon_x` | [1, 10, 40, 5] | fp32 | 8,000 | 81,920 || `token_valid` | [1, 1, 576, 1] | fp32 | 2,304 | 73,728 || `pos_aug` | [1, 1, 576, 15] | fp32 | 34,560 | 73,728 || `neighbor_aux` | [1, 1, 320, 4] | fp32 | 5,120 | 40,960 || `fusion_key_row` | [1, 1, 1, 576] | bf16 | 1,152 | 36,864 || `agent_key_row` | [1, 1, 1, 352] | bf16 | 704 | 22,528 || `lane_aux` | [1, 1, 140, 29] | fp32 | 16,240 | 20,480 || `ego_x`, `static_x`, `route_aux`, `goal_x`, `ego_shape_x`, `turn_x` | small | fp32 | 3,344 | 6 x 4,096 |
**D2H per plan: 1 packed read** (`pack_outputs`), 117,664 fp32 = 470,656 B in one row:
- `final_x0` [352, 324];- the turn logits [5];- the ego rows of the 11 published iterates [11, 324].
There is no mid-graph host round trip and no host fallback op.
## Grid usage
`tt/` sets no core grid or program config on any op. The only grid consumer, C20's SDPA config, reads`device.compute_with_storage_grid_size()`, and the default fp32 matmul attention does not use it. So every op picksits own core count:
| core count per program (traced replay) | programs | kernel ms | what ||---|---:|---:|---|| 120 | 3,775 | 39.4 | element-wise / typecast / reduce programs, spread over all cores whatever their size || 64-119 | 1,050 | 14.1 | decoder matmuls on 66-72 cores, softmax on 88, token-mixing matmuls on 100-117 || 16-63 | 708 | 11.9 | decoder matmuls on 48 cores (561 programs, 9.7 ms) || **2-15** | **712** | **33.6** | **matmuls on 4 / 8 cores: 148 programs, 26.0 ms, of which the encoder's batched `[1, E, T, C] @ [C, 128]` channel matmuls are 90 programs, 25.8 ms**; the attention P·V matmuls on 11 cores (66 programs, 4.6 ms); decoder LN reductions on 11 cores || 1 | 37 | 0.2 | slices, small reshapes |
Matmul efficiency is low everywhere. tt-perf-report gives a weighted mean of 7.2 % of the FLOP roofline over the1,365 matmuls (max 12.9 %), and 6.8 % of the DRAM roofline (35 GB/s) over the modelled ops.
## What is already fused / traced
- **The whole plan is one trace:** encoder + 11 DiT evaluations + 10 solver updates + turn head + pack, replayed with persistent inputs. Replay == eager bit for bit (`test_plan_replay_equals_eager`, and the profile run). The device suite is green under `TT_METAL_TRACE_ALLOC_TRACKING=1`.- **Exact rewrites already in the graph** (`tt/params.py`, proven on the host): - the cross-attention K / V of the 3 DiT blocks is hoisted out of the solver loop (once per plan, not 11 times); - the per-step adaLN is folded into the LayerNorm affine rows (no adaLN MLP on the device); - the solver update is folded into `y' = A y - B m_k + Cm m_(k-1)`, with the prefix constraint as `x = y + cs` and the t = 0 output columns zeroed in the last projection's weights; - the ego / neighbour pre-projection runs as a pad-relative fp32 island; - the small embeddings (neighbour type, lane speed / attributes, position) are one matmul over host-built columns; - the turn head is `W_sel` / `W_pool / 564`, and the agent embedding is folded into bias rows.- **Fused in stock ops:** - bias + GELU / tanh-GELU in `ttnn.linear` (2-D inputs); - Q | K | V in one linear and one `nlp_create_qkv_heads` (DiT self-attention); - K | V in one linear + `split_q_kv` (fusion); - one packed readback.- **Not fused: the numerics defaults** (PORT_LOG decision 11), counted in programs per call: - each split hi / lo matmul is **8.3 programs** on average instead of 1: typecast, typecast, subtract, 3 matmuls / linears, 2 adds, then GELU / typecast as needed; - each fp32 LayerNorm is **9 programs** instead of 1: mean, subtract, multiply, mean, add, rsqrt, multiply, then multiply / add for the affine; - each fp32 attention is **5 programs** (matmul, scale, mask add, softmax, matmul), plus the head split / merge.- **Not fused: glue.** Residual adds, adaLN gate multiplies, the mixer token-mixing transposes, the solver update (3-5 element-wise programs per step) and the ego-row slices.- **Not done at all:** - every activation is DRAM-interleaved: no sharding, no L1 residency; - no custom kernel, no `generic_op`, no megakernel; - no compaction: all 321 agent rows and 564 tokens are computed whatever the scene holds.
## Device profile (traced replay)
The profile (job 4, `profile_ops.py`) has two sections:
- one eager plan with stage (`m:`) and layer-kind (`c:`) signposts: 778.6 ms, dispatch-bound at a median of 101 µs per eager op;- one traced replay of the same 6,282 programs. The op codes match the eager run one by one, so every replayed program inherits its stage and kind.
The replay with the profiler on took 105.13 ms on the host, against 102.1 ms without it. The eager run after thecapture logs tt-metal's "allocating device buffers ... active trace" warning once; `run_eager` frees its buffersbefore the replay, and the replay equals the eager plan bit for bit.
| | traced replay ||---|---|| programs per plan | **6,282** || device kernel sum | **99.27 ms** || op-to-op gaps (sum / median / p90 / max) | **4.39 ms** / 0.56 µs / 0.65 µs / 7.97 µs || span (first FW start to last FW end, 1350 MHz) | **103.66 ms** || kernel time per program, p10 / p50 / p90 / p99 / max | 2.7 / 5.76 / 32.2 / 96.6 / 984 µs || programs under 5 µs / under 10 µs | 2,673 / 4,126 (19.2 ms together) || math fidelity | HiFi4 on all 6,106 compute programs |
The plan is **kernel-bound**: gaps are 4 % of the span. The time goes to a few slow, badly parallelised programs andto thousands of small ones, each costing ~5-8 µs whatever its size. The FLOPs are minor: the device graph does 165GFLOP of matmul per plan with every split pass counted (132 GFLOP of it in the decoder; `fake_flops.log`). That is~1 ms at the 120-core HiFi4 peak (~162 TFLOPS, TT_PLATFORM.md).
**By stage** (kernel + gaps, ms):
| stage | programs | ms | share ||---|---:|---:|---:|| encoder: 6 mixer trunks (pre-projection 8.8, 6 x 6 MixerBlocks 39.2, pool + heads 0.3) | 1,274 | 48.35 | 46.6 % || encoder: fusion (6 blocks + final LN), small encoders, tokens, masks | 149 | 3.23 | 3.1 % || decoder: 11 evaluations, 4.67 ms each incl. its solver update (433-443 programs each; e00-e09 4.38-4.40 ms kernel, e10 4.45) | 4,791 | 51.42 | 49.6 % || cross K / V hoist, turn head, output pack | 68 | 0.66 | 0.6 % |
**By layer kind and part** (kernel + gaps, ms; `kind_by_group.md`):
| part | split matmul | plain linear | fp32 LN | fp32 attention | glue | heads / mask / fused LN | total ||---|---:|---:|---:|---:|---:|---:|---:|| encoder mixer trunks | 8.31 (24 calls, 346 µs each) | **23.27** (159 calls) | 12.96 (72 calls, 180 µs each) | | 3.77 | 0.04 | 48.35 || encoder fusion + small | | 0.72 | | 1.96 (6 calls) | 0.21 | 0.33 | 3.23 || decoder x11 + solver | **26.09** (308 calls, 85 µs each) | | 8.59 (165 calls, 52 µs each) | **14.47** (66 calls, 219 µs each) | 1.34 | 0.93 | 51.42 || cross K / V, turn, pack | 0.38 | 0.01 | | | 0.24 | 0.02 | 0.66 || **all** | **34.78** | **24.00** | **21.56** | **16.43** | **5.56** | 1.33 | **103.66** |
**One DiT evaluation** (e5, 4.67 ms):
| | ms | share ||---|---:|---:|| split matmuls (pre-projection, self Q / K / V + out, cross Q + out, 2 MLPs, final) | 2.37 | 50.8 % || self- and cross-attention as fp32 matmuls (3 x 0.20 + 3 x 0.24) | 1.32 | 28.2 % || fp32 LayerNorms (12 x 48.5 µs + the final layer's 3 LNs 197 µs) | 0.78 | 16.7 % || glue, head split / merge, solver update | 0.20 | 4.3 % |
**By op code:**
| op | programs | kernel ms | share ||---|---:|---:|---:|| Matmul | 1,365 | 52.34 | 52.7 % || BinaryNg (element-wise binary) | 2,948 | 31.48 | 31.7 % || Reduce (LN means) | 480 | 3.69 | 3.7 % || Softmax | 72 | 3.47 | 3.5 % || Unary (GELU, rsqrt) | 428 | 2.81 | 2.8 % || Typecast | 676 | 2.41 | 2.4 % || Transpose (mixer token mixing) | 84 | 1.34 | 1.4 % || NlpCreateHeads / NLPConcatHeads | 150 | 1.00 | 1.0 % || other (reshape, untilize, LayerNorm, repeat, tilize, concat, slice, pad) | 79 | 0.73 | 0.7 % |
**Top-10 device programs** (traced replay, single programs). All ten are the neighbour mixer's channel-MLP matmuls`[1, 320, 64, 128] @ [128, 128]` (6 MixerBlocks x 2 linears), each on **8 cores**:
| # | op | stage | in0 @ in1 | dtypes in0 / in1 / out | cores | kernel µs ||---:|---|---|---|---|---:|---:|| 1 | Matmul (`ch2`) | `enc.neighbor.mix` | [1,320,64,128] @ [1,1,128,128] | bf16 / bf16 / fp32 | 8 | 984.1 || 2 | Matmul (`ch2`) | `enc.neighbor.mix` | same | bf16 / bf16 / fp32 | 8 | 977.6 || 3 | Matmul (`ch2`) | `enc.neighbor.mix` | same | bf16 / bf16 / fp32 | 8 | 972.8 || 4 | Matmul (`ch2`) | `enc.neighbor.mix` | same | bf16 / bf16 / fp32 | 8 | 971.8 || 5 | Matmul (`ch2`) | `enc.neighbor.mix` | same | bf16 / bf16 / fp32 | 8 | 971.2 || 6 | Matmul (`ch2`) | `enc.neighbor.mix` | same | bf16 / bf16 / fp32 | 8 | 970.1 || 7 | Matmul (`ch1`, + GELU) | `enc.neighbor.mix` | [1,320,64,128] @ [1,1,128,128] | fp32 / bf16 / bf16 | 8 | 966.4 || 8 | Matmul (`ch1`) | `enc.neighbor.mix` | same | fp32 / bf16 / bf16 | 8 | 965.2 || 9 | Matmul (`ch1`) | `enc.neighbor.mix` | same | fp32 / bf16 / bf16 | 8 | 965.2 || 10 | Matmul (`ch1`) | `enc.neighbor.mix` | same | fp32 / bf16 / bf16 | 8 | 965.0 |
**Top op signatures by total time** (`profile_breakdown.md`). Only matmul shapes are shown: element-wise programs areshared across shapes, and the profiler's op-info cache reports the first call's shapes for them.
| op | where | kind | in0 @ in1 | cores | programs | ms | mean µs ||---|---|---|---|---:|---:|---:|---:|| Matmul | `enc.neighbor.mix` channel MLP | linear | [1,320,64,128] @ [128,128] | 8 | 12 | 11.64 | 970 || BinaryNg | mixer blocks | fp32 LN | | 120 | 360 | 9.92 | 27.6 || Matmul | decoder MLP fc2 (mlp1 + mlp2, 3 split passes each) | split | [1,1,352,1024] @ [1024,256] | 48 | 198 | 5.71 | 28.8 || Matmul | `enc.lane.mix` channel MLP | linear | [1,140,64,128] @ [128,128] | 8 | 12 | 5.09 | 425 || BinaryNg | decoder attention scale / mask add | fp32 attention | | 120 | 132 | 4.72 | 35.8 || Matmul | decoder MLP fc1 (mlp1 + mlp2, 3 split passes each) | split | [1,1,352,256] @ [256,1024] | 66 | 198 | 3.39 | 17.1 || Matmul | `enc.neighbor.pre` (pad-relative island) | split | [1,320,6,128] @ [128,128], [1,320,6,9] @ [9,128] | 4 | 6 | 3.15 | 525 || Matmul | decoder self-attention P·V | fp32 attention | [1,8,352,352] @ [1,8,352,32] | 11 | 33 | 2.33 | 70.7 || Matmul | decoder cross-attention P·V | fp32 attention | [1,8,352,576] @ [1,8,576,32] | 11 | 33 | 2.26 | 68.4 || Matmul | `enc.line_string.mix` channel MLP | linear | [1,60,64,128] @ [128,128] | 8 | 12 | 2.19 | 183 || Softmax | decoder cross-attention | fp32 attention | | 88 | 33 | 1.83 | 55.4 || BinaryNg | mixer residual adds | glue | | 120 | 72 | 1.75 | 24.3 || Reduce | mixer LN means | fp32 LN | | 120 | 72 | 1.39 | 19.3 |
Compare the 2-D token-mixing matmul of the same trunk: `[1,1,40960,64] @ [64,64]` runs on 117 cores in 69 µs. The4-D channel MLP with twice the FLOPs takes 970 µs on 8 cores: 14x the time, about 7x slower per FLOP.
Artifacts:
- **Profile:** `generated/profiler/diffusion-planner_baseline/reports/2026_10_08_06_13_03/`, holding `ops_perf_results_*.csv`, the Tracy file and `profile_log_device.csv.zst` (7.3 GB raw; `zstd -d` it before loading the folder in ttnn-visualizer), plus `.logs/cpp_device_perf_report.csv`.- **ttnn-visualizer memory / graph reports** (not for timing): `generated/ttnn_visualizer/diffusion-planner_baseline/{decode_once,encoder_taps}/`: - one decoder evaluation: 508 ops, 20.9 MB `db.sqlite`; - the encoder: 1,483 ops, 63.5 MB. - No whole-plan capture was made. At the measured ~1.3k buffer rows per op it would be ~8M rows (a ~2.5 GB capture JSON) for 11 repeats of the same evaluation. The two captures cover every distinct layer of the plan except the solver update, the turn head and the output pack. - Open them with `ttnn-visualizer --profiler-path <that dir> --performance-path <the profile folder>`. - Capture: `logs/diffusion-planner/baseline/scripts/visualizer_capture.py` (job 5). Import: `visualizer_import.py`, on the CPU.
## Ranked optimization opportunities
Gains are estimated on the 102.0 ms replay and come from the profile above. They are **not additive**: each oneshrinks the base of the next. Every item must keep the frozen gates, re-checked on all 99 e2e scenes (PORT_LOG 8:the plan's sensitivity to device numerics is chaotic per scene). The precision cost of decision 11 (33.4 ms over round1) is recovered by items 2-4, not by relaxing precision.
1. **Run the encoder's channel MLPs on 2-D activations (≈ −20 to −22 ms; exact rewrite, low effort).** - *What is slow.* The mixer `channels_mlp` (`ch1` / `ch2`) and the channel pre-projections run `ttnn.linear` on 4-D `[1, E, T, C]` activations. That is a batched matmul on **4-8 cores**: 90 programs, 25.8 ms. - *MixerBlocks.* `[1, E, 64, 128]` -> `[1, 1, E·64, 128]` is a free view (64 rows = 2 whole tiles per entity). Then the matmul can spread over the grid, as the token-mixing matmuls already do (69 µs on 117 cores for the neighbours). - *Pre-projections.* T = 6 / 20 / 40 rows do not fill a tile, so the view is not free. Two options: - have `pack` lay the inputs out as `[1, 1, E·T, C]` and re-tile once before the token transpose; - or give the 4-D matmul an explicit multi-core program config, with the HiFi4 compute config passed too (a `program_config` alone falls back to LoFi, PLAN 0.2). - *Estimate.* The channel matmul at 2x the measured token-MLP time of its trunk saves ~17 ms on the MixerBlocks and ~5 ms on the pre-projections. The math is unchanged (the K = 128 reduction per output). The gates must still be re-run, because accumulation order may differ. - *Generalisation.* No `[1, E, ...]`-batched `ttnn.linear` anywhere (the PR:P12 rule extended from token mixing to channel mixing).2. **A fused split (bf16x3) matmul, one program per linear (≈ −17 to −19 ms).** - *Today.* 338 split linears, 2,802 programs, 34.8 ms: decoder 26.1, encoder 8.3, cross K/V 0.4. - *The kernel.* A `generic_op` matmul that reads the fp32 activation once, splits hi / lo on the fly (SFPU), and accumulates `x_hi W_hi + x_hi W_lo + x_lo W_hi` in fp32 DEST. - *What it removes.* All typecast / subtract / add programs and their gaps, 9.3 ms in the decoder. The three passes also share operand reads: estimated at 1.5x one pass, 8 instead of 16 ms of decoder matmul. - *Accuracy.* The same ~1e-5 relative error as today's 3-matmul form. - *Cheaper first step.* Explicit program configs for the 352-row decoder matmuls, which run on 48-72 cores at ~7 % FLOP utilisation. Pass the compute config with them: a `program_config` without one silently falls back to LoFi (PLAN 0.2).3. **A fused fp32 LayerNorm, one program per LN (≈ −15 to −16 ms).** - *Today.* 237 LNs, 2,133 programs, 21.6 ms: mixers 72 x 180 µs on `[E, 64, 128]`; decoder 165 x 52 µs on `[352, 256]`. - *The kernel.* One program per LN (mean / variance in fp32 by Welford or two passes in L1, rsqrt, affine with the folded adaLN rows), at ~2 element-wise passes: ~45 µs in the mixers and ~12 µs in the decoder. - *Limit.* The fused `ttnn.layer_norm` would save 18.1 ms (ablation), but it is ~2.5e-3 relative (PR:P10). On the offset-dominated mixer rows it reaches rel-L2 0.03, and the teacher-forced neighbour mixer drops to PCC 0.9978 (PORT_LOG job 5).4. **Attention (≈ −5.5 ms with stock ops, ≈ −12 to −13 ms with a fused kernel).** - *Today.* 72 fp32 matmul attentions, 16.4 ms, ~228 µs per call. The bf16 SDPA would cost ~13 µs per call (ablation: −15.5 ms), but fails the e2e mean gate. - *(a) Stock ops.* Fold the 1/√32 scale into `W_q` / `b_q`: fp64 fold, then the hi / lo split; gate it. Use a fused scale-mask-softmax for the mask add. Together this removes the 132 decoder (+ 12 fusion) scale / mask programs: 4.7 + 0.7 ms. - *Parallelism.* The P·V matmuls (`[1, 8, 352, Sk] @ [1, 8, Sk, 32]`) run on 11 cores (66 programs, 4.6 ms); a head-parallel program config would spread them. - *(b) A fused fp32-accurate flash-attention kernel* (`generic_op`): scores stay in L1 / DEST, `Q·Kᵀ` and `P·V` use hi / lo operands, and the mask comes from the key-bias row. At ~3-4x the bf16 SDPA's cost (~50 µs per call) it saves ~12.8 ms and supersedes (a).5. **Glue (≈ −3 to −4 ms).** - *Mixers: 3.8 ms.* Token-mixing transposes (84 programs, 1.3 ms) and residual adds (72 programs, 1.8 ms). The entity-parallel mixer kernel of PLAN 5.3 (no transposes) or residual adds in the matmul epilogue remove them. - *Decoder.* Fold the per-step adaLN gates exactly into per-step copies of the gated weights (`attn.out`, `mlp1.fc2`): this removes 66 gate multiplies, at ~65 MB of extra DRAM for the 11 x 3 copies with hi / lo parts. - *Solver.* The update `A y - B m_k + Cm m_(k-1)` becomes one ternary / `generic_op` program instead of 3-5 (83 programs, 0.45 ms).6. **Megakernels (D19; after 1-4, gains measured against what is left).** - **MK-D, the persistent DiT-evaluation kernel.** - *Today.* One evaluation is 4.67 ms in ~435 programs. Its matmul work is 12.0 GFLOP, split passes included (74 µs at the HiFi4 peak). - *Fits in L1.* Its weights are 8.7 MB (DiT blocks) + 1.8 MB (pre-projection, final layer) as bf16 hi parts, plus the fp32 lo parts; the activations are `[352, 256]` fp32 (360 KB); the hoisted cross K / V is 3.5 MB. - *Parameters.* Compile-time: agent bucket (352), heads 8 x 32, MLP 1024, depth 3, NFE 11. The folded adaLN rows and the solver coefficients move from 11 unrolled trace copies into an L1 table (RT-dev constants per steps value). - *Target.* 0.5-1 ms per evaluation would cut the decoder from 51 to ~6-11 ms. - **MK-E (one mixer trunk) and MK-F (one fusion block)** for the encoder. - **The single persistent megakernel for the whole plan** (PLAN 5.3) is plausible. The 48 MB of uploaded weights / constants and the largest activation (neighbour mixer `[320, 64, 128]` fp32, 10.5 MB) fit the ~175 MB of aggregate L1. The compute floor is ~1 ms. - It ships only if it is faster with the gates intact; the attempt is recorded either way (D19).7. **Compaction (LOAD-time buckets; 20-40 % of what remains after 1-4, to be measured).** - The device time is scene-independent: kashiwanoha uses 88 / 320 neighbours, 123 / 140 lanes and 89 / 352 decoder rows. - Valid-entity buckets need one trace per bucket and the exact compaction rewrites of PLAN 5.3: - they shrink the bandwidth-bound encoder work in proportion; - they shrink the attention scores quadratically (`[8, 352, 352]` -> `[8, 96, 96]` at 89 agents); - they help the latency-bound decoder matmuls little.8. **Host side, e2e only (≈ −4 to −6 ms per request).** 15.8 ms of host work and transfers surround the 102 ms replay. - Pack `neighbor_x` as a 2-D `[1, 1, 1920, 9]` input: 1.31 MB of TILE padding becomes 245 KB, which also feeds item 1. - Skip the `y0` upload while `x_T` is unchanged (zeros at temperature 0, the node's default) and send `cs` as its 4 columns. Together: H2D 3.6 -> ~1.6 MB, and less host tilization (`host_in` 2.4 ms). - Vectorise the per-entity loops of `host_pre` (4.8 ms) and `host_post` (4.3 ms: the predicted paths of up to 320 agents). - The 7 ms `.npz` decode is the caller's choice (pass arrays).9. **Dispatch configuration: no gain today; re-measure after 1-5.** - Gaps are only 4.4 ms (0.56 µs median). What pays is removing programs: each removed short program saves its ~5-8 µs kernel plus ~0.6 µs. - Re-run the ETH / WORKER and 1 / 2 CQ matrix once the op count drops below ~2,000. ETH's 12th column matters only once ops become throughput-bound. - The ETH-2CQ penalty (+1.6 µs per program) needs a dispatch-core profile before 2 CQs are reconsidered.
## Raw logs and CSVs
Under `logs/diffusion-planner/baseline/` (workspace) unless absolute:
| what | files ||---|---|| re-vendoring + suites | `host_suite.log` (105 passed / 46 skipped; again on the final tree with the new scripts: `host_suite_final.log`), `device_suite.log` (44 passed), `alloc_tracking.log` (44 passed), `e2e_device.json` (99 scenes), `windowA.log` || stage bench + dispatch / CQ matrix | `matrix_{eth-1cq,eth-2cq,worker-2cq,worker-1cq,eth-1cq-repeat}.{log,json}`, `matrix.rcs`, `tables.md` || numerics ablation | `precision_{shipped,no_attnmm,no_decsplit,no_encsplit,no_ln32,round1,fastest}.{log,json}`, `precision.rcs`, `windowB.log` || device profile | `profile_tracy.log`, `profile_run.json`; ops CSV `/home/ubuntu/experiments/tt-models/generated/profiler/diffusion-planner_baseline/reports/2026_10_08_06_13_03/ops_perf_results_2026_10_08_06_13_03.csv`; summaries `profile_summary.{json,md}` (`analyze_profile.py`), `profile_breakdown.md`, `kind_by_group.md`; tt-perf-report `tt_perf_report_trace.{txt,csv}`, `tt_perf_report_trace_summary.{csv,png}` || ttnn-visualizer | `visualizer_capture.log`, `visualizer_import.log`; reports in `/home/ubuntu/experiments/tt-models/generated/ttnn_visualizer/diffusion-planner_baseline/` || op counts / FLOPs on the fake ttnn (CPU) | `fake_signposts.log` (6,408 fake ops by stage / kind), `fake_flops.log` (165 GFLOP per plan); the port's per-configuration counts: `logs/diffusion-planner/opcount_fake_r2.log` || scripts | `scripts/` (`windowA.sh`, `windowB.sh`, `job{1..5}_*.sh`, `chain.sh`, `analyze_profile.py`, `profile_breakdown.py`, `tables.py`, `fake_*.py`, `visualizer_*.py`) |123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691# diffusion-planner-p150 optimization report (p150, ETH dispatch, 12×10 grid)
**Status: optimization rounds 1-5 done and independently verified (`VERIFICATION_OPT_2026-10-11.md`, PASS); theoptimized release is packaged for re-publishing (2026-10-11, section "Republish (2026-10-11)" below). Round 6(map-entity compaction, the cross attention, the MK-E / MK-D megakernels) is in progress on a branch and is NOT inthis release.**Device time per plan, back to back, on the bench scene (`kashiwanoha_dense`, 88 neighbours: the r96 bucket):**102.03 (published baseline) -> 70.12 (round 1) -> 40.89 (round 2) -> 30.16 (round 3) -> 26.62 (round 4) -> 20.00 ms(round 5)**, 50.0 plans/s; one blocking plan 20.06 ms; e2e `model()` p50 **26.84 ms** (113.1 at the baseline, 81.2after round 1, 52.0 after round 2, 40.8 after round 3, 37.4 after round 4). Since round 5 the device time depends onthe scene (the agent bucket): 17.44 ms (r32, ≤ 31 neighbours: 53 of the 99 gate scenes; 44 in r64, 2 in r96) to 26.65 ms (full capacity,> 191 neighbours); over the 99 gate scenes the served device time (`timing_ms.device`) is p50 20.83 ms (29.61 afterround 4). Accuracy: 44 / 44 device tests with the gates read-only in every step; every round-5 step is bit-identical(the 99 per-scene numbers are those of round 3).
Round 5 added four kept commits, all bit-identical on the rows that are read back, each with its own knob and asame-session alternating A/B (3 pairs, 3 scenes):
- the decoder on the first R rows of an agent bucket (`COMPACT=1`, buckets 32 / 64 / 96 / 128 / 192, one trace each, picked per request): 26.62 -> 23.25 ms on the bench scene (r96), 21.85 ms at r32;- the encoder's neighbour trunk and head on the same R neighbours, the other neighbour tokens zero (`COMPACT=2`): 23.25 -> 19.99 ms (r96), 17.42 ms at r32;- the host pre- and post-processing vectorised, bit-exact (`HOST_FAST`): e2e 30.15 -> 27.31 ms (host pre 3.77 -> 2.49 ms, post 3.02 -> 1.44 ms);- `cs` uploaded as one tile column and the all-zero inputs not re-uploaded (`INPUT_TRIM`): e2e 27.22 -> 26.84 ms, device +0.014 ms (one concat program).
Round 4 added four kept commits, **all bit-identical** to their predecessor (same raw readback, same 99 per-scenenumbers), each with its own `DIFFUSION_PLANNER_*` knob and a same-session alternating A/B:
- the K = 1024 split operands (mlp fc2, final p4) written L1 block-sharded by the operand build and read in place by a sharded-in0 2-D multicast matmul (`KCAT_L1`): −1.63 ms;- the fused attention's inputs L1-resident: decoder qkv / cross q outputs, the hoisted cross K / V heads, the masks (`ATTN_L1`): −0.41 ms, then −0.39 ms more by keeping the fusion q / kv linears in DRAM (`ATTN_L1=2`: the stock linear with an L1 output ran on 6 cores, found in the round-4 profile);- the decoder blocks' intermediates in L1 (split-LN outputs and stream, attention outputs, linear outputs: `DEC_L1=1`): −1.01 ms; plus the pre-projection and final layer (`DEC_L1=2`): −0.09 ms.
Measured and not kept: the operand build's GELU once per tile (`KCAT_ACT_ONCE`, bit-identical, +0.06 ms), the mixerintermediates in L1 (`ENC_L1`, +1.67 ms and not bit-identical) and the fusion intermediates in L1 (`FUS_L1`, +0.39ms and not bit-identical): stock ops pick other programs for L1 outputs.
Round 3 added five kept commits (each with its own `DIFFUSION_PLANNER_*` knob, default on, and a same-sessionalternating A/B); four are **bit-identical** to their predecessor (same raw readback, same 99 per-scene numbers):
- the attention score scale + mask + softmax as one `generic_op` (`ATTN_SMSM`): −1.56 ms;- the encoder's split linears (pre-projections, ego / neighbour island) in the K-concatenated form (`ENC_KCAT`): −1.70 ms, **the round's one precision change**: 99-scene worst ego max 0.327 -> 0.346 m, mean 0.149 -> 0.154 m, neighbours 0.104 -> 0.094 m (gates 1.0 / 0.3 / 1.5 m; 47 scenes worse, 45 better);- the whole fp32 matmul attention (head split, Q·Kᵀ, scale / mask / softmax, P·V, head merge) as one `generic_op` with the scores in L1 (`ATTN_FUSED`): −5.43 ms;- the split operand of the next K-concatenated linear written by its producer (split LN, fused attention: `KCAT_EMIT`): −0.95 ms;- the two transposes around each mixer token-mixing MLP inside the fused LN programs (`LN_TR`): −1.08 ms.
Measured and not kept: the mixer fc1 GELU in the matmul epilogue (`LIN_ACT`, −0.13 ms but 99-scene ego mean 0.149 ->0.174 m) and the softmax scale by an immediate (`ATTN_SMSM=2`, bit-identical, −0.03 ms).
Round 2 (L2 `generic_op` kernels, six of seven steps bit-identical): fused fp32 LayerNorm (`LN_KERNEL=2`, −15.54ms), residual adds in the LN (`LN_RESID`, −0.21), K-concatenated decoder split matmuls (`SPLIT_KCAT=2`, −6.98, theprecision change of round 2: ego max 0.313 -> 0.327 m), score scale + mask (`ATTN_SMASK`, −2.83), GELU in theoperand build (`KCAT_ACT`, −0.60), split-row decoder LN (`LN_SPLIT`, −0.83), SFPU statistics broadcast(`LN_SFPU_BCAST`, −2.24).
Round 1 (stock-op program configs, all bit-identical): the encoder's batched linears as 2-D matmuls (`ENC_CH2D`,−23.37 ms), P·V on one output tile per core (`ATTN_FAST=1`, −3.35 ms), explicit configs for the decoder's 352-rowmatmuls (`DEC_MMCFG`, −5.18 ms). Two faster attention variants of round 1 stay rejected (not bit-identical, raisethe 99-scene error).
All numbers: `code/scripts/bench.py` (median of 100 warm iterations, batch 1,`code/tt_diffusion_planner/samples/kashiwanoha_dense.npz`), ETH dispatch, 1 CQ, 12×10 grid, the pinned numerics(`DIFFUSION_PLANNER_SPLIT_MATMUL=enc.island.*,enc.pre.*,dec.*`, `_LN_FP32=enc.mixer.*,dec.*`,`_ATTN_MATMUL=enc.fusion.attn,dec.*`), unless marked otherwise. Device profile: `code/scripts/profile_ops.py` under thedevice profiler (one traced replay between signposts). Accuracy gates: `OPT_BASELINE.md` "How to run".
## Summary
| | baseline `5541833` (2026-10-08) | after round 1 (`dd6f249`, 2026-10-10) | after round 2 (`c42c540`, 2026-10-10) | after round 3 (`0b750e3`, 2026-10-10) | after round 4 (`93428bb`, 2026-10-10) | **after round 5 (`e933166`, 2026-10-10; bench scene = bucket r96)** ||---|---|---|---|---|---|---|| device trace, one blocking plan | 102.13 ms (p99 104.81) | **70.18 ms** (same-session baseline 102.09) | **40.96 ms** (p99 41.01) | **30.22 ms** (p99 30.42) | **26.68 ms** (p99 26.71) | **20.06 ms** (r32: 17.50, r64: 19.31; full capacity 26.7) || back-to-back traces | 102.04 ms (9.80 plans/s) | **70.12 ms (14.26 plans/s)** (same-session baseline 102.03) | **40.90 ms (24.45 plans/s)** | **30.16 ms (33.16 plans/s)** | **26.62 ms (37.56 plans/s)** | **20.00 ms (50.0 plans/s)**; buckets r32 / r64 / r96 / r128 / r192 / full: 17.44 / 19.25 / 20.00 / 21.11 / 22.30 / 26.65 ms || e2e `model(inputs=arrays)` p50 / p99 | 117.90 / 134.56 ms | **81.2 ms** p50 (same-session baseline 113.1; host load lower than on 2026-10-08) | **51.98 / 56.39 ms** | **40.84 / 41.52 ms** | **37.36 / 38.03 ms** | **26.84 ms** p50 (straight_road r32: 23.36, scene-0103_kf14 r64: 25.72) || e2e `model(inputs=<.npz path>)` p50 | 124.76 ms | 86.7 ms (same-session baseline 118.7) | 57.9 ms | 46.6 ms | 43.3 ms | 32.5 ms || host pre-processing / pack / host tensors / H2D / D2H / post-processing | 4.76 / 0.45 / 2.41 / 1.14 / 0.58 / 4.32 ms | 3.84 / 0.38 / 1.98 / 0.92 / 0.30 / 3.50 ms (unchanged code; quieter host) | 3.91 / 0.39 / 1.99 / 0.94 / 0.35 / 3.54 ms (unchanged code) | 3.85 / 0.39 / 1.96 / 0.92 / 0.33 / 3.49 ms (unchanged code) | 3.88 / 0.39 / 1.94 / 0.92 / 0.33 / 3.47 ms (unchanged code) | 2.49 / 0.52 / 1.58 / 0.76 / 0.25 / 1.44 ms (`HOST_FAST`, `INPUT_TRIM`) || device programs per plan (unique programs) | 6,282 (309) | same | 2,155 (293 program-cache entries); trace buffer 16.8 MB (44.6 before) | 1,405 (195 program-cache entries); trace buffer 12.3 MB | 1,411 (199 program-cache entries); trace buffer 12.3 MB | 1,418 at r96 (480 program-cache entries for the 6 traces); trace buffers 60.3 MB (6 traces) || kernel sum / op-to-op gaps / span (profile) | 99.27 / 4.39 / 103.66 ms | same | 39.99 / 1.47 / 41.46 ms | 29.71 / 0.88 / 30.59 ms | 26.00 / 0.89 / 26.89 ms | 19.64 / 0.89 / 20.54 ms (r96) || encoder / 11 decoder evaluations (+ solver updates) | 51.6 / 51.4 ms (4.67 ms per evaluation) | same | 15.7 / 23.9 ms (2.17 ms per evaluation; kernel sums of the profile) | 12.6 / 17.1 ms (decoder 1.55 ms per evaluation; kernel sums of the profile) | 12.4 / 13.4 ms (decoder 1.22 ms per evaluation; kernel sums of the profile) | 9.4 / 10.0 ms at r96 (decoder blocks 9.49 ms: 0.86 ms per evaluation; kernel sums of the profile) || accuracy gates (PCC / agreement vs the fp32 CPU reference) | 44 / 44 device tests: module PCC ≥ 0.999952, encoding 0.999978, decoder evaluation ≥ 0.9999995; 99 scenes: ego max 0.313 m / mean 0.143 m (gates 1.0 / 0.3 m), turn command 99 / 99, neighbours ≤ 0.086 m (gate 1.5 m) | identical (bit-identical readback; 44 / 44, all 99 per-scene numbers equal) | 44 / 44; 99 scenes: ego max 0.327 m / mean 0.149 m, turn 99 / 99, neighbours ≤ 0.104 m (the r2.3 precision change; every other step bit-identical) | 44 / 44; 99 scenes: ego max 0.346 m / mean 0.154 m, turn 99 / 99, neighbours ≤ 0.094 m (the r3.2 precision change; every other step bit-identical) | 44 / 44; 99 scenes identical to round 3 (every round-4 step bit-identical) | 44 / 44; 99 scenes identical to round 3 (every round-5 step bit-identical on the read rows) || served `/predict` `timing_ms.total`, median of 50 (uvicorn on the host, the shipped sample) | 123.1 ms, measured on `c0d84f9` (same device code; the release verification) | same | not re-measured (no release in this round) | not re-measured | not re-measured | **37.2 ms** (min 36.7; decode 8.6, `model()` 26.8; republish re-measure on `bc966b4`, 2026-10-11) || `from_pretrained` load: empty JIT cache / warm cache | 315 s / 8.6 s (`c0d84f9`) | same | – / 7.9 s (warm, bench) | – / 7.1 s (warm, bench) | – / 7.8 s (warm, bench) | 352 s / 12.9 s (6 traces; republish re-measure, 2026-10-11; 11.4 s in the bench process) |
The host is shared with other agents' jobs, so the host-side rows move with its load (several ms); the device rowsrepeat to ±0.05 ms. AICLK 1350 MHz (min 1343) during the stage bench. The release re-check on `c0d84f9`(`VERIFICATION_2026-10-08.md`) reproduced the device rows: back-to-back replay 102.03 vs 102.04 ms, one plan 102.10 vs 102.13 ms; the host-bound end to end 115.6 vs 117.9 ms p50 moves with the host load.
## Steps (chronological; each row is one commit)
| step | commit | what | trace / b2b ms | e2e ms | accuracy | revert switch ||---|---|---|---|---|---|---|| baseline | `5541833` | first correct port: the whole plan in one trace, ETH 1CQ 12×10, the numerics defaults of PORT_LOG decision 11, host pre- and post-processing | 102.13 / 102.04 | 117.90 | all gates (above) | – || r1.0 | `0f557b9` | re-vendor ttaw 0.20.0 -> 0.23.0 (no planner module changed) | – | – | 44 / 44, 99 scenes identical | – || r1.1 | `9a885b3` | encoder linears on batched `[1, E, T, C]` activations as one 2-D matmul: free `[1, 1, E·64, 128]` view for the MixerBlock channel MLPs (auto 2-D multicast), a 1-D in1-multicast config with `fuse_batch=True` for the pre-projections (T = 6 / 20 / 40) | 102.09 -> 78.72 / 102.03 -> **78.66** (−23.37) | 113.1 -> 89.9 | bit-identical readback; 44 / 44; 99 scenes identical | `DIFFUSION_PLANNER_ENC_CH2D=0` || r1.2 | `ef6a763` | fp32 matmul attention (`tt/attention.py`): P·V on `MatmulMultiCoreReuseProgramConfig` with one output tile per core and the whole K in one block (88 cores instead of 11; sweep: 73 -> 21 µs self, 71 -> 32 µs cross, 81 -> 42 µs fusion) | 78.72 -> 75.37 / 78.66 -> **75.31** (−3.35) | 89.8 -> 86.5 | bit-identical; 44 / 44; 99 scenes identical | `DIFFUSION_PLANNER_ATTN_FAST=0` || r1.3 | `dd6f249` | decoder 352-row matmuls (every split pass): explicit `MatmulMultiCoreReuseMultiCastProgramConfig` per (K, N, pass), the fastest bit-identical candidate of a device sweep (`tt/layers.py` `DEC_MM_CONFIGS`; e.g. mlp fc2 30 -> 12 µs) | 75.37 -> 70.18 / 75.30 -> **70.12** (−5.18) | 86.5 -> 81.2 | bit-identical; 44 / 44; 99 scenes identical | `DIFFUSION_PLANNER_DEC_MMCFG=0` || r2.1 | `2fc9af8` | fused fp32 LayerNorm (`LN_KERNEL=2`): the 9-program `layer_norm_fp32` decomposition as one `generic_op` (`tt/ln_kernel.py`, `kernels/ln32_*.cpp`), the same SFPU LLK calls in the same order (accurate `ttnn.mean` fold + `sfpu_reduce`, binary_ng fp32 SFPU ops, `rsqrt` Default) | 70.18 -> 54.64 / 70.12 -> **54.58** (−15.54) | 81.6 -> 65.6 | bit-identical readback; 44 / 44; 99 scenes identical | `DIFFUSION_PLANNER_LN_KERNEL=0` || r2.2 | `6ef00e6` | residual adds fused into the LN program (`LN_RESID`): `h = x + r (* gate)` then `LN(h)`, writing both (mixers: x + token-mix, x + channel-MLP; decoder: the four stream adds of a block and the final one) | 54.64 -> 54.43 / 54.58 -> **54.37** (−0.21) | 65.5 -> 65.2 | bit-identical; 44 / 44; 99 scenes identical | `DIFFUSION_PLANNER_LN_RESID=0` || r2.3 | `d7f84e1` | decoder split matmuls as ONE K-concatenated fp32 matmul (`SPLIT_KCAT=2`): `[x_hi \| x_hi \| x_lo \| 1 \| 0..] @ [w_hi; w_lo; w_hi; b_hi, b_lo; 0..]`, operand built by one `generic_op` (`kernels/kcat_*.cpp`), K' padded for K = 1024, per-shape 2-D multicast configs from a sweep | 54.44 -> 47.45 / 54.37 -> **47.39** (−6.98) | 65.4 -> 58.3 | **not bit-identical** (one fp32 accumulation, exact bias): final_x0 rel 1.1e-3; 44 / 44 green; 99 scenes ego max 0.313 -> 0.327 m, mean 0.143 -> 0.149 m, neighbours 0.086 -> 0.104 m (57 scenes worse, 41 better) | `DIFFUSION_PLANNER_SPLIT_KCAT=0` || r2.4 | `2da6100` | attention score scale + mask in one pass (`ATTN_SMASK`, `kernels/smask_*.cpp`); reproduces the TF32 truncation of the stock fp32 + bf16 add (finding below) | 47.45 -> 44.63 / 47.39 -> **44.56** (−2.83) | 58.3 -> 55.6 | bit-identical to r2.3 (readback, 99 / 99 scenes); 44 / 44 | `DIFFUSION_PLANNER_ATTN_SMASK=0` || r2.5 | `4699447` | the GELU between two K-concatenated linears applied inside the next operand build (`KCAT_ACT`; 77 unary programs per plan) | 44.62 -> 44.02 / 44.56 -> **43.96** (−0.60) | 55.5 -> 54.9 | bit-identical to r2.3; 44 / 44 | `DIFFUSION_PLANNER_KCAT_ACT=0` || r2.6 | `98ca6c7` | decoder LayerNorms with each tile row over 8 cores (`LN_SPLIT`, `kernels/ln32s_*.cpp`: gather to a root core, ordered fold, broadcast; semaphores): 88 cores instead of 11 | 44.02 -> 43.19 / 43.96 -> **43.13** (−0.83) | 54.8 -> 54.3 | bit-identical to r2.3; 44 / 44 | `DIFFUSION_PLANNER_LN_SPLIT=0` || r2.7 | `c42c540` | LN statistics broadcast by the SFPU row reduce itself (`LN_SFPU_BCAST`, `kernels/ln32_sfpu.h`: the stock `sfpu_reduce` row-sum arithmetic with the result stored to every column) instead of a RISC-V 1024-store column fill per statistic | 43.19 -> 40.95 / 43.13 -> **40.89** (−2.24) | 53.9 -> 51.9 | bit-identical to r2.3; 44 / 44 | `DIFFUSION_PLANNER_LN_SFPU_BCAST=0` || r3.1 | `c03adc3` | attention score scale + mask + softmax as one `generic_op` (`ATTN_SMSM=1`, `kernels/smsm_*.cpp`): the smask SFPU sequence into an L1 row, then the stock `ttnn.softmax(numeric_stable=True)` compute with the same `kernel_lib` calls | 40.96 -> 39.39 / 40.89 -> **39.32** (−1.56) | 51.9 -> 50.3 | bit-identical to r2.7 (readback, 99 / 99 scenes); 44 / 44 | `DIFFUSION_PLANNER_ATTN_SMSM=0` || r3.2 | `c6edfaf` | encoder split linears (`enc.pre.*`, `enc.island.*`, any K: weight blocks padded to whole tiles) as one K-concatenated fp32 matmul (`ENC_KCAT`), 1-D `fuse_batch` config for the `[1, E, T, K']` operands | 39.38 -> 37.68 / 39.32 -> **37.62** (−1.70) | 50.3 -> 48.4 | **not bit-identical** (one fp32 accumulation, exact bias; final_x0 rel 2.9e-3); 44 / 44 green; 99 scenes ego max 0.327 -> 0.346 m (scene-0103_kf14), mean 0.149 -> 0.154 m, neighbours 0.104 -> 0.094 m (47 scenes worse, 45 better, mean change −0.2 mm) | `DIFFUSION_PLANNER_ENC_KCAT=0` || r3.3 | `8d402d1` | (not kept, knob default 0) mixer fc1 GELU in the matmul epilogue (`LIN_ACT`): an explicit copy of the stock auto config (bit-identical without the activation) + `fused_activation` | 39.38 -> 39.25 / 39.32 -> 39.19 (−0.13) | 50.3 -> 50.1 | not bit-identical; 44 / 44 green; ego max 0.327 -> 0.392 m, mean 0.149 -> 0.174 m (54 worse, 38 better) | default 0 || r3.4 | `4acde70` | the whole fp32 matmul attention as one `generic_op` (`ATTN_FUSED`, `kernels/fattn_*.cpp`): per (head, query tile row) Q·Kᵀ into DEST (`matmul_block`, in1 transposed), the smsm phases on the row in L1, P·V accumulated in DEST in key order; Q / K / V read in place (no head split), output written as the merged heads (no head merge) | 37.68 -> 32.25 / 37.62 -> **32.19** (−5.43) | 48.9 -> 43.2 | bit-identical to r3.2 (readback, 99 / 99 scenes); 44 / 44 | `DIFFUSION_PLANNER_ATTN_FUSED=0` || r3.5 | `ad03767` | the decoder's split-row LNs and the fused attention write the split operand `[x_hi \| x_hi \| x_lo \| 1]` of the next K-concatenated linear (`KCAT_EMIT`; `layers.KcatOperand`): 198 `kcat_operand` programs per plan less | 32.25 -> 31.30 / 32.19 -> **31.24** (−0.95) | 43.1 -> 42.4 | bit-identical to r3.4; 44 / 44 | `DIFFUSION_PLANNER_KCAT_EMIT=0` || r3.6 | `0b750e3` | the two transposes around each mixer token-mixing MLP inside the fused LN programs (`LN_TR`): n1 writes its output per-entity transposed, n2 reads the token-mixing output transposed (`transpose_tile`, the stock transpose LLK with fp32 unpack-to-dest: exact); 48 transpose programs less | 31.30 -> 30.22 / 31.24 -> **30.16** (−1.08) | 42.1 -> 41.0 | bit-identical to r3.5; 44 / 44 | `DIFFUSION_PLANNER_LN_TR=0` || r4.1 | `7e662d3` | the K = 1024 split operands X' `[352, 3328]` (mlp fc2) / `[352, 3168]` (final p4, K' padded to 11 slices) written **L1 block-sharded** by the operand build (its writer's TensorAccessor resolves the shards) and read in place by a 2-D multicast matmul with in0 sharded (`KCAT_L1`, `layers.KCAT_L1_CONFIGS`): no 4.7 MB DRAM round trip (kernel check: operand + matmul 62.6 -> 41.3 µs, 62.3 -> 41.8 µs) | 30.22 -> 28.59 / 30.16 -> **28.53** (−1.63) | 40.8 -> 39.3 | bit-identical to r3.6 (readback, 99 / 99 scenes); 44 / 44 | `DIFFUSION_PLANNER_KCAT_L1=0` || r4.2 | `310bd38` | (not kept, knob default 0) the deferred GELU of the operand build on one DEST copy + `copy_dest_values` (`KCAT_ACT_ONCE`) | 28.62 -> 28.66 / 28.53 -> 28.59 (+0.06) | (host-noisy) | bit-identical | default 0 || r4.3 | `f6cc333` | the fused attention's inputs L1-resident (`ATTN_L1=1`): decoder qkv / cross q outputs and fusion q / kv outputs in L1, the hoisted cross K / V heads moved to L1 once per plan, the self / cross / fusion masks in L1 (kernel check: self 51.0 -> 35.1 µs, cross 61.0 -> 54.2, fusion 106.2 -> 88.4) | 28.59 -> 28.18 / 28.53 -> **28.12** (−0.41) | 39.3 -> 38.9 | bit-identical to r4.1; 44 / 44 | `DIFFUSION_PLANNER_ATTN_L1=0` || r4.4 | `e5fb151` | the decoder blocks' intermediates in L1 interleaved (`DEC_L1=1`): split-LN outputs and stream `h`, fused attention outputs, out / mlp / cross-out linear outputs (kernel check: split LN 24.1 -> 20.6 µs, K = 256 matmuls −2 to −4 µs, attention −1.7 µs) | 28.18 -> 27.16 / 28.12 -> **27.11** (−1.01) | 38.8 -> 37.9 | bit-identical to r4.3; 44 / 44 | `DIFFUSION_PLANNER_DEC_L1=0` || r4.5 | `60eaef1` | (not kept, default 0) the mixer blocks' intermediates in L1 (`ENC_L1`) | 27.16 -> 28.84 / 27.11 -> 28.77 (+1.67) | 37.7 -> 39.5 | **not** bit-identical (final_x0 rel 8e-3; ego max 0.379 m): the stock matmul / unary programs change with an L1 output; 44 / 44 | default 0 || r4.6 | `dab96fb` | `DEC_L1=2`: the decoder pre-projection and final layer intermediates in L1 too | 27.17 -> 27.07 / 27.11 -> **27.02** (−0.09) | 37.9 -> 37.9 | bit-identical to r4.4; 44 / 44 | `DIFFUSION_PLANNER_DEC_L1=1` || r4.7 | `c3b6a5a` | (not kept, default 0) the fusion blocks' intermediates in L1 (`FUS_L1`) | 27.07 -> 27.47 / 27.02 -> 27.40 (+0.39) | 37.8 -> 38.2 | **not** bit-identical (ego max 0.364 m; `ttnn.layer_norm` with an L1 output); 44 / 44 | default 0 || r4.8 | `93428bb` | `ATTN_L1=2`: the fusion q / kv linears back to DRAM outputs (the stock linear with an L1 output ran on 6 cores, 54 µs, with a separate bias add: the fusion stage 1.41 -> 1.74 ms in the first round-4 profile); masks and decoder inputs stay in L1 | 27.08 -> 26.69 / 27.02 -> **26.62** (−0.39) | 37.8 -> 37.7 | bit-identical to r4.6; 44 / 44 | `DIFFUSION_PLANNER_ATTN_L1=1` || r5.1 | `9fe29a8` | exact decoder compaction (`COMPACT=1`): one trace per agent bucket (`AGENT_BUCKETS` 32, 64, 96, 128, 192) besides the full 352-row plan; the decoder runs on the first R rows (the ego, every valid self-attention key, every emitted neighbour), `y0` / `cs` / the key row sliced in the trace; per-R agent rows and cross mask; the matmul configs keep their K blocking (`per_core_M` fitted to the grid); the bucket picked per request (`TtDiffusionPlanner.variant_for`) | 26.68 -> 23.31 / 26.62 -> **23.25** (−3.37; r32 21.85, r64 22.91) | 38.3 -> 33.8 | bit-identical on the needed rows vs the full plan (15 scenes, `compact_check.py`); 44 / 44; 99 scenes identical | `DIFFUSION_PLANNER_COMPACT=0` || r5.2 | `268ff32` | `COMPACT=2`: the encoder's neighbour trunk and head on the same first R neighbours, the other neighbour tokens a zero block (invalid entities: `token_valid` zeroes them anyway); the bucket also covers every valid neighbour token | 23.30 -> 20.05 / 23.25 -> **19.99** (−3.26; r32 17.42, r64 19.23) | 33.2 -> 30.1 | bit-identical on the needed rows (15 scenes); 44 / 44; 99 scenes identical | `DIFFUSION_PLANNER_COMPACT=1` || r5.3 | `3ce8ea9` | vectorised host pre- / post-processing (`HOST_FAST`): normalisation of the non-small rows only, neighbour features on the 6 kept rows, the trajectory loops as array operations in the same float64 / float32 order, denormalisation and predicted paths on the emitted rows only | device unchanged (19.99) | 30.15 -> **27.31** | bit-exact on 134 inputs (`host_equiv.py`, both directions of the knob); 44 / 44; 99 scenes identical | `DIFFUSION_PLANNER_HOST_FAST=0` || r5.4 | `e933166` | trimmed uploads (`INPUT_TRIM`): `cs` as one tile column `[352, 32]` widened in the trace by a tile-aligned concat; an all +0.0 input (`y0`, `static_x`) not re-uploaded while its buffer holds this model's last zeros | 20.05 -> 20.06 / 19.99 -> 20.00 (+0.014) | 27.22 -> **26.84** | readback bit-identical (bench dumps, 3 scenes x 6 runs); 44 / 44; 99 scenes identical | `DIFFUSION_PLANNER_INPUT_TRIM=0` |
Later commits up to the first release changed no model numerics and no device code: the baseline documentation(`a6e5bbf`), the ttaw 0.19.0 re-vendor with the `serve.env` pins of the numerics knobs, the quickstart picture and twotest changes (`d521981`), the ttaw 0.20.0 re-vendor (`c0d84f9`), and the release docs and demo media. After the re-vendor the device suite was re-run withidentical gate values and per-scene numbers (`VERIFICATION_2026-10-08.md`).
## Round 1
Date 2026-10-10, plan `OPT_PLAN.md` §7 round 1 (items 1, 2a, 4a). The device was shared with a METEOR debugging jobthat hung the chip three times during the round (05:22, 05:45 and 07:35 UTC, FAULT markers written by its own devrunjobs). None of this round's jobs ran on a faulted chip: every job script checks for the marker after taking the lock,and the queued jobs aborted with exit 75 and were re-queued after the orchestrator cleared the marker. No job of thisround hung.
Method, per step (`logs/diffusion-planner/opt_r1/`; scripts in `scripts/`):
- `ab.sh <tag> <KNOB> <off> <on>`: the device suite with the new value (`TTAW_GATES_READONLY=1`, both device test files, `DIFFUSION_PLANNER_E2E_REPORT` per-scene JSON), then 3 alternating pairs of `bench.py` (`--iters 30`, b2b 3 × 50) in one devrun window. Every bench run writes its raw packed readback (`--dump`), and `cmp.py` compares on / off bit for bit and the per-scene report with the baseline's `e2e_device.json`. The other knobs are pinned so each A/B isolates one change; jobs run from a snapshot of the code (`snap.sh`), so later edits cannot leak into a queued job.- `mm_sweep.py` / `attn_sweep.py`: device micro-benches (20-call traces) of the decoder matmul shapes (three split passes each) and the attention pieces under the auto config and candidate program configs, outputs compared bit for bit (`mm_sweep.json`, `attn_sweep.log`).
| A/B (same session, 3 pairs unless noted, kashiwanoha_dense) | off: b2b / trace / e2e ms | on: b2b / trace / e2e ms | Δ b2b | outputs | kept ||---|---|---|---:|---|---|| `ENC_CH2D` 0 / 1 (ATTN_FAST=0, DEC_MMCFG=0) | 102.03 / 102.09 / 113.1 | 78.66 / 78.72 / 89.9 | −23.37 | bit-identical | yes || `ATTN_FAST` 0 / 1 (ENC_CH2D=1, DEC_MMCFG=0) | 78.66 / 78.72 / 89.8 | 75.31 / 75.37 / 86.5 | −3.35 | bit-identical | yes || `DEC_MMCFG` 0 / 1 (ENC_CH2D=1, ATTN_FAST=1) | 75.30 / 75.37 / 86.5 | 70.12 / 70.18 / 81.2 | −5.18 | bit-identical | yes || `ATTN_FAST` 0 / 3: + scale as an SFPU pre-activation of the mask add (ENC_CH2D=1, DEC_MMCFG=0; the first form of the knob, then a bool) | 78.66 / 78.72 / 89.6 | 72.81 / 72.88 / 83.8 | −5.85 (−2.5 over mode 1) | final_x0 rel 4.1e-3; 99 scenes: ego max 0.313 -> 0.385 m, mean 0.143 -> 0.173 m; 44 / 44 green | no || `ATTN_FAST` 1 / 2: + scale on Q before Q·Kᵀ (2 pairs) | 70.12 / 70.18 / 81.2 | 68.15 / 68.21 / 79.5 | −1.97 | final_x0 rel 3.0e-3; ego max 0.313 -> 0.379 m, mean 0.143 -> 0.172 m, neighbours 0.086 -> 0.098 m; 44 / 44 green | no |
AICLK 1350 MHz (min 1343) in every run. The device rows repeat to ±0.01 ms within a session; e2e moves with the hostload by ±0.5 ms.
### Findings (measured)
The baseline profile (`OPT_BASELINE.md` "Device profile") is the starting point:
- The trace is **kernel-bound, not dispatch-bound**: op-to-op gaps total 4.39 ms of a 103.66 ms span (median gap 0.56 µs). Removing a short program saves its ~5-8 µs of kernel time plus ~0.6 µs.- The plan does 165 GFLOP of matmul (split passes counted), ~1 ms at the 120-core HiFi4 peak: the time goes to badly parallelised matmuls and thousands of small element-wise programs. Matmul efficiency is 7.2 % of the FLOP roofline on average.- By layer kind: split matmuls 34.8 ms, plain linears 24.0 ms (23.3 of them in the encoder's mixer trunks), fp32 LayerNorm 21.6 ms, fp32 matmul attention 16.4 ms, glue 5.6 ms.- What each numerics default costs (device time per plan, timing only; only the shipped configuration is gate-clean): decoder split matmuls 20.2 ms, fp32 LayerNorm 18.1 ms, fp32 matmul attention 15.5 ms, encoder split matmuls 6.0 ms; all four together 58.3 ms (the fastest graph, 43.74 ms, fails `enc.ego`), the decision-11 additions over the first device round 33.4 ms (round-1 defaults: 68.64 ms, which fail `ego.mean_err_m` on nuScenes scene-0103_kf14).- Dispatch / CQ matrix (back-to-back): ETH-1CQ 102.04, ETH-2CQ 111.87, WORKER-2CQ 101.88, WORKER-1CQ 101.87 ms. WORKER is equal (the 12th column hardly matters to this graph yet), so ETH stays the default (D14); 2 CQs cost +9.8 ms on ETH, so 1 CQ stays pinned.
Round 1 findings:
- **The 4-D batched linear is the stock trap.** `ttnn.linear` on `[1, E, T, C] @ [C, N]` auto-configures with M per batch element (`fuse_batch=False`, `matmul_program_config.cpp` `create_simple_matmul_program_config`), so the 6 × 320 entity blocks ran on 8 cores. A free reshape (T a multiple of 32) or a program config with `fuse_batch=True` gives the whole grid the work: same products, same fp32 DEST order, bit-identical output. 23.4 ms, the largest single gain of the plan so far.- **K-blocking decides bit-identity, the core grid does not.** In both sweeps every candidate with the same `in0_block_w` as the auto config (the whole K in one block for P·V; 8 for the decoder linears) was bit-identical; smaller `in0_block_w` changed the P·V output by up to 7e-4 (the partial sums spill between K blocks).- **The 99-scene plan error reacts to any rounding change.** Both attention variants that only move one fp32 rounding (where the 1/√32 is applied) raised the worst ego error by ~20 % (0.31 -> 0.38 m), with every gate still green. This is the chaotic sensitivity of PORT_LOG known issues; bit-identical rewrites were preferred for that reason.- **`input_tensor_a_activations` is not a free fusion for fp32.** The scale pre-activation on the mask add is not bit-identical to `multiply` + `add` (rel 4e-3 on `final_x0`), although both look like an fp32 SFPU multiply then the same add.
### Megakernel / fusion work
No megakernel yet; the candidates (D19) are in the backlog (item 6): the persistent DiT-evaluation kernel first. Round2's kernels are its building blocks (the fp32 LN with the residual phase, the split-row LN with semaphore gather /broadcast, the K-concatenated split operand, the score scale + mask). Round 3 added the first block-level fusion: thewhole fp32 attention (Q·Kᵀ, scale / mask / softmax, P·V, head split / merge) as one bit-identical program(`ATTN_FUSED`), the attention phase of MK-D, plus producer-side operand emission (`KCAT_EMIT`) and the mixertransposes folded into the LN (`LN_TR`), which are the MK-E / MK-D data-layout pieces. The megakernel attempt keeps itsown phase.
## Round 2
Date 2026-10-10, plan `OPT_PLAN.md` §7 round 2 (L2 `generic_op` kernels: items 3, 2, 4b, 5). The device was sharedwith METEOR hang-debugging jobs (two FAULT markers from their jobs, 09:19 and 10:05 UTC) and other agents' optimizationjobs; none of this round's jobs hung, timed out or ran on a faulted chip (every job checks the marker after taking thelock). Every custom kernel went through the hang protocol before it touched the plan: smallest shape under`TT_METAL_WATCHER=2`, eager twice, then a traced replay, then the real shapes (`logs/diffusion-planner/opt_r2/`).
Method, per step (`logs/diffusion-planner/opt_r2/`; scripts in `scripts/`): a device micro-check of the kernel againstthe stock programs it replaces (`ln_check.py`, `kcat_check.py`, `smask_check.py`: bit comparison, eager repeat,trace replay, µs per call over a 20-call trace), then `ab.sh <tag> <KNOB> <off> <on>` as in round 1 (device suitewith the gates read-only, 3 alternating `bench.py` pairs with raw readback dumps, `cmp.py` bit comparison and the99-scene report). Every job runs from a snapshot of the code (`snap.sh`; scripts copied into it).
| A/B (same session, 3 pairs, kashiwanoha_dense) | off: b2b / trace / e2e ms | on: b2b / trace / e2e ms | Δ b2b | outputs | kept ||---|---|---|---:|---|---|| `LN_KERNEL` 0 / 2 (LN_RESID=0, SPLIT_KCAT=0) | 70.12 / 70.18 / 81.6 | 54.58 / 54.64 / 65.6 | −15.54 | bit-identical | yes || `LN_RESID` 0 / 1 (LN_KERNEL=2, SPLIT_KCAT=0) | 54.58 / 54.64 / 65.5 | 54.37 / 54.43 / 65.2 | −0.21 | bit-identical | yes || `SPLIT_KCAT` 0 / 2 (LN_KERNEL=2, LN_RESID=1) | 54.37 / 54.44 / 65.4 | 47.39 / 47.45 / 58.3 | −6.98 | final_x0 rel 1.1e-3; 99 scenes ego max 0.313 -> 0.327 m, mean 0.143 -> 0.149 m, nb 0.086 -> 0.104 m; 44 / 44 green | yes || `ATTN_SMASK` 0 / 1 (KCAT_ACT=0, LN_SPLIT=0) | 47.39 / 47.45 / 58.3 | 44.56 / 44.63 / 55.6 | −2.83 | bit-identical | yes || `KCAT_ACT` 0 / 1 (ATTN_SMASK=1, LN_SPLIT=0) | 44.56 / 44.62 / 55.5 | 43.96 / 44.02 / 54.9 | −0.60 | bit-identical | yes || `LN_SPLIT` 0 / 1 (ATTN_SMASK=1, KCAT_ACT=1) | 43.96 / 44.02 / 54.8 | 43.13 / 43.19 / 54.3 | −0.83 | bit-identical | yes || `LN_SFPU_BCAST` 0 / 1 (all of the above on) | 43.13 / 43.19 / 53.9 | 40.89 / 40.95 / 51.9 | −2.24 | bit-identical | yes |
AICLK 1350 MHz (min 1343) in every run; the device rows repeat to ±0.01 ms within a session.
Kernel micro-benchmarks (µs per call, 20-call trace; stock programs -> the kernel; all bit-identical except theK-concatenated matmul, which is compared with its stock-op operand build):
| kernel | shape | stock | kernel ||---|---|---:|---:|| fp32 LN (`LN_KERNEL`, one core per tile row) | decoder [352, 256] + affine / neighbour mixer [320·64, 128] / lane [140·64, 128] | 47.8 / 510.8 / 238.3 | 27.6 / 126.5 / 73.1 || + residual and gate (`LN_RESID`) | decoder / neighbour mixer | 61.7 / 680.5 | 38.5 / 191.9 || split-row LN (`LN_SPLIT`, 8 cores per row) | decoder, plain / + residual and gate | 47.9 / 61.7 | 26.8 / 29.4 || split linear: 3 passes (`DEC_MMCFG`) vs K-concatenated (operand kernel + one matmul) | qkv 256->768 / out 256->256 / fc1 256->1024 / fc2 1024->256 | 62.1 / 50.0 / 70.4 / 70.7 | 27.2 / 22.4 / 31.2 / 62.5 || score scale + mask (`ATTN_SMASK`) | 8 x 352 x 352 / 8 x 352 x 576 / 8 x 576 x 576 | 74.9 / 73.8 / 118.9 | 27.0 / 46.1 / 64.7 |
### Findings (measured)
- **Bit-identical fused kernels are possible for the precision decompositions** when the kernel issues the same LLK calls in the same order as the stock programs and keeps every intermediate fp32 in L1 / DST: the fp32 LayerNorm (accurate `ttnn.mean` = `add_binary_tile` fold + `sfpu_reduce` + `mul_unary_tile(1/W)`; binary_ng fp32 SFPU ops; `rsqrt_tile<Default>`), the residual / gate adds, the GELUs and the attention scale reproduce the published numerics bit for bit. That made 5 of the 6 kept steps exact rewrites (same readback, same 99 per-scene numbers).- **The stock fp32 + bf16 add is not an fp32 add.** `ttnn.add(scores_fp32, mask_bf16)` (the key mask of every fp32 matmul attention of the plan) runs on binary_ng's FPU path; its SrcA truncates the fp32 scores to TF32 (stock == exact & 0xFFFFE000 on every finite element, `smask_diag.log`; with an fp32 mask the add is exact). The published graph therefore feeds TF32-truncated scores to the softmax. `ATTN_SMASK` reproduces that (an SFPU AND on the raw bits); an exact variant (mask in fp32, or no truncation) would be a precision change to gate separately.- **One K-concatenated fp32 matmul replaces the three split passes** (and their typecast / subtract / add programs): the products are the same (bf16-exact hi parts, TF32-truncated lo parts), only the accumulation order changes and the bias becomes exact (two K rows instead of the packer epilogue, which rounds the fp32 output: TransFusion T4). Per linear the rms error vs the fp64 product goes 3.2e-4 -> 3.1e-4; over the 99 scenes the worst scene moves +4 % (0.313 -> 0.327 m), the others both ways (57 worse, 41 better, mean change +0.3 mm on the ego max). Kept: the gates have 3x (max) / 2x (mean) margin, and it is the largest non-exact gain of the round (−7.0 ms).- **The K block must divide K'.** 3·Kt + 1 is prime for K = 1024 (97 tiles): the auto config then uses a 1-tile K block (90 µs); padding K' to 104 = 8 x 13 with zero tiles and a 13-tile block gives 41 µs.- **The mixer LNs are DRAM-bound**, not compute-bound: the neighbour LN with its residual moves 42 MB (x, residual, h, y; fp32) in ~190 µs. Removing that traffic needs the entity block resident in L1 (MK-E, item 7).- **The decoder LN is latency-bound** on 11 cores (one tile row each): 8 tiles per core of SFPU work in sequence. The split-row form (8 cores per row, gather / fold / broadcast with semaphores) is bit-identical and 24 % faster with the residual (38.5 -> 29.4 µs); its own floor is the root's two ordered 8-tile folds plus two broadcast rounds.- **A RISC-V fill loop is not free.** Broadcasting one fp32 statistic tile over its columns with 1,024 volatile L1 stores on a data-movement core sat on the critical path of every LN row twice. Storing the SFPU reduce's result (already replicated across the 8 lanes by its butterfly) to all four column groups instead costs three more SFPU stores: −2.24 ms over the plan (decoder split LN 29.4 -> 21.6 µs, neighbour mixer LN 191.9 -> 158.3 µs).
### Profile (after r2.3, `d7f84e1`, one traced replay; `profile_r2/`)
2,304 programs (from 6,282), kernel sum 46.52 ms, span 48.06 ms (b2b 47.39 ms). By op code: Matmul 16.28 ms (759programs), GenericOp (the new kernels) 13.34 ms (540), BinaryNg 7.80 ms (353), Softmax 3.48 ms (72), Unary 2.03 ms(191), Transpose 1.36 ms (84). Largest single items: the decoder LN programs on 11 cores (5.6 ms incl. the residualform; r2.6 then spread them over 88 cores), the mixer LNs (3.5 ms on 120 cores, DRAM-bound), the score scale + maskprograms (4.8 ms decoder + 0.7 ms fusion; r2.4 removed half of that), the softmax (3.5 ms), the K = 1024 K-concatenatedmatmul (2.5 ms) and its operand build (1.6 ms, writes a 4.7 MB operand), the attention matmuls (~3.4 ms), the mixertransposes (1.3 ms) and the encoder pre-projection split glue (1.2 ms).
## Round 3
Date 2026-10-10, plan `OPT_PLAN.md` §0.2 (the ranked list after round 2: softmax fusion, encoder split linears, thenthe attention and operand traffic the round-3 profile pointed at). The device was shared with METEOR debugging jobsand other agents' optimization jobs; none of this round's jobs hung, timed out or ran on a faulted chip (every jobchecks the FAULT marker after taking the lock). Every new kernel or kernel mode went through the hang protocol beforeit touched the plan: smallest shapes under `TT_METAL_WATCHER=2`, eager twice, then the real shapes with a tracedreplay (`logs/diffusion-planner/opt_r3/*_tiny_watcher.log`, `*_real.log`).
Method, per step (`logs/diffusion-planner/opt_r3/`; scripts in `scripts/`): a device micro-check of the kernel againstthe stock programs it replaces (`smsm_check.py`, `fattn_check.py`, `kemit_check.py`, `lntr_check.py`,`linact_check.py`: bit comparison, eager repeat, trace replay, µs per call over a 20-call trace), then `ab.sh <tag><KNOB> <off> <on>` (device suite with the gates read-only and the per-scene report, 3 alternating `bench.py` pairs withraw readback dumps, `cmp.py` bit comparison and 99-scene comparison). Each A/B ran on the previous step's defaults(the knob of a not-yet-committed step set by the chain script); every job ran from a snapshot of the code.
| A/B (same session, 3 pairs, kashiwanoha_dense) | off: b2b / trace / e2e ms | on: b2b / trace / e2e ms | Δ b2b | outputs | kept ||---|---|---|---:|---|---|| `ATTN_SMSM` 0 / 1 (round-2 defaults) | 40.89 / 40.96 / 51.9 | 39.32 / 39.39 / 50.3 | −1.56 | bit-identical | yes || `ENC_KCAT` 0 / 1 | 39.32 / 39.38 / 50.3 | 37.62 / 37.68 / 48.4 | −1.70 | final_x0 rel 2.9e-3; 99 scenes ego max 0.327 -> 0.346 m, mean 0.149 -> 0.154 m, nb 0.104 -> 0.094 m; 44 / 44 green | yes || `LIN_ACT` 0 / 1 (ENC_KCAT=0) | 39.32 / 39.38 / 50.3 | 39.19 / 39.25 / 50.1 | −0.13 | final_x0 rel 3.1e-3; ego max 0.327 -> 0.392 m, mean 0.149 -> 0.174 m; 44 / 44 green | no || `ATTN_SMSM` 1 / 2 (ENC_KCAT=1) | 37.62 / 37.68 / 48.6 | 37.59 / 37.65 / 48.9 | −0.03 | bit-identical | no (noise level) || `ATTN_FUSED` 0 / 1 | 37.62 / 37.68 / 48.9 | 32.19 / 32.25 / 43.2 | −5.43 | bit-identical | yes || `KCAT_EMIT` 0 / 1 | 32.19 / 32.25 / 43.1 | 31.24 / 31.30 / 42.4 | −0.95 | bit-identical | yes || `LN_TR` 0 / 1 (KCAT_EMIT=1) | 31.24 / 31.30 / 42.1 | 30.16 / 30.22 / 41.0 | −1.08 | bit-identical | yes |
AICLK 1350 MHz (min 1343) in every run; the device rows repeat to ±0.01 ms within a session. Final check of theshipped defaults (`0b750e3`, no knob set; `logs/diffusion-planner/opt_r3/final/`): 44 / 44, readback and the 99per-scene numbers identical to the `LN_TR` on side; bench b2b 30.16 ms, trace p50 30.22 ms, e2e p50 40.84 ms.
Kernel micro-benchmarks (µs per call, 20-call trace; every row bit-identical to the stock chain it replaces):
| kernel | shape | stock chain | kernel ||---|---|---:|---:|| scale + mask + softmax (`ATTN_SMSM`) vs smask + `ttnn.softmax` | 8 x 352 x 352 / 8 x 352 x 576 / 8 x 576 x 576 | 62.0 / 101.6 / 149.9 | 50.6 / 73.2 / 106.1 || fused attention (`ATTN_FUSED`) vs head split + Q·Kᵀ + smsm + P·V + head merge | decoder self (qkv in place) / cross (hoisted K, V heads) / fusion (q, kv in place) | 110.6 / 144.6 / 214.6 | 51.0 / 63.0 / 106.1 || fused attention emitting the out-linear operand (`KCAT_EMIT`) vs fused attention + `kcat_operand` | decoder self | 57.9 | 51.7 || split-row LN emitting the operand vs split-row LN + `kcat_operand` | [352, 256] | 26.2 | 22.1 || LN writing its output per-entity transposed (`LN_TR`) vs LN + `ttnn.transpose` | neighbour [320, 64, 128] / lane [140, 64, 128] | 149.5 / 80.6 | 102.6 / 61.8 || LN (+ residual) reading the residual transposed vs `ttnn.transpose` + LN | neighbour / lane | 200.1 / 102.6 | 147.2 / 81.1 || mixer fc1 + GELU in the epilogue (`LIN_ACT`, not bit-identical) vs linear + GELU program | [40960, 64] @ [64, 64] / [20480, 128] @ [128, 128] | 107.8 / 106.4 | 95.8 / 108.7 |
### Findings (measured)
- **The attention was DRAM-bound, not compute-bound.** The fused attention costs about what the scale / mask / softmax kernel alone cost (51.0 vs 50.6 µs self-attention), although it adds Q·Kᵀ and P·V: the time of the five stock programs was the round trips of the `[1, 8, Sq, Sk]` fp32 scores and probabilities (4-8 MB each) and the head split / merge copies. With the scores in L1 the per-core critical path is the stock softmax arithmetic on one tile row; the decoder attention went from ~255 to ~114 µs per block.- **Stock LLK sequences compose bit-identically inside one kernel.** The `kernel_lib` softmax calls (reduce, bcast-sub + exp, reduce + precise reciprocal, bcast-mul) work on plain CB ids in a `generic_op` and give the stock softmax bit for bit; `matmul_block` with the in1 transpose flag reproduces the stock Q·Kᵀ (K = 32 in one block) and a key-ordered DEST accumulation reproduces the stock P·V (the whole K in one block); the score value never needs to leave DEST between Q·Kᵀ and the scale / mask SFPU ops. The global `UnpackToDestEn` (set when any CB unpacks to DEST) did not perturb the FPU phases.- **The fp32 SFPU multiply by an immediate equals the multiply by a filled tile** (`mul_unary_tile` vs `mul_binary_tile`, fp32 DEST): bit-identical, but only 0.03 ms of the plan; kept as the fused attention's form.- **Producers can emit the consumer's operand.** Writing `[x_hi | x_hi | x_lo | 1]` from the split LN / fused attention (the `kcat_operand` LLK calls on the packed fp32 tile) costs 1-2 µs per producer and removes a 6.8 µs program plus its 0.6 µs gap: −0.95 ms over 198 programs.- **The stock fp32 `ttnn.transpose` is exact** (unpack-to-dest + `transpose_dest`), so the mixer's transposes fold into the LN kernels with `transpose_tile` bit for bit; the scattered tile writes cost nothing measurable (the LN is DRAM-bound either way): −1.08 ms.- **A more accurate GELU still moves the plan.** `LIN_ACT` applies the GELU before the bf16 rounding (per-linear rms error 2.06e-3 -> 1.66e-3 vs fp64), yet the 99-scene ego mean rises 0.149 -> 0.174 m: the chaotic scene sensitivity of PORT_LOG known issues again; at −0.13 ms it is not worth that.- **The encoder K-concatenation pays off more than estimated** (−1.70 vs −1 to −2 ms): beyond the 3-pass glue, the pre-projection matmuls on padded `[1, E, T, K]` rows read the operand once instead of three times.
## Round 4
Date 2026-10-10, plan `OPT_PLAN.md` §0.3 (item 1, the K = 1024 split operand traffic, then what the measurements ofthat step pointed at: the decoder's DRAM round trips). The device was shared with METEOR and other bundles' jobs;no job of this round hung, timed out or ran on a faulted chip (each job checks the FAULT marker after taking thelock). New kernel modes went through the hang protocol (smallest shapes under `TT_METAL_WATCHER=2`, eager twice,then the real shapes with a trace replay: `logs/diffusion-planner/opt_r4/*_tiny_watcher.log`, `*_real.log`).
Method as in round 3 (`logs/diffusion-planner/opt_r4/`, scripts in `scripts/`): a device micro-check per kernelmode (`kl1_check.py`, `kl1_sweep.py`, `ko_check.py`, `fl1_check.py`, `dl1_check.py`: bit comparison with the shippedpath, eager repeat, trace replay, µs per call over a 20-call trace), then `ab.sh <tag> <KNOB> <off> <on>` (devicesuite with the gates read-only and the per-scene report, 3 alternating `bench.py` pairs with raw readback dumps,`cmp.py`). Each A/B ran on the previous step's defaults, every job from a snapshot of the code.
| A/B (same session, 3 pairs, kashiwanoha_dense) | off: b2b / trace / e2e ms | on: b2b / trace / e2e ms | Δ b2b | outputs | kept ||---|---|---|---:|---|---|| `KCAT_L1` 0 / 1 (round-3 defaults) | 30.16 / 30.22 / 40.78 | 28.53 / 28.59 / 39.30 | −1.63 | bit-identical | yes || `KCAT_ACT_ONCE` 0 / 1 | 28.53 / 28.62 / 44.4 | 28.59 / 28.66 / 43.6 | +0.06 | bit-identical | no || `ATTN_L1` 0 / 1 | 28.53 / 28.59 / 39.33 | 28.12 / 28.18 / 38.93 | −0.41 | bit-identical | yes || `DEC_L1` 0 / 1 | 28.12 / 28.18 / 38.83 | 27.11 / 27.16 / 37.92 | −1.01 | bit-identical | yes || `ENC_L1` 0 / 1 | 27.11 / 27.16 / 37.70 | 28.77 / 28.84 / 39.49 | +1.67 | final_x0 rel 8e-3, ego max 0.346 -> 0.379 m | no || `DEC_L1` 1 / 2 | 27.11 / 27.17 / 37.91 | 27.02 / 27.07 / 37.90 | −0.09 | bit-identical | yes || `FUS_L1` 0 / 1 | 27.02 / 27.07 / 37.76 | 27.40 / 27.47 / 38.16 | +0.39 | final_x0 rel 5e-4, ego max 0.346 -> 0.364 m | no || `ATTN_L1` 1 / 2 | 27.02 / 27.08 / 37.82 | 26.62 / 26.69 / 37.71 | −0.39 | bit-identical | yes |
AICLK 1350 MHz (min 1343) in every run; the device rows repeat to ±0.01 ms within a session (the `KCAT_ACT_ONCE`e2e column ran on a busier host). Final check of the shipped defaults (`93428bb`, no knob set;`logs/diffusion-planner/opt_r4/final/`): 44 / 44, readback and the 99 per-scene numbers identical to round 3; benchb2b 26.62 ms, trace p50 26.68 ms, e2e p50 37.36 ms.
Kernel micro-benchmarks (µs per call, 20-call trace; every row bit-identical to the shipped path):
| check | shape | DRAM (shipped) | L1 ||---|---|---:|---:|| K = 1024 operand build + matmul (`KCAT_L1`; best of 7 / 6 sharded configs) | `[352, 1024]` -> X' `[352, 3328]` @ `[3328, 256]`, 2d M2 N1 kb13 | 62.6 (23.4 + 41.4) | 41.3 (19.0 + 24.2) || same | final p4 N = 324: K' 104 -> 99 tiles (11 slices), 2d M2 N1 kb9 | 62.3 | 41.8 || K = 256 operand L1-sharded (`kl1_sweep.py`: K' padded to 26-32 to match the N blocks) | N = 256 / 768 / 1024, matmul only | 15.3 / 20.4 / 24.2 | 14.2 / 29.7 / 34.7 (best) || operand build, GELU once (`KCAT_ACT_ONCE`) | K = 1024 / 512, gelu_tanh | 23.2 / 14.8 | 23.5 / 13.2 || fused attention, inputs (+ mask) in L1 (`ATTN_L1`) | self 8 x 352 x 352 / cross 8 x 352 x 576 / fusion 8 x 576 x 576 | 51.0 / 61.0 / 106.2 | 35.1 / 54.2 / 88.4 || split-row LN + residual + gate + emitted operand, inputs and outputs in L1 (`DEC_L1`) | `[352, 256]` | 24.1 | 20.6 || K = 256 K-concatenated matmuls, in0 and output in L1 interleaved (`DEC_L1`) | N = 256 / 768 / 1024 | 14.9 / 19.7 / 24.1 | 12.7 / 15.6 / 20.0 || fused self attention writing the operand to L1 (`DEC_L1`) | 8 x 352 x 352 | 37.6 | 36.0 |
### Findings (measured)
- **The decoder was bound by DRAM round trips of small tensors, not by compute.** The K = 1024 operand (4.7 MB) costs as much to write and re-read as the matmul costs to compute: written to L1 shards and read in place, the matmul alone drops 41.4 -> 24.2 µs. The same holds, at smaller scale, for every decoder intermediate (0.4-1.4 MB): L1-interleaved inputs and outputs take 2-4 µs off each split LN, matmul and attention program.- **K / V re-reads.** The fused attention's 11 query-row cores of a head each read all K / V tiles; from L1 banks instead of DRAM the self attention drops 51 -> 35 µs. No multicast kernel was needed for most of the estimated gain.- **L1 is not faster for large tensors.** The mixer's 5-10 MB intermediates in L1 interleaved made the trunk +1.67 ms slower (120 cores reading every bank: NoC contention instead of 8 DRAM channels).- **Stock ops change program (and numerics) with an L1 output.** `ttnn.linear` with an L1 output ran the fusion kv projection on 6 cores with a separate bias add (54 vs 16 µs; bit-identical here), and the mixer / fusion stock matmuls, unary GELU and `ttnn.layer_norm` with L1 outputs were not bit-identical. L1 residency is safe and exact for the bundle's own `generic_op` kernels and for matmuls with explicit program configs; stock ops need a profile after the change (the first round-4 profile caught the 6-core linear).- **The operand build is write-bound at K = 1024**: running the GELU once instead of twice saves 1.6 µs at K = 512 but nothing at K = 1024 (not kept).- **Uneven block shards work**: X' `[352, ·]` over 6 shard rows of 64 (the last one half full) is read correctly by the sharded-in0 matmul and written correctly through the TensorAccessor of the generic_op writer.
## Round 5
Date 2026-10-10, plan `OPT_PLAN.md` §0.4 (item 1, exact compaction, decoder buckets first; item 2, the host items).The device was shared with METEOR and other bundles' jobs (several of this round's jobs waited for the lock behinda CenterPoint A/B); no job of this round hung, timed out or ran on a faulted chip. One gate job failed fast with ahost-side `TT_FATAL` (a slice end past the trimmed `cs` width: `ab_trim/gates_fail_slice.log`), fixed before anyA/B. The one new kernel shape (the split-row fp32 LN at W = 1024, Wt = 32 members per row, which the r32 / r64 / r96buckets use for the final-layer LN) went through the hang protocol first: `TT_METAL_WATCHER=2`, rows 32 and 96,eager twice and a 2-call trace, bit-identical to the one-core-per-row kernel (`opt_r5/ln1024_bringup.log`).
Method (`logs/diffusion-planner/opt_r5/`, scripts in `scripts/`): `compact_check.py` (one process with the buckettraces: every scene through the full `plan` and through its bucket, final_x0 on the needed rows, logits and the 11 egoiterates compared bit for bit, then b2b of every variant), `host_equiv.py` (old and new host package side by side on134 inputs: the `prepare` dataclasses, `plan_inputs` and six `make_output` calls per input with random andforce-stop trajectories and two parameter sets, compared byte for byte), then per step the device suite with thegates read-only and the per-scene report, and 3 alternating `bench.py` pairs on 3 scenes (`ab_*/`).
| A/B (same session, 3 pairs; kashiwanoha_dense / straight_road / scene-0103_kf14) | off: b2b ms | on: b2b ms | off -> on e2e p50 (kashiwanoha) | outputs | kept ||---|---|---|---|---|---|| `COMPACT` 0 / 1 (round-4 defaults) | 26.62 / 26.62 / 26.62 | 23.25 (r96) / 21.85 (r32) / 22.91 (r64) | 38.28 -> 33.79 | bit-identical on the read rows | yes || `COMPACT` 1 / 2 | 23.25 / 21.85 / 22.91 | 19.99 / 17.42 / 19.23 | 33.21 -> 30.14 | bit-identical on the read rows | yes || `HOST_FAST` 0 / 1 | 19.99 / 17.42 / 19.23 | 19.99 / 17.42 / 19.23 | 30.15 -> 27.31 (straight_road 27.05 -> 23.87, scene-0103 29.20 -> 26.22) | bit-exact host arrays | yes || `INPUT_TRIM` 0 / 1 | 19.99 / 17.42 / 19.23 | 20.00 / 17.44 / 19.25 | 27.22 -> 26.84 (host_in 1.95 -> 1.58, h2d 0.94 -> 0.76, pack 0.38 -> 0.52) | readback bit-identical | yes |
AICLK 1350 MHz (min 1343) in every run; the device rows repeat to ±0.003 ms within a session. The last A/B's `on`runs are the shipped defaults (`e933166`): 44 / 44 (`ab_trim/gates.log`), the 99 per-scene numbers identical torounds 3 / 4.
Per-bucket device time (`compact2_check.log`, b2b, before `INPUT_TRIM`'s +0.014 ms):
| variant | rows (decoder agents / neighbour entities) | b2b ms | 99 gate scenes in it ||---|---|---:|---:|| `plan_r32` | 32 | 17.42 | 53 || `plan_r64` | 64 | 19.24 | 44 || `plan_r96` | 96 | 19.99 | 2 || `plan_r128` / `plan_r192` | 128 / 192 | 21.11 / 22.30 | 0 || `plan` | 352 / 320 | 26.65 | 0 |
### Findings (measured)
- **Compaction is exact here and needs no new numerics.** Valid agents and valid neighbour tokens are a prefix in all 99 scenes, but the bucket does not rely on it: it covers the last needed row. The rows past R are masked self-attention keys (exp gives exact zeros, added in the same tile order) and invalid neighbour tokens (multiplied by `token_valid` = 0), so dropping them changes no read value. Every derived matmul config keeps the swept K blocking; only `per_core_M` is fitted, which leaves each output element's accumulation unchanged.- **The decoder is latency-bound, not row-bound.** From 352 to 96 rows the decoder blocks fall only 12.0 -> 9.5 ms (the profile below): its 616 programs per plan run at 8-43 µs each almost regardless of the row count (split-row LN 16.7 µs on 24 cores, self attention 15.9 µs, cross attention 43.3 µs on 24 cores, K = 256 matmuls 7.8-14.6 µs). Smaller buckets mostly remove the encoder's neighbour work (3.9 -> 1.5 ms for the trunk at r96) and the K = 1024 operand traffic. What remains is per-program latency: the MK-D megakernel's target.- **Host time halves with plain numpy.** The node-faithful loops (trajectory smoothing, per-tensor normalisation with boolean-mask assignment, all 320 neighbours denormalised and converted) cost 6.8 ms; the same arithmetic vectorised in the same float64 / float32 order costs 3.9 ms, byte for byte equal. `math.hypot` with three arguments stays a Python loop over 80 points (`np.hypot` rounds differently in the last bit).- **Upload trimming is small.** The tilization of the 19 inputs is ~1.6 ms of `host_in`; the all-zero test of every input costs 0.14 ms of `pack`, so the net gain is 0.37 ms e2e.
## Known hangs (all rounds)
| when (UTC) | command | cause | status ||---|---|---|---|| – | – | none: no hang, timeout, reset or FAULT marker in any device job of the port, the baseline, the release docs or rounds 1-5 (the FAULT markers of 2026-10-10 came from METEOR jobs of another agent; this bundle's queued jobs waited and resumed after the orchestrator cleared them). Round 3: one profile job was cancelled from this session before it ran (a `pkill` of its wrapper script); no FAULT, no device effect | – |
## Rejected / not kept
Round 4: `KCAT_ACT_ONCE` (bit-identical, +0.06 ms), `ENC_L1` (+1.67 ms, not bit-identical), `FUS_L1` (+0.39 ms, notbit-identical), `ATTN_L1=1` (the fusion q / kv linears with L1 outputs on 6 cores; superseded by `ATTN_L1=2`), theK = 256 split operands L1 block-sharded (`kl1_sweep.py`: −1.1 µs at N = 256 with K' padded 25 -> 32, slower at N =768 / 1024; not wired). All stay selectable (knobs) except the last.
Round 3: `LIN_ACT` (the mixer fc1 GELU in the matmul epilogue: −0.13 ms, 99-scene ego mean 0.149 -> 0.174 m, max0.327 -> 0.392 m; default 0, selectable) and `ATTN_SMSM=2` (the scale by an immediate in the smsm kernel:bit-identical, −0.03 ms; superseded by `ATTN_FUSED`, which uses that form).
Round 2: every A/B'd step was kept. Measured on the way and not used: the first `ATTN_SMASK` kernel (an exact fp32add of the mask) was not bit-identical, because it drops the TF32 truncation the stock fp32 + bf16 add applies(`smask_real.log`: every unmasked score differs); it was replaced by the truncating form before any A/B, and anexact-score variant remains a separate precision experiment. `LN_KERNEL=1` (per-tile unpacker / SFPU inits) is 2-4 %slower than `LN_KERNEL=2` at kernel level (`ln_real.json` vs `ln_lean.json`) and stays selectable.
Round 1 (measured, gates green, not kept because they are not bit-identical and raise the 99-scene error):
- `ATTN_FAST=3`, the attention scale as an SFPU pre-activation of the mask add (one program instead of two over the `[1, 8, Sq, Sk]` scores; sweep 75 -> 42 µs per call): −2.5 ms over mode 1, ego max 0.385 m / mean 0.173 m;- `ATTN_FAST=2`, the scale on Q before Q·Kᵀ: −1.97 ms, ego max 0.379 m / mean 0.172 m, neighbours 0.098 m.
Both stay selectable for timing. The round-2 fused attention kernel replaces these pieces anyway.
Earlier, configurations that were measured and are **not** the default, for accuracy (PORT_LOG decision 11,`OPT_BASELINE.md` "What the numerics defaults cost"):
- the first device round's defaults (split only for the mixer inputs and the decoder pre-projection, bf16 SDPA): 68.7 ms, but ego mean 0.347 m > 0.3 m on nuScenes scene-0103_kf14 (job 11);- configuration B (A + split and fp32 LayerNorm in the whole encoder): 109 ms, worst ego 0.35 / 0.15 m;- configuration C (split and fp32 LayerNorm everywhere): 169 ms, worst ego 0.22 / 0.10 m: about a third less error than the shipped configuration A (0.31 / 0.14 m, 105 ms in the same job 15) at +61 % device time (PORT_LOG open question 8);- the fastest graph (fused LayerNorm, no split, bf16 SDPA): 43.7 ms, fails the encoder PCC gate (`enc.ego` 0.99856 / 0.99261).
## Republish (2026-10-11)
Republish prep of the optimized release (no optimization step; evidence under `logs/diffusion-planner/republish/`):
| item | result ||---|---|| ttaw | re-vendored 0.23.0 -> 0.23.2 (common `60b6dd7`: Resize2d tail and `reshape_patch_present`, neither used by this model), `c91ce91`; host suite 108 passed / 45 skipped || tt-metal patches | the shared tree carries `patches/tt-metal-reshape-rm-sys1419.patch` since 2026-10-10 (every round-2..5 device number was measured with it); the bundle now ships it and the image build asserts its marker || device suite (gates read-only) on `bc966b4` | 44 passed; again 44 passed under `TT_METAL_TRACE_ALLOC_TRACKING=1`; 99 per-scene numbers identical to round 5 (`opt_r5/e2e_compact2.json`, 0 of 99 differ) || stage bench (100 iterations) | kashiwanoha_dense r96: b2b **20.00 ms**, one plan 20.05 ms, e2e p50 26.73 ms (p99 27.48), `.npz` path 32.27 ms; straight_road r32: 17.44 / 17.50 / 23.13 ms; scene-0103_kf14 r64: 19.25 / 19.30 / 25.65 ms; AICLK 1350 MHz (min 1343) || **fix `7e003c4`: `dispatch="worker"` crashed at capture** | found by this re-measure: the swept 2-D multicast configs of rounds 1-5 assume the 12-column ETH grid (decoder qkv: 12 output blocks on x), so the 11×10 WORKER grid, the A/B opt-in and the fallback without the ETH patch, failed with `TT_FATAL: Num output blocks along x (12) must be smaller than or equal to the number of columns in compute grid (11)`. Now each config is checked against `compute_with_storage_grid_size()` and falls back to the auto config (`mcast_fits`, host test `test_grid_fit_host.py`). ETH: unchanged configs, device suite 44 passed, 99 numbers identical. WORKER: `test_e2e_device.py` 2 passed with the same 99 numbers as ETH; b2b 20.61 ms (r96) / 18.01 ms (r32), 3 % slower than ETH || load / served | `from_pretrained` 352 s with an empty JIT cache (6 traces), 12.9 s warm; served `/predict` 37.2 ms median (`model()` 26.8 ms, JSON decode 8.6 ms), client round trip 41.6 ms, READY 13.0 s on the host; the bundle's `smoke_test.py` passes against the host server || accuracy re-checks | ORT oracle: 92 nuScenes instants worst ego max 0.346 m / mean 0.154 m, turn 92 / 92; scene-0061 sequence 0.112 / 0.055 m, 33 / 33; open loop ADE / FDE 4.75 / 11.87 m (CPU 4.74 / 11.87), blinker 88 / 92; neighbours of the shipped sample: per-agent max 8.6 cm median, 0.23 m p90, 3.72 m worst || media | the 13 renders of `media/` re-rendered from the optimized p150 outputs |
## Profile at the end (trace replay)
**After round 5** (`e933166`, the shipped defaults, the bench scene's bucket `plan_r96`;`logs/diffusion-planner/opt_r5/profile_r5final/`: `analyze.md`, `breakdown.md`, `ops_perf_results.csv.zst`): **1,418programs**, kernel sum **19.64 ms**, op-to-op gaps 0.89 ms, span 20.54 ms at 1.35 GHz (b2b 20.00 ms; replay ==eager). Stage groups: decoder blocks 9.49 ms (11 evaluations at 96 rows; 12.01 at 352), mixer blocks 5.66 ms (8.12),fusion 1.36 ms, mixer pre-projections 1.28 ms (2.08), decoder pre-projection 0.66 ms (1.03), solver 0.31 ms, the rest0.9 ms.
Largest remaining items (kernel time, share of the 20.5 ms span):
| item | ms | share | what limits it / next step ||---|---:|---:|---|| decoder split-row LNs with residual (154 programs on 24 cores, 16.7 µs) + final LNs | 2.58 + 0.34 | 14.2 % | gather / fold / broadcast latency, row-count independent; MK-D || map mixer trunks: lanes (140 entities) 2.41, line strings (60) 1.19, route (25) 0.61 | 4.21 | 20.5 % | full capacity in every scene (kashiwanoha: 123 / 60 / 17 valid; p50 scenes 100 / 30 / 6): map-entity compaction (est. −1.5 to −2 ms at p50 scenes, ~−0.4 ms on the bench scene) || mixer LNs (36 programs, 120 cores, 59 µs) | 2.13 | 10.4 % | DRAM-bound; MK-E || decoder cross attention (33 x 43.3 µs on 24 cores: 8 heads x 3 query tiles, 18 key tiles each) | 1.43 | 7.0 % | one core per (head, query tile): a key-split form with an ordered gather (bit-identical like the split LN) could use 4x the cores (est. −0.8 ms) || decoder K = 1024 split linears: matmuls 1.45 + operand builds 0.83 | 2.28 | 11.1 % | latency of 24-33-core programs at 96 rows; MK-D || decoder K = 256 split linears (qkv, out, mlp fc1, cross q / out) | 2.26 | 11.0 % | 7.8-14.6 µs per program; MK-D || mixer fc1 GELU programs | 0.71 | 3.5 % | bit-identical fusion needs a matmul epilogue that rounds to bf16 before the GELU || fusion attention (6 x 94 µs) | 0.57 | 2.8 % | – |
**After round 4** (`93428bb`, the shipped defaults; `logs/diffusion-planner/opt_r4/profile_r4final/`: `analyze.md`,`breakdown.md`, `ops_perf_results.csv.zst`): **1,411 programs**, kernel sum **26.00 ms**, op-to-op gaps 0.89 ms,span 26.89 ms at 1.35 GHz (b2b 26.62 ms). Stage groups: decoder blocks 12.01 ms (11 evaluations; 15.61 after round3), mixer blocks 8.12 ms, mixer pre-projections 2.08 ms, fusion 1.35 ms, decoder pre-projection 1.03 ms, solver 0.39ms, the rest 1.1 ms. (The first round-4 profile, `profile_r4final_c3b6a5a/`, showed the fusion at 1.74 ms: the6-core fusion linears fixed by `ATTN_L1=2`.)
Largest remaining items (kernel time, share of the 26.9 ms span):
| item | ms | share | what limits it / next step ||---|---:|---:|---|| decoder split-row LNs (4 per block) + fused self attention (88-core GenericOp group) | 4.02 | 14.9 % | gather / ordered fold / broadcast latency (~17-20 µs per LN); MK-D || mixer LNs (36 programs, 120 cores) | 3.11 | 11.6 % | DRAM-bound; L1 was slower (`ENC_L1`); MK-E || decoder K = 256 K-concatenated matmuls (qkv, out, mlp fc1, cross q / out) | 2.82 | 10.5 % | 10-18 µs on 48-72 cores; fp32 HiFi4 compute || decoder K = 1024 split linears: matmuls 1.61 + operand builds 1.27 | 2.88 | 10.7 % | the operand build is write-bound (3 tiles per input tile, gelu_tanh); in-kernel split matmul (MK-D phase) || mixer channel / token matmuls | ~2.6 | 9.7 % | bf16 / fp32 linears at 60-77 µs on 107-117 cores; MK-E || decoder cross attention | 1.11 | 4.1 % | 33.6 µs per call || mixer fc1 GELU programs | 1.04 | 3.9 % | bit-identical fusion needs a custom matmul epilogue (round to bf16 before the GELU) || 1024-wide final-layer LN (11 cores) | 0.66 | 2.4 % | a multi-tile split form (est. −0.3 ms: the 32-tile fold stays serial on the root) || pre-projections (operand builds 0.52, island glue 0.28, matmuls) | 2.08 | 7.7 % | – |
**After round 3** (`0b750e3`, the shipped defaults; `logs/diffusion-planner/opt_r3/profile_r3final/`: `analyze.md`,`breakdown.md`, `ops_perf_results.csv.zst`): **1,405 programs**, kernel sum **29.71 ms**, op-to-op gaps 0.88 ms,span 30.59 ms at 1.35 GHz (b2b 30.16 ms). Stage groups: decoder blocks 15.61 ms (11 evaluations), mixer blocks8.15 ms, mixer pre-projections 2.11 ms, fusion 1.41 ms, decoder pre-projection 1.05 ms, solver 0.39 ms, the rest1.0 ms. By op code: GenericOp 14.18 ms (438 programs), Matmul 11.90 ms (567), Unary 1.44 ms (114, mostly the mixerfc1 GELU), BinaryNg 1.08 ms (137), Transpose 0.21 ms (36, from 84).
Largest remaining items (kernel time, share of the 30.6 ms span):
| item | ms | share | what limits it / next step ||---|---:|---:|---|| decoder K = 1024 split linears (mlp fc2 x 2, final p4): matmul `[352, 3328] @ [3328, N]` on 48-66 cores + the operand build after the tanh GELU | 2.95 + 1.61 | 14.9 % | in0 is 4.7 MB of fp32 written and read per call; L1-sharded operand, bf16 `w_lo` (precision change), or the in-kernel split matmul (MK-D building block) || decoder split-row LayerNorms (4 per block, 88 cores) + the 1024-wide final LN (11 cores) | 2.75 + 0.40 + 0.67 | 12.5 % | latency-bound (gather / ordered fold / broadcast, ~20 µs per LN); MK-D || decoder fused attention (self 49, cross 59 µs) + fusion (103 µs) | 3.58 + 0.62 | 13.7 % | the stock softmax arithmetic on one tile row per core (88 of 120 cores busy); K / V re-read by 11 cores per head || decoder K = 256 split linears (qkv, out, mlp fc1, cross q / out) | 3.50 | 11.4 % | small matmuls (12-22 µs on 48-72 cores, configs from the round-2 sweep) || mixer LNs (24 programs, 120 cores) | 3.13 | 10.2 % | DRAM-bound (x, residual, h, y fp32); MK-E (entity block resident in L1) || mixer channel / token matmuls | ~2.6 | 8.5 % | bf16 / fp32 linears at 60-77 µs on 107-117 cores || mixer fc1 GELU programs | 1.05 | 3.4 % | a bit-identical fusion needs a custom matmul epilogue (round to bf16, then GELU); `LIN_ACT` (not bit-identical) rejected || pre-projections (12 operand builds, island glue, matmuls) | 2.11 | 6.9 % | – |
**After round 2** (`c42c540`, the shipped defaults; `logs/diffusion-planner/opt_r2/profile_r2final/`: `analyze.md`,`breakdown.md`, the per-program CSVs as `.zst`): **2,155 programs**, kernel sum **39.99 ms**, op-to-op gaps 1.47 ms,span 41.46 ms at 1.35 GHz (b2b 40.90 ms). Stage groups: decoder blocks 22.45 ms (11 evaluations), mixer blocks9.21 ms, mixer pre-projections 3.59 ms, fusion 2.31 ms, decoder pre-projection 1.05 ms, solver 0.38 ms, the rest1.0 ms.
| op code | after round 1 ms | after round 2 ms (programs) ||---|---:|---:|| Matmul | 18.1 | 16.28 (759) || GenericOp (the round-2 kernels) | – | 12.91 (612) || Softmax | 3.5 | 3.48 (72) || BinaryNg | 31.5 | 2.29 (209) || Unary / Typecast | 2.8 / 2.4 | 1.44 / 0.42 || Transpose (mixer token mixing) | 1.3 | 1.36 || Reduce (LN means) | 3.7 | 0.09 |
Largest remaining single items: the decoder softmax (2.97 ms, 66 x 45 µs on 88 cores), the mixer LN programs (2.88 mson 120 cores, DRAM-bound), the K = 1024 K-concatenated matmuls (2.94 ms) and their operand builds (1.62 ms), thedecoder LN programs (2.38 ms on 88 cores + 0.67 ms for the 1024-wide final-layer LN, which stays on 11 cores: 352rows x 32 tiles do not fit the split form), the score scale + mask passes (2.29 ms decoder + 0.37 ms fusion), theattention matmuls (3.40 ms), the encoder pre-projection split glue (1.23 ms BinaryNg) and the mixer transposes(1.16 ms).
**After round 1** (`dd6f249`, one traced replay under the device profiler, `logs/diffusion-planner/opt_r1/scripts/profile.sh`; numbers from the device-side per-program report `profile_r1/cpp_device_perf_report.csv.zst`,because the Tracy post-processing ran out of disk, see below): **6,282 programs** (unchanged: round 1 changed programconfigs, not the op graph), **kernel sum 65.06 ms** (was 99.27), span 70.96 ms at 1.35 GHz (b2b 70.12 ms).
| op code | baseline ms | after round 1 ms ||---|---:|---:|| BinaryNg (fp32 LN decomposition, split-matmul glue, attention scale / mask, residual adds, adaLN gates, solver) | 31.5 | **31.5** (48 % of the kernel sum) || Matmul | 52.3 | **18.1** || Reduce (LN means) | 3.7 | 3.7 || Softmax | 3.5 | 3.5 || Unary / Typecast | 2.8 / 2.4 | 2.8 / 2.4 || Transpose (mixer token mixing) | – | 1.3 |
The element-wise decompositions that the gates need are now the larger half of the plan: that is what the round-2L2 kernels (fused split matmul, fused fp32 LayerNorm, fp32 attention kernel; `OPT_PLAN.md` items 2-4) remove.
Disk incident: the Tracy run of the 6,282-program replay wrote 17 GB of raw logs (`tracy_ops_times.csv` 9.0 GB,`profile_log_device.csv` 7.4 GB) and filled the root disk while copying them into the report folder (09:06 UTC, afew minutes at 100 %). The partial copy was deleted at once and the raw logs compressed with zstd (17 GB -> 1.4 GB,`generated/profiler/diffusion-planner_opt_r1/.logs/`). Future profiles of this model: check free space first (> 25GB), and profile the replay only (the eager signposted pass doubles the logs).
The baseline profile (`OPT_BASELINE.md`): 6,282 programs, kernel sum 99.27 ms, span 103.66 ms; by op code Matmul52.3 ms (1,365 programs), BinaryNg 31.5 ms (2,948), Reduce 3.7 ms, Softmax 3.5 ms, Unary 2.8 ms, Typecast 2.4 ms. Theten slowest programs are the neighbour mixer's channel matmuls `[1, 320, 64, 128] @ [128, 128]`, ~970 µs each on 8cores.
## Remaining backlog (gains on the 102.0 ms replay unless marked e2e; estimates, not measurements)
Updated ranking on the 20.0 ms base (bucket r96) after round 5: `OPT_PLAN.md` §0.5. After round 4 it was §0.4. After round 3 it was §0.3 (the K = 1024 operand traffic, the decoderLN latency, then compaction, MK-E and MK-D; the table "After round 3" above). After round 2 it was §0.2 (all done inround 3 except the K = 1024 operand).The list below is the original one; items 1-5 are done or partly done (rounds 1-2).
From `OPT_BASELINE.md` "Ranked optimization opportunities". The gains are not additive: each item shrinks the base ofthe next.
1. **Encoder channel MLPs on 2-D activations (≈ −20 to −22 ms; exact rewrite, low effort).** The mixer `channels_mlp` and the channel pre-projections run `ttnn.linear` on 4-D `[1, E, T, C]` activations, a batched matmul on 4-8 cores (90 programs, 25.8 ms). A free `[1, 1, E·64, 128]` view for the MixerBlocks (as the token-mixing matmuls already do: 69 µs on 117 cores) and a re-tiled 2-D layout or an explicit multi-core program config (with the HiFi4 compute config: a `program_config` alone falls back to LoFi) for the pre-projections.2. **A fused split (bf16x3) matmul, one program per linear (≈ −17 to −19 ms).** 338 split linears are 2,802 programs and 34.8 ms today; a `generic_op` matmul that splits hi / lo on the fly and accumulates the three products in fp32 DEST removes the typecast / subtract / add programs (9.3 ms in the decoder) and shares the operand reads.3. **A fused fp32 LayerNorm, one program per LN (≈ −15 to −16 ms).** 237 LNs are 2,133 programs and 21.6 ms; the fused `ttnn.layer_norm` is ~2.5e-3 relative and fails the mixers (PORT_LOG job 5), so the kernel must keep fp32 statistics.4. **Attention (≈ −5.5 ms with stock ops, ≈ −12 to −13 ms with a fused kernel).** 72 fp32 matmul attentions, 16.4 ms: fold the 1/√32 scale into the Q weights and fuse the mask into the softmax (stock ops), spread the P·V matmuls over heads, or one fp32-accurate flash-attention `generic_op` (scores in L1, hi / lo operands).5. **Glue (≈ −3 to −4 ms).** Mixer transposes and residual adds, the adaLN gate multiplies (exact fold into per-step weight copies), the solver update as one program instead of 3-5.6. **Megakernels (D19; after 1-4).** MK-D, the persistent DiT-evaluation kernel (today 4.67 ms in ~435 programs for 12.0 GFLOP; its weights fit in L1; target 0.5-1 ms per evaluation, the decoder from 51 to ~6-11 ms); MK-E / MK-F for a mixer trunk / a fusion block; a single persistent megakernel for the whole plan is plausible (48 MB of weights and constants, the largest activation 10.5 MB, ~175 MB of aggregate L1). It ships only if faster with the gates intact; the attempt is recorded either way.7. **Compaction (LOAD-time buckets; 20-40 % of what remains after 1-4, to be measured).** The device time is scene-independent: kashiwanoha uses 88 / 320 neighbours and 89 / 352 decoder rows. Valid-entity buckets (one trace per bucket, exact compaction rewrites) shrink the encoder in proportion and the attention scores quadratically.8. **Host side (e2e ≈ −4 to −6 ms per request).** 15.8 ms of host work and transfers surround the replay: a 2-D `neighbor_x` upload (1.31 MB of TILE padding -> 245 KB), skipping the `y0` upload while `x_T` is zero and sending `cs` as its 4 columns (H2D 3.6 -> ~1.6 MB), vectorised per-entity loops in the pre- and post-processing.9. **Dispatch configuration: no gain today; re-measure after 1-5.** Re-run the ETH / WORKER and 1 / 2 CQ matrix once the program count drops below ~2,000; the ETH-2CQ penalty (+1.6 µs per program) needs a dispatch-core profile first.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210# diffusion-planner-p150: independent verification, 2026-10-08
## Verdict
**PASS.** This is the light verification pass of the first publish (`research/PLAN.md` §6.3): the frozen gates re-run,the baseline numbers re-checked, and every device-open path audited for ETH dispatch. It was made by the agent thatwrote the release docs, which is neither the porter nor the baseline agent, on commit `c0d84f9` (the `code/` of thisrepo: ttaw 0.20.0 vendored, the numerics knobs pinned in `serve.env`). Against the baseline commit `5541833`:
- **Accuracy:** the device suite passes (44 passed; again under alloc tracking), every gate value and all 99 per-scene end-to-end numbers identical to the baseline run and to the port's final run: worst ego 0.313 / 0.143 m (max / mean; gates 1.0 / 0.3 m), turn command 99 / 99, neighbours ≤ 0.086 m (gate 1.5 m).- **Independent oracle:** against the research pipeline's ONNX Runtime goldens, which the bundle's reference did not produce, all 92 / 92 nuScenes instants and 33 / 33 instants of the scene-0061 sequence pass the same gates (worst ego max 0.313 m).- **Speed:** the stage bench reproduces `OPT_BASELINE.md`: back-to-back replay 102.03 vs 102.04 ms, one plan 102.10 vs 102.13 ms; the host-bound end to end 115.6 vs 117.9 ms p50.- **Audit:** ETH dispatch, 1 CQ and the 12×10 grid on every device-open path; no fallback in any run.- **No numerics change** since the port: the diff `5541833..c0d84f9` is the ttaw re-vendor (0.17.1 -> 0.19.0 -> 0.20.0: on this bundle's path only `trace.py`'s `pack_outputs`, whose single-row layout for the planner's 117,664-element readback is unchanged), the `serve.env` pins of the numerics knobs (equal to the code defaults), two host-test changes, the quickstart picture and documentation. No gate threshold moved.
The full adversarial verification of the port is `VERIFY_PORT.md` of the porting workspace (round 1, 2026-10-08, PASSwith 9 low findings; not part of this repository): it re-ran every suite from a clean shell, audited the request path,the gates, the oracle chain and the Autoware fidelity line by line, compared the device with ONNX Runtime goldens thatthe bundle's own reference did not produce, and ran five adversarial scenes. Its results that this card relies on arequoted below, and its findings are resolved as listed in "Review findings".
## Setup
| item | value ||---|---|| Hardware | one Blackhole p150b, ETH dispatch, 1 CQ, 12×10 compute grid (120 cores), as printed by every run (`dispatch eth`, `fallback null`, `eth_patch true`) || tt-metal | `44d66500520` with `patches/tt-metal-eth-dispatch.patch` (sha256 `08d0ddf6…45cc`; the tree's `git diff` against `44d6650` is byte-identical to the patch: 4 files) || Weights | `AutowareFoundation/diffusion_planner` @ `423efde67f5414734da43a7ad856c17ceb8b51aa` (tag `v5.0`): the Python API, the quickstart and the server read them from the HF cache at the pinned revision (downloaded without a token, sha256 equal to the workspace copy, checked again at every load); the device tests from the workspace copy || Verified commit | `c0d84f9` (ttaw 0.20.0, `common` `89dec49`, vendored from the committed tree; `vendor.py --check`: 0 differences) || Baseline commit | `5541833` (`OPT_BASELINE.md`) || Workload | `code/tt_diffusion_planner/samples/kashiwanoha_dense.npz` (+ `straight_road.npz` and nuScenes scene-0103_kf14 for the stage bench), batch 1, warm; 99 scenes for the accuracy gates and 125 nuScenes instants for the oracle check (local only) || Bench method | `code/scripts/bench.py --iters 100 --warmup 5 --b2b-iters 50 --b2b-rounds 3`, one run, the three scenes of the baseline || Served method | uvicorn on the host with every `serve.env` pin of `tt-model.yaml` (the container's app and environment), 5 warm-up + 50 requests of the shipped sample from a loopback client || Accuracy reference | the fp32 CPU reference (`code/tt_diffusion_planner/reference/`), itself equal to ONNX Runtime on the shipped ONNX (48 tests, PORT_LOG 5.1); independently, the research pipeline's ONNX Runtime goldens || Host | AMD EPYC VM, 8 vCPUs, shared with other agents' jobs (load average 5.42, 7.45 during the runs); host-side stages move with it || Logs | `logs/diffusion-planner/docs/` of the workspace (job scripts in `scripts/`) |
## Measured baseline vs re-check
| measurement (shipped sample `kashiwanoha_dense` unless noted) | baseline `5541833` (`OPT_BASELINE.md`) | re-check `c0d84f9` | change ||---|---:|---:|---:|| back-to-back trace replays, per plan (p50) | 102.04 ms | 102.03 ms | -0.01 ms || device trace, one blocking plan (p50) | 102.13 ms | 102.10 ms | -0.04 ms || device trace, one blocking plan (min) | 102.05 ms | 102.03 ms | -0.02 ms || e2e `model(inputs=arrays)` p50 | 117.90 ms | 115.61 ms | -1.9 % || e2e `model(inputs=arrays)` p99 | 134.56 ms | 121.79 ms | -9.5 % || e2e `model(inputs=<.npz path>)` p50 | 124.76 ms | 118.77 ms | -4.8 % || host pre-processing | 4.75 ms | 3.91 ms | -17.8 % || pack (19 persistent inputs) | 0.45 ms | 0.40 ms | -11.8 % || host tensors (TILE) | 2.41 ms | 2.05 ms | -14.9 % || H2D | 1.14 ms | 0.94 ms | -17.1 % || D2H (one packed read) | 0.58 ms | 0.37 ms | -36.3 % || host post-processing | 4.32 ms | 3.60 ms | -16.7 % || back-to-back replays, `straight_road` | 102.04 ms | 102.04 ms | -0.00 ms || back-to-back replays, nuScenes scene-0103_kf14 | 102.04 ms | 102.04 ms | -0.00 ms || first call after `from_pretrained` | 118.20 ms | 114.79 ms | -2.9 % || `from_pretrained` load (warm JIT cache) | 11.64 s | 10.38 s | -10.8 % |
AICLK during the re-check: median 1350 MHz (min 1343, max 1350; 760 sysfs samples, sampled during the timed loops); the device rows reproduce the baseline to the 0.05 ms the baseline quotes, the host rows move with the load of the shared host.
Not in the baseline, measured for the card on `c0d84f9`:
| measurement | value ||---|---:|| `from_pretrained` load with an EMPTY JIT cache (firmware + every kernel compiled); first / second call | 314.6 s; 121 / 119 ms || `from_pretrained` load with that cache warm (new process); first / second call | 8.6 s; 120 / 120 ms || served `/predict` `timing_ms`, median of 50: decode · preprocess · device · postprocess · total | 8.6 · 3.8 · 105.3 · 3.3 · **123.1 ms** (min total 122.5) || served client round trip, loopback (median / min; request 0.15 MB) | 127.5 / 127.0 ms || server boot to ready (uvicorn, warm JIT cache) | 10.0 s || the bundle's `server/smoke_test.py` against it (the container smoke's check) | `PASS diffusion-planner-p150: profile=- variant=default dispatch=eth grid=12x10 cqs=1 n=80 turn=DISABLE reference=kashiwanoha_dense.reference.json (trajectory ade=0.0109 fde=0.0173; predicted_agents max_abs=6.283) device_ms=109.402 total_ms=133.384 rtt_ms=139.0` || served body vs the stored CPU reference (the smoke gates) | PASS ({"trajectory": {"n": 80, "ade": 0.01089988605897666, "fde": 0.017330320250936008}, "predicted_agents": {"max_abs_err": 6.282742738723755, "n": 35200}}); `predicted_agents` is reported, not gated: its largest difference is the yaw column at ±π (-3.1413 vs +3.1415 rad, the same heading) || the README's request recipe (`client.py --out req.json` + `curl`) | HTTP body with 80 poses, turn DISABLE; same trajectory as the client: True, same predicted agents: True || `examples/quickstart.py` as a user runs it (weights from the HF cache, offline, no token) | rc 0; turn DISABLE; `quickstart.json` and `quickstart_bev.png` written |
## Accuracy gate results
`test_pcc_device.py` + `test_e2e_device.py` on `c0d84f9`, one devrun job, `TTAW_GATES_READONLY=1`: 44 passed in 42.29s.Every value equals the baseline run (`OPT_BASELINE.md`, ttaw 0.17.1) and the port's final run (PORT_LOG job 19, ttaw0.11.0) to the printed precision, and all 99 per-scene end-to-end numbers are identical to both(`logs/diffusion-planner/docs/compare_runs.json`).
| gate (PLAN §2.12; `tests/*.gates.json`) | threshold | value ||---|---:|---:|| `enc.ego` PCC vs the fp32 reference (valid rows, 2 samples) | ≥ 0.999 | 0.999972 || `enc.neighbor` PCC vs the fp32 reference (valid rows, 2 samples) | ≥ 0.999 | 0.999952 || `enc.lane` PCC vs the fp32 reference (valid rows, 2 samples) | ≥ 0.999 | 0.999992 || `enc.route` PCC vs the fp32 reference (valid rows, 2 samples) | ≥ 0.999 | 0.999998 || `enc.polygon` PCC vs the fp32 reference (valid rows, 2 samples) | ≥ 0.999 | 0.999994 || `enc.line_string` PCC vs the fp32 reference (valid rows, 2 samples) | ≥ 0.999 | 0.999998 || `enc.goal` PCC vs the fp32 reference (valid rows, 2 samples) | ≥ 0.999 | 0.999991 || `enc.ego_shape` PCC vs the fp32 reference (valid rows, 2 samples) | ≥ 0.999 | 1 || `enc.turn` PCC vs the fp32 reference (valid rows, 2 samples) | ≥ 0.999 | 0.999995 || `enc.encoding` PCC (valid tokens) | ≥ 0.999 | 0.999978 || `dec.eval` PCC (teacher-forced decoder, min over 11 evaluations x 2 samples) | ≥ 0.999 | 1 (≥ 0.9999995) || `ego.max_err_m`, max over 99 scenes | ≤ 1.0 m | 0.313 m (nuscenes/scene-0103_kf14) || `ego.mean_err_m`, max over scenes | ≤ 0.3 m | 0.143 m (nuscenes/scene-0103_kf14) || `turn.command_agreement` | = 1.0 | 1.000 (99 / 99) || `neighbors.median_max_err_m`, max over scenes | ≤ 1.5 m | 0.086 m (kashiwanoha_dense) || diagnostics, .kashiwanoha_dense: `final_x0` valid-agent PCC; turn logits max abs | reported | 0.999994; 0.0398 || diagnostics, straight_road: `final_x0` valid-agent PCC; turn logits max abs | reported | 1.000000; 0.0372 || replay == eager (bit for bit); prefix constraint exact; API == `/predict` | equal | equal |
Distribution over the 99 scenes: ego mean displacement median 1.3 cm, 95th percentile 6.2 cm. Under `TT_METAL_TRACE_ALLOC_TRACKING=1` (no program compiled after the first capture): 44 passed in 40.50s.
Also re-run, CPU only: the host suite on the fake ttnn, 107 passed and 45 skipped (the 44 device tests and the ONNXRuntime module, which runs in the research venv), after the re-vendor and the test changes of `d521981` (0.20.0 re-vendored in `c0d84f9`).
### Against an independent oracle
The p150 outputs of the 92 nuScenes v1.0-mini planning instants and of the 33-plan scene-0061 sequence (2 Hz), producedthrough the public API (`model(inputs=...)`), compared with the research pipeline's ONNX Runtime goldens(`research/diffusion-planner/public_data/goldens/`: ORT 1.30 on the shipped ONNX files with an independent hostnormalization and solver port), with the PLAN §2.12 gates on the raw denormalised x0(`research/diffusion-planner/public_data/scripts/dp_public_metrics.py gates`):
| set | instants | all four gates pass | worst ego max | worst ego mean | worst neighbour median-max | turn command identical | logits max abs ||---|---:|---:|---:|---:|---:|---:|---:|| nuScenes v1.0-mini planning instants (1 Hz, all 10 scenes) | 92 | 92 / 92 | 0.313 m (scene-0103_kf14) | 0.143 m (scene-0103_kf14) | 0.082 m | 92 / 92 | 0.095 || scene-0061 sequence (2 Hz, the demo GIF) | 33 | 33 / 33 | 0.118 m (scene-0061_kf36) | 0.049 m (scene-0061_kf09) | 0.027 m | 33 / 33 | 0.074 |
`VERIFY_PORT.md` (round 1) also ran five adversarial scenes on the device against ONNX Runtime, which the stored goldensdo not cover (every golden has `x_T = 0` and at most 88 agents): full capacity (320 neighbours, 140 lanes, 25 routelanes, 10 polygons): ego 0.042 / 0.025 m (max / mean); ego only (every neighbour removed): 0.062 / 0.031 m; `x_T` = 0.5N(0, 1): 0.022 / 0.007 m; `x_T` = 1.0 N(0, 1): 0.067 / 0.031 m; an RTC prefix in the ego row of `x_T`: 0.024 / 0.012m; turn command equal and outputs finite on all five.
### Open-loop sanity metrics (not a planning metric)
The p150 plans of the 92 nuScenes instants against the logged drive, with the research metric script(`dp_public_metrics.py eval`), next to the CPU reference's numbers (`public_data/metrics/open_loop_cpu_fp32.json`). Themodel never saw nuScenes and the inputs have known gaps (no traffic-light states, no speed limits), so this is a sanitycheck against one human driver, not a paper metric:
| group (instants) | ADE@3s p150 / CPU | FDE@3s | ADE@8s | FDE@8s | constant velocity ADE@8s / FDE@8s | plan / logged length (m), p150 / CPU ||---|---:|---:|---:|---:|---:|---:|| all (92) | 1.12 / 1.12 | 2.60 / 2.59 | 4.75 / 4.74 | 11.87 / 11.87 | 4.99 / 13.06 | 37.5 / 37.5 vs 44.2 || moving (v0 >= 1 m/s) (69) | 1.42 / 1.41 | 3.27 / 3.26 | 5.88 / 5.88 | 14.50 / 14.51 | 6.56 / 17.21 | 48.5 / 48.5 vs 58.8 || mini_val (18) | 1.44 / 1.44 | 3.42 / 3.42 | 6.42 / 6.43 | 15.86 / 15.89 | 9.47 / 24.11 | 35.6 / 35.6 vs 38.0 || mini_train (74) | 1.04 / 1.04 | 2.40 / 2.39 | 4.34 / 4.33 | 10.90 / 10.89 | 3.90 / 10.37 | 38.0 / 38.0 vs 45.7 |
Turn-indicator command equal to the logged (debounced) blinker: p150 88 / 92, CPU 88 / 92. Moving plans (v0 ≥ 1 m/s) are 17 % shorter than the logged drive.
## Disclosed numerics changes
- None since the port. The configuration is decision 11 of `PORT_LOG.md`: fp32 residual streams and solver state; HiFi4 + fp32 accumulation for every matmul; the ego / neighbour pre-projection as a pad-relative fp32 island; split hi / lo matmuls (`DIFFUSION_PLANNER_SPLIT_MATMUL=enc.island.*,enc.pre.*,dec.*`); the fp32 LayerNorm decomposition (`_LN_FP32=enc.mixer.*,dec.*`); fp32 matmul attention (`_ATTN_MATMUL=enc.fusion.attn,dec.*`); the turn head in fp32; the other weights and the mixer / fusion hidden activations in bf16. This is the precision policy of PLAN.md §9.3 (HiFi4, fp32 accumulation, two-term or fp32 weights where the gates need them).- What the configuration costs (timing only, `OPT_BASELINE.md`): 33.4 ms per plan over the first device round's defaults, which fail `ego.mean_err_m` (0.347 m on nuScenes scene-0103_kf14, PORT_LOG job 11); 58.3 ms over the fastest graph, which fails `enc.ego`. The card names this cost as the first optimization target.- The knobs are now pinned in `serve.env` at these values, and a host test (`test_serve_env_pins_the_numerics`) checks the pins against `KNOBS.serve_env()`; the served `/info` reported the same options (null).
## Review findings
- **No gate loosened.** `tests/test_pcc_device.gates.json` and `tests/test_e2e_device.gates.json` are unchanged since `3223604` (the port's job 18 freeze); the thresholds equal PLAN §2.12; `GateRegistry` refuses a looser declaration and the runs used `TTAW_GATES_READONLY=1`.- **No cached or replayed outputs.** The gates compare trace replays with the fp32 CPU reference's goldens, the oracle check with ONNX Runtime goldens written by another pipeline; the only TT-vs-TT check is replay == eager (a trace correctness check, not an accuracy gate).- **The diff `5541833..c0d84f9`** touches no file of `tt_diffusion_planner/tt/`, `host/`, `reference/`, `api.py`, `device.py`, `io.py` or `server/`: the ttaw re-vendor, `tt-model.yaml` (`serve.env` pins), `examples/quickstart.py` and two host tests (`test_api_host.py`: the dead `test_build_says_what_is_missing` replaced by `test_build_refuses_unknown_compile_params`; `test_bundle_host.py`: `test_serve_env_pins_the_numerics`). The docs commit on top changes only documentation, media and `tt-model.yaml` comments, card text and one `verify:` line.- **No hang, timeout, reset or FAULT marker** in the device jobs of this pass.
Status of the `VERIFY_PORT.md` findings:
| # | finding | status ||---|---|---|| L1 | vendored ttaw outdated (0.11.0 vs common 0.15.1) | resolved: re-vendored 0.17.1 at the baseline step (`5541833`) then 0.19.0 (`d521981`) and 0.20.0 (`c0d84f9`) in this pass; the device suite after the first and the last gave identical gate values and per-scene numbers || L2 | numerics knobs not pinned in `serve.env`, no host test | resolved (`d521981`): the five knobs and an empty `DIFFUSION_PLANNER_PRECISION` pinned; `test_serve_env_pins_the_numerics` || L3 | publish documents outstanding; template text wrong for a planner | resolved: README, SERVING, PYTHON, OPT_BASELINE, OPT_REPORT, this file, the patch copy and the demo media; the card's risks rewritten; packaging, the container smoke, `build_info.json` and the push remain for the packaging step || L4 | dead test `test_build_says_what_is_missing` | resolved (`d521981`): replaced by a check that `_build` refuses unknown compile parameters || L5 | "6,408 programs" was a fake-ttnn op count | resolved: `OPT_BASELINE.md` quotes 6,282 programs per plan from the device profiler || L6 | op-count evidence only in a session scratchpad | resolved: `logs/diffusion-planner/opcount_fake_r2.log` || L7 | stateless API: hold window and `x_T` handling left to the client | resolved by documentation: README "Quickstart", `code/PYTHON.md` "What the caller keeps" (with the node's `TurnIndicatorManager` applied across calls), `SERVING.md` 3.5 || L8 | the bf16 SDPA path (`DIFFUSION_PLANNER_ATTN_MATMUL=none`) has no gate run since decision 11 | unchanged: it is not a shipped option (`serve.env` pins the matmul attention); PORT_LOG job 13 shows it fails the mean gate on scene-0103_kf14 together with the decoder split (0.74 / 0.33 m), and `OPT_BASELINE.md` times it only || L9 | C20 PCC range quoted as 0.99966-0.99983 | resolved in `PORT_LOG.md` (0.99961-0.99983 over all suite shapes, 0.99972-0.99983 at the planner's shapes); `ttaw/API.md` section 17 (common) keeps the old text until the next functional C20 change, as PORT_LOG section 9 says; the gate (0.9995) is unaffected |
## p150 ETH-dispatch compliance
| path | dispatch / CQs / grid ||---|---|| Python API `DiffusionPlanner.from_pretrained()` (`ttaw.api_base` → `tt_diffusion_planner.device.open_device`) | **ETH / 1 / 12×10** by default (`DeviceConfig.dispatch = "eth"`, `DEVICE_DEFAULTS["num_command_queues"] = 1`; `DIFFUSION_PLANNER_DISPATCH` / `_NUM_CQS` override). A failing ETH open falls back to WORKER with a `RuntimeWarning`, and `model.info["device"]["fallback"]` names it. Measured in this pass (quickstart, load times, demo runs): `dispatch eth`, `grid 12x10`, `fallback null` || HTTP server (`tt_diffusion_planner.server.app`, `config_from_env`) | ETH unless `DIFFUSION_PLANNER_DISPATCH` says otherwise; `/health` and `/info` report the device actually opened. Measured (served bench): `/info` `dispatch eth`, `grid 12x10`, `num_command_queues 1`, `fallback None` || `tt-model.yaml` serve env (one serve profile, the default) | `DIFFUSION_PLANNER_DISPATCH=eth`, `_NUM_CQS=1`, `_VARIANT=default` and the numerics pins; `check_bundle.py` refuses a profile whose `*_DISPATCH` is not `eth`; host tests check the pins against `device.py` and `tt/config.py` || image `verify:` | asserts the ETH-patch marker `single_chip_arch_1cq_no_dispatch_s` in `/opt/tt-metal/tt_metal/impl/dispatch/topology.cpp` and that ttaw sees the patch (`eth_dispatch_patch_present`) || container smoke (the one serve profile) | `server/smoke_test.py` asserts `/info` = `eth` / `12x10` (constants, not options) and the profile's pins (dispatch, CQs, variant, weights revision), and compares the served plan with the stored CPU reference; run against uvicorn on the host in this pass (`PASS diffusion-planner-p150: profile=- variant=default dispatch=eth grid=12x10 cqs=1 n=80 turn=DISABLE reference=kashiwanoha_dense.reference.json (trajectory ade=0.0109 fde=0.0173; predicted_agents max_abs=6.283) device_ms=109.402 total_ms=133.384 rtt_ms=139.0`); to be run on the built image by the packaging step || gate tests (`code/conftest.py`) | `open_device(..., allow_fallback=False)`: an ETH open that fails is an error, never a silent WORKER run || `code/scripts/bench.py`, `profile_ops.py` | `from_pretrained(dispatch=--dispatch or DIFFUSION_PLANNER_DISPATCH or eth)`; the JSON records the device actually opened (`fallback null` in every run); the WORKER rows of `OPT_BASELINE.md` were explicit A/B runs || `code/scripts/bringup_device.py`, `precision_exp.py`, `split_error.py` | `open_device(allow_fallback=False)` (ETH) || `examples/quickstart.py` | `from_pretrained(device_id=...)`: ETH / 1 / 12×10 (run in this pass) || vendored `ttaw` | 0.20.0 @ `89dec49`, `source_dirty: false`; `common/tools/vendor.py --check`: 0 differences; `check_bundle.py`: no drift warning || hard-coded grids | none: `tt/` sets no core grid or program config; the only grid consumer, C20's SDPA program config, reads `compute_with_storage_grid_size()` and is not on the default path (matmul attention) |
## Not covered by this pass
The container build, its smoke test on the built image, `build_info.json`, the HF pre-flight and the push (thepackaging step); the Python install through `pip install -e .` (the quickstart ran with `code/` on `PYTHONPATH`, thesame import path as the device tests); the dispatch / CQ matrix and the device profile (taken once, in`OPT_BASELINE.md`, on the same device code).123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157# diffusion-planner-p150: independent verification of the optimization rounds 1-5, 2026-10-11
## Verdict
**PASS** (3 low findings, none blocking). Every claim in `OPT_REPORT.md` that I re-measured reproduced on the devicefrom a clean checkout of `d9a0436` (the OPT round-5 HEAD), in one session with alternating runs against the publishedbaseline `b8114ec`:
- **Device suite (gates read-only):** 44 / 44 passed, run twice (`TTAW_GATES_READONLY=1`). All 99 per-scene numbers are identical to the round-5 record (`logs/diffusion-planner/opt_r5/e2e_compact2.json`, 0 of 99 differ): worst ego max 0.346 m, worst mean 0.154 m (gates 1.0 / 0.3 m), turn command 99 / 99, neighbours ≤ 0.094 m (gate 1.5 m).- **No gate loosened:** `test_e2e_device.gates.json`, `test_pcc_device.gates.json`, `test_e2e_device.py` and `test_pcc_device.py` are byte-identical between the published commit `b8114ec` and `d9a0436`.- **Speed:** the published baseline gave 102.03 ms back-to-back and 113.1 ms e2e. HEAD gives **20.00 ms** b2b and 26.8-27.2 ms e2e on the bench scene. Both match the claims (20.00 ms and 26.84 ms) to within 0.01 ms on the device and within host noise on e2e. The round-end commits r1 to r4 also reproduce to within 0.01 ms.- **Held-out (50 scenes outside the 99-scene gate set):** all 50 pass the four gates on HEAD. The set covers the 33-instant scene-0061 sequence, 4 adversarial scenes and 13 agent-bucket boundary scenes.- **Compaction is exact:** HEAD (`COMPACT=2`) and HEAD with `COMPACT=0` give bit-identical public outputs on all 50 held-out scenes. This includes the r128, r192 and full buckets, which no earlier check had covered.- **Soak:** 1,200 `model()` calls cycled over 6 scenes covering the r32, r64, r96, r128, r192 and full plans. There were 0 output mismatches against each scene's first output, no hang and no fault. The bench runs also replayed the traces back to back more than 1,350 times on HEAD.- **Host suite (fake ttnn):** 108 passed, 45 skipped (the 44 device tests and the ONNX Runtime module).
## Setup
| item | value ||---|---|| Verified commit | `d9a0436` (OPT round-5 HEAD), checked out as a clean `git worktree` (`dirty=0` printed by every job); the bundle's main working tree carries another agent's uncommitted round-6 work, which was **not** tested || Before | `b8114ec` (the published release, `PUSH_READY`); round-end commits `dd6f249` (r1), `c42c540` (r2), `0b750e3` (r3), `93428bb` (r4) || Configuration | shipped defaults: every `DIFFUSION_PLANNER_*` variable unset (the code defaults equal the `serve.env` pins, `test_serve_env_pins_the_numerics`). ETH dispatch, 1 CQ, 12×10, AICLK 1350 MHz (min 1343) in every run || Device hygiene | every device step ran through `bin/devrun` with explicit test files. `TT_METAL_DISPATCH_TIMEOUT_COMMAND_TO_EXECUTE`, `TT_METAL_OPERATION_TIMEOUT_SECONDS` and `TT_METAL_WATCHER` were unset; pytest used `-o faulthandler_timeout=900`. Device work began only after the orchestrator cleared the CenterPoint FAULT marker of 2026-10-10 20:31 (cleared 00:53 UTC) || Window | 2026-10-11 00:54-01:45 UTC, one session; host load 3.7-5.3 (shared host) || Logs / scripts | `logs/diffusion-planner/verify_opt_r1/` (workspace): `job.sh`, `driver.sh`, `gen_heldout.py`, `dev_heldout.py`, `cmp_heldout.py`, `sum_bench.py`, every log / JSON |
## Speed: same-session re-measurement
`code/scripts/bench.py --iters 30 --warmup 5 --b2b-iters 50 --b2b-rounds 3` was run on 3 scenes:`kashiwanoha_dense` (88 neighbours, bucket r96), `straight_road` (r32) and nuScenes `scene-0103_kf14` (r64). The runsalternated base / HEAD, 3 pairs, then r4 / HEAD-with-`COMPACT=0`, 2 pairs. Each value below is the median b2b; thespread is the range over the pairs.
| build | kashiwanoha b2b | straight_road b2b | scene-0103 b2b | one plan (trace) kashiwanoha | e2e p50 kashiwanoha | claimed in `OPT_REPORT.md` ||---|---:|---:|---:|---:|---:|---|| published `b8114ec` (3 runs) | 102.03 (±0.00) | 102.03 | 102.03 | 102.09 | 113.11-113.24 | 102.03 / 102.09 / 113.1 (same-session baseline) || r1 `dd6f249` | 70.12 | 70.12 | 70.12 | 70.17 | 80.93 | 70.12 / 70.18 / 81.2 || r2 `c42c540` | 40.89 | 40.89 | 40.89 | 40.95 | 51.77 | 40.89 / 40.95 / 51.98 || r3 `0b750e3` | 30.16 | 30.16 | 30.16 | 30.22 | 41.01 | 30.16 / 30.22 / 40.84 || r4 `93428bb` (2 runs) | 26.62 | 26.62 | 26.62 | 26.68-26.70 | 37.25-37.39 | 26.62 / 26.68 / 37.36 || HEAD `COMPACT=0` (2 runs) | 26.64 | 26.64 | 26.64 | 26.70 | 33.58-33.63 | +0.014 ms over r4 (INPUT_TRIM concat); host items −3.5 ms || **HEAD default (3 runs)** | **20.00** (r96) | **17.44** (r32) | **19.25** (r64) | 20.05-20.06 | **26.82-27.17** | 20.00 / 17.44 / 19.25; 20.06; 26.84 |
- Every device number reproduces the report to within ±0.02 ms.- Speed-up on the bench scene: **5.10×** b2b (102.03 -> 20.00 ms) and **4.2×** e2e (113.1 -> 26.9 ms).- `staged_equals_model` was true in every run: the staged path is bit-identical to `model()`.- Load cost: HEAD's warm `from_pretrained` takes 11.3-11.5 s, against 8.3-8.8 s for the base. HEAD captures 6 traces with 60.3 MB of trace buffers and 480 program-cache entries; the base has 74.6 MB and 309 entries.- `timing_ms.device` over the 99 gate scenes (from my suite run): p50 20.41 ms, range 20.19-26.77 ms. The report gives p50 20.83 ms. This value includes the upload, so it moves with host load.
## Accuracy
### Frozen gates (99 scenes + per-module PCC)
- 44 passed in 28.3 s (second run; the first run in the same window also passed).- The per-scene report (`suite_head.e2e.json`) matches `opt_r5/e2e_compact2.json` on all 99 scenes and all fields except device time.- The round-3 precision change (`ENC_KCAT`, 0.327 -> 0.346 m worst ego max) is therefore the current state, as reported.
### Held-out set: 50 scenes outside the 99-scene gate set
The CPU references come from the bundle's fp32 `ReferencePlanner` (CPU only, generated by `gen_heldout.py`). Thedevice outputs come from the public API, `model(inputs=raw)`, so the bucket is chosen per request. The gates are thesame as the e2e gates: ego max ≤ 1.0 m, ego mean ≤ 0.3 m, turn command equal, and neighbour median-of-max ≤ 1.5 m.
| set | n | HEAD: pass / worst ego max / worst mean / worst nb median | published `b8114ec`: worst ego max / mean / nb | HEAD vs HEAD `COMPACT=0` ||---|---:|---|---|---|| scene-0061 sequence (2 Hz), not in the gate set | 33 | 33 / 33; 0.112 m; 0.055 m; 0.027 m; turn 33 / 33 | 0.118; 0.049; 0.027 | 33 / 33 bit-identical || adversarial: full capacity (320 neighbours, 140 lanes, 25 route, 10 polygons), ego only, x_T = 0.5 N(0,1), x_T = 1.0 N(0,1) | 4 | 4 / 4; 0.058 m; 0.030 m; 0.101 m | 0.062; 0.031; 0.099 | 4 / 4 bit-identical || bucket boundaries: 31, 32, 63, 64, 95, 96, 127, 128, 191, 192 neighbours (variants r32, r64, r64, r96, r96, r128, r128, r192, r192, full), one far slot (100 -> r128, 319 -> full), 31 neighbours + x_T noise | 13 | 13 / 13; **0.507 m** (n192); 0.174 m; 0.076 m | 0.476 (n191); 0.164; 0.076 | 13 / 13 bit-identical |
- The precision changes of r2.3 (`SPLIT_KCAT`) and r3.2 (`ENC_KCAT`) hold on the held-out scenes.- Error moves both ways scene by scene, as the report describes. The worst case got worse on dense synthetic scenes: n192 went from 0.432 to 0.507 m and n128 from 0.340 to 0.361 m, still at about half the 1.0 m gate.- The worst neighbour max, which is not gated, is 6.3 m on HEAD against 5.8 m on the base, both on the dense synthetic scenes.
### Soak (default path)
- 1,200 `model()` calls in 33.9 s, cycled over 6 scenes: ego only (r32), scene-0061_kf14 (r64), temp05_kashi (r96), n127 (r128), n191 (r192) and full capacity (plan).- Each call's poses, predicted agents and turn command were compared byte for byte with that scene's first call: 0 mismatches.- `timing_ms.device` p50 24.0 ms, max 30.4 ms (full plan).- No hang, no fault marker, every devrun job rc = 0.
## Audit
| check | result ||---|---|| Gates loosened | none (the gate JSONs and the device test files are unchanged since the publish) || Defaults without an A/B row | none. All 26 knobs added by rounds 1-5 have an `OPT_REPORT.md` row. The four rejected ones (`LIN_ACT`, `KCAT_ACT_ONCE`, `ENC_L1`, `FUS_L1`) default to off, and the `serve.env` pins equal the code defaults (host test) || Custom kernels (P3) | every `generic_op` (fattn, ln32 / ln32s, kcat, smask, smsm) passes the per-core runtime-arg count (`N_RT`) as a compile-time arg; the per-core values are runtime args, the buffer addresses common runtime args || Bit-identity claims | r5.1 / r5.2 compaction re-checked on 50 new scenes (above); r1-r4 b2b numbers reproduce; the 99-scene numbers are identical to round 3, as claimed || Hangs / flakiness | none observed (2 suites, 3 held-out runs, 13 benches, 1,200-call soak) || Precision changes vs held-out | r2.3 and r3.2 pass the held-out set (above); not recorded by the optimizer (finding 2) |
## Findings
1. **(low, coverage) The device gate set does not exercise the r128, r192 and full-capacity traces.** - The 99 gate scenes fall in r32, r64 and r96 only (53 / 44 / 2), and `compact_check.py` covered the same three buckets. - Three of the six shipped traces therefore had no gate or bit-identity check before this verification. - They are correct today: they are bit-identical to `COMPACT=0` and within the gates on my boundary scenes. - A future change to a bucket config could still break them without any gate noticing. - Recommendation: add boundary scenes for every bucket to the e2e test as an additional case set. This adds coverage and does not loosen any threshold. Alternatively, run a `COMPACT=0` vs default bit-identity test over scenes that reach every bucket.2. **(low, process) No held-out check is recorded for the two kept precision changes (r2.3 `SPLIT_KCAT`, r3.2 `ENC_KCAT`).** - `OPT_PLAN.md` asks for one ("plus a 2-scene held-out check"), and the task rules ask for held-out frames on any precision change. - My 50-scene held-out run passes, so the changes stand. - The worst-case ego error on dense synthetic scenes grew from 0.48 to 0.51 m.3. **(info) The bundle's main working tree is dirty.** It holds another agent's uncommitted round-6 work (new `fattn_ks_*` kernels and edits to `config.py`, `decoder.py`, `encoder.py` and the ln32s kernels). Anyone who runs from that directory runs code that this verification did not cover. Everything here ran on clean worktrees of the commits named above.
## Reproduce
```bashS=<scratch>; R=/home/ubuntu/experiments/tt-models# clean worktrees under $S/wt/<name>/bundles/diffusion-planner-p150 with research/, assets/, common/ symlinked# next to bundles/ (the tests resolve the goldens as PKG.parents[3]/research)git -C $R/bundles/diffusion-planner-p150 worktree add --detach $S/wt/head/bundles/diffusion-planner-p150 d9a0436tools/research-venv/bin/python gen_heldout.py $S/wt/head/bundles/diffusion-planner-p150/code $S/heldout # CPUbash driver.sh # every device step via bin/devrun -t <s> -- bash job.sh <wt> suite|heldout|bench|soak <log> [ENV=..]python cmp_heldout.py; python sum_bench.py $S```
## Addendum: republish prep (2026-10-11, 01:50-02:25 UTC)
Re-checked on the code that is packaged for the optimized release, after this verification:
| step | commit | result | evidence (`logs/diffusion-planner/republish/`) ||---|---|---|---|| ttaw re-vendor 0.23.0 -> 0.23.2 (common `60b6dd7`) + the reshape-guard patch shipped | `c91ce91` | host suite 108 passed / 45 skipped; `vendor.py --check` 0 differences | `host_suite_v0232.log` || device suite, gates read-only, alloc tracking, quickstart, stage bench (3 scenes, 100 iterations) | `bc966b4` | 44 passed (twice); 99 per-scene numbers identical to round 5; b2b 20.00 / 17.44 / 19.25 ms, e2e p50 26.73 / 23.13 / 25.65 ms | `job1.out`, `device_suite.log`, `alloc_tracking.log`, `bench_recheck.json` || load times, 132 demo / agreement scenes, served bench | `bc966b4` | 352 s cold / 12.9 s warm; ORT oracle 92 / 92 and 33 / 33 within the gates; served 37.2 ms median, `smoke_test.py` PASS | `job2.out`, `load_*.json`, `gates_*_tt_vs_ort.json`, `served_bench.json` || **new finding (fixed)**: `dispatch="worker"` failed at capture (`TT_FATAL: Num output blocks along x (12) must be smaller than or equal to the number of columns in compute grid (11)`): swept matmul configs assumed the 12×10 ETH grid | `7e003c4` | ETH: 44 passed, 99 numbers identical (configs unchanged on 12×10). WORKER (11×10): `test_e2e_device.py` 2 passed, 99 numbers identical to ETH, b2b 20.61 ms (r96) / 18.01 ms (r32). Host suite 108 passed (+2 new host tests) | `job3.out`, `device_suite_fix.log`, `device_e2e_worker.log`, `bench_worker.log`, `host_suite_fix.log` |
The WORKER failure was outside the scope of the audit above (it covered the shipped ETH configuration only) andaffected only the A/B opt-in and the fallback for a tt-metal without the ETH patch; the published ETH numbers areunchanged by the fix.OPT_BASELINE.mdDeleted-561
OPT_REPORT.mdDeleted-691
VERIFICATION_2026-10-08.mdDeleted-210
VERIFICATION_OPT_2026-10-11.mdDeleted-157