# Source reduction status

Baseline: `1501698`. Current: `b3b1bcd1`.

| Point | Non-test implementation lines | Change from baseline |
| --- | ---: | ---: |
| Before the structural refactor | 48,402 | 0 |
| Before the source-growth review | 51,070 | +2,668 |
| Current | 49,987 | +1,585 |

1,083 lines have been removed from the peak (41%). The net-reduction objective remains unmet. Recovering the remaining 1,585 lines would only reach the old size.

| Commit | Removed lines | Removed representation or path |
| --- | ---: | --- |
| `cb572e07` | 361 | Checkpoint migrations and deferred legacy choices |
| `f1976091` | 206 | Separate movement/cost geometry caches and selected copy templates |
| `c144c369` | 109 | Per-operation and Repeat-region cost annotations, dead region summaries |
| `677ba620` | 57 | Preallocated fragment outputs, output-binding reconciliation, returned-input copies |
| `d6dfa3f3` | 192 | Nested storage requirements, input-only fields on outputs, duplicate local-kernel choice |
| `7c04210c` | 120 | Unobserved plan-error type, temporary planned tensors and repeated layout resolution during feasibility checks |
| `b3b1bcd1` | 38 | Separate costing/insertion construction of operator boundaries and parameter homes; dead storage-group allocation wrapper |

Counts use the same AST-based counter throughout: comments, cfg(test) bodies, tests/benches and the ipu-tests benchmark crate are excluded. Source-file moves do not count as removals. Device assembly/C++ implementation is included. One-off measurement programs live under artifacts, outside the compiler.

## Validation

- Workspace tests passed after the operation-cost, fragment-result, planner-contract, and shared boundary-construction changes.
- The final feasibility change was checked against the previous predicate on every call exercised by the full codegen suite: 328 tests passed, 6 SDK/device tests ignored, and the doctest passed. The temporary comparison implementation was removed afterward.
- All workspace targets check successfully without warnings; formatting and whitespace checks pass.
- SDK saved-search save/resume regression passed. Search schema is now version 7; older checkpoints require a fresh search and have no migration path.
- Both small Repeat-3 MLP and FP8 ViT packages remain byte-identical after each slice. No duplicate hardware run was needed.
- The batch-2 Repeat-3 MLP expansion benchmark retains the same mid cost, low cost, row estimate, shard/kernel/copy counts and transfers in cold and warm runs. Latest mid cost is 1,379,388 cycles and low cost is 744,447 cycles.
- Latest eight-thread MLP sample: planning 16.09 s; warm expansion 1.574 s, recost 0.272 s, footprint analysis 0.644 s. These measurements do not establish a compilation speedup. The shared geometry cache's preceding matched sample was 16.25 s / 1.528 s / 0.257 s / 0.674 s respectively.

Validation logs are in /tmp/ipu-mid-cost-annotations-*, /tmp/ipu-fragment-results-*, /tmp/ipu-plan-contracts-* and /tmp/ipu-plan-validation-*; package comparisons and the final MLP measurement are under plan-validation/. Boundary-construction package checks and the pinned CLI are under boundary-construction/.
