# Broader cleanup sample, 2026-09-12

Reproducible sample: Python Random(20260913), 14 sorted Rust paths under crates, excluding /tests, /ipu-tests/, /bin/. Sampled sections and traced relevant callers; not a claim of exhaustive review.

- crates/ipu-codegen/src/estimate/tensor.rs
- crates/ipu-codegen/src/mid/optimistic/mod.rs
- crates/ipu-package/build.rs
- crates/ipu-codegen/src/place/dump.rs
- crates/ipu-codegen/src/graph/builder.rs
- crates/ipu-package/src/lib.rs
- crates/ipu-codegen/src/kernel/build.rs
- crates/ipu-codegen/src/storage.rs
- crates/ipu-exchange/src/lib.rs
- crates/ipu-codegen/src/storage/traversal.rs
- crates/ipu-codegen/src/place/exchange.rs
- crates/ipu-codegen/src/place/profile.rs
- crates/ipu-codegen/src/low/expand/materialize.rs
- crates/ipu-codegen/src/low/expand/mod.rs

Implemented findings:
- Kernel build duplicated the layernorm C++/assembly recipe and maintained a second inventory of kernels needing worker-stack support. Share the recipe and derive support from selected C++ compilations. Hand-written assembly workers do not reference those symbols.
- Copy and factor-view materialization repeated coordinate translation in five places. Share checked coordinate arithmetic; subtraction errors now return ExpansionError instead of panic/wrap.
- Package validation independently collected tile IDs twice. Reuse the uniqueness set for subsequent reference validation.

Reviewed without changing:
- axis_tree and axis_boxes have superficially similar recursion, but produce different representations/traversal orders; combining them would require an abstraction larger than the duplication.
- Test-only coordinate formulas in storage.rs are independent oracles for compact storage traversal. Retain them.
- Placement profile uses the shared allocation analysis, while its label/schema adapters belong to diagnostics.
- Optimistic mid graph types belong to the intentionally separate diagnostic search; they are not obsolete production planning adapters.
- Graph builder macro shares the public operation API across top-level and Repeat builders; replacing it alone would not simplify the data flow.
- Exchange instruction patch helpers have different acceptance rules; their small repeated opcode predicates are not enough reason to merge their behavior.

BS2 pinned search completed during this review: artifacts/bs2-search-20260912/model.ipuexe, hardware PASS, both reference inferences PASS, minimum FP32-reference cosine 0.993859265. This run predates this cleanup and the previous Repeat ownership fix.
