perf(hex-matrix): Submatrix views for the mulStrassen recursion#8734
Open
kim-em wants to merge 1 commit into
Open
perf(hex-matrix): Submatrix views for the mulStrassen recursion#8734kim-em wants to merge 1 commit into
kim-em wants to merge 1 commit into
Conversation
Add the Submatrix view type (Subarray-style: base matrix, row/col offsets, block dimensions; entry reads are offset arithmetic into the shared flat buffer) and rewire mulStrassen's internal recursion over views, so quadrants stop being materialized copies — generated C shows zero quadrant-copy allocations, with allocation remaining only for the operand sums, the seven products, padding, and leaf materialization for the unchanged baseMul signature. mulStrassen_eq_mul is re-proved via view-to-Matrix abstraction lemmas; the algorithm, its statement, and the three named correctness lemmas are untouched. The colAdd family moves from the materializing mapRows pass to flat per-entry column engines with unchanged public lemma statements. Cost model re-measured on the view recursion: cutoff sweep and scaling series within noise of the committed flat baseline (0.99-1.01x), so strassenDefault.cutoff stays at the measured 96; the committed exports and overlay figure record the outcome. Closes #8652. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR add the
Submatrixview type — named after Lean'sSubarray/Substring: a base matrix plus row/column offsets and block dimensions, whose entry reads are pure offset arithmetic into the shared flat buffer — and rewiremulStrassen's internal recursion over views, so quadrants stop being materialized copies (the generated C shows zero quadrant-copy allocations; allocation remains only for the operand sums, the seven recursive products, padding, and leaf materialization for the unchangedbaseMulsignature).mulStrassen_eq_mulis re-proved through view-to-Matrix abstraction lemmas with the algorithm, its statement, and the three named correctness lemmas untouched; thecolAdd/colAddRight/colSwapfamily moves from the materializingmapRowspass to flat per-entry column engines with unchanged public lemma statements; and the SPEC'sBlockViewmentions are renamed. The re-measured cost model is honestly neutral: the cutoff sweep and scaling series on the view recursion are within noise of the committed flat baseline (0.99–1.01× everywhere — the removed copies are O(n²) per level against O(n^2.81) multiply work, so they never dominated at benched sizes), sostrassenDefault.cutoffstays at the measured 96, with the committed exports and overlay figure recording the outcome. Whole-graph and root-invalidated builds green (4160 jobs), conformance green, nosorry/axiom/native_decide. Closes #8652.🤖 Prepared with Claude Code