Skip to content

Track A memo cut: per-module normalize+ownership memoization — resolve 371s→319s, both stages −95%, fingerprints byte-identical - #6539

Merged
briansrls merged 6 commits into
mainfrom
session/sleek-deer-172-resolve-memo
Jul 13, 2026
Merged

briansrls merged 6 commits into
mainfrom
session/sleek-deer-172-resolve-memo

Conversation

@gunbai-bot

@gunbai-bot gunbai-bot Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Track A memo cut: normalize + ownership per-module memoization (−52s of the receipted 371s)

The resolve-split receipt (#6535) priced two per-entry recomputations at ~15% of whole-corpus resolve: normalize (28.5s, 8%) and ownership (24.3s, 7%) — both pure per-module facts recomputed per entry at zero marginal information. This PR collapses them to first-touch-per-module within a worker.

Model first, then host cache (the typed_module_cache pattern)

  • Authority (src/v1/03_normalize.dag, src/v1/compile.dag): the per-module row of each stage's fold is factored into a named fn — normalize_module_diagnostics(m, source_indices) and module_ownership_proofs(m) — with normalize_graph / extract_ownership_proofs now folding over exactly those rows. Pure factoring; seed regenerated (regen_divergence_count=0).
  • Host (cli_run.rs): two MultiEntryIndex RefCell caches keyed by declaring-file path (the same in-process source-stability contract parse_cache/typed_module_cache ride; module_source_identity walls name↔file divergence loud). resolve_entry_with_parse_cache assembles diagnostics per module in authority order — a module with no bodied items contributes the same empty row the authority's filter skips, so the assembled list is identical by construction.

Receipts (all by execution)

  • Equivalence, controlled pair (same tree, only src/v1 differs): whole-tree probe PRE (main binary) vs POST — corpus_fingerprint=95da9a3c56e6bcaf, emit_graph_fingerprint=97a9b47b34c387e3, 1,104 modules — byte-identical. (The probe path bypasses the memo, so this isolates the authority refactor; the memo path's equivalence rides the full corpus below.)
  • Whole-corpus falsifier, memo live: EXIT=0 green, 1,776 witnesses, 0 skipped, governor healthy (width 9, forced_serial=0, hard_backoffs=0):
Stage Pre-memo (#6535 receipt) This PR
normalize 28,518ms 1,346ms (−95%)
ownership 24,263ms 1,168ms (−95%)
resolve total 371,096ms 318,956ms (−52.1s)
typecheck / reconcile_assembly 194.7s / 107.7s 197.4s / 104.2s (noise)
  • Battery: cargo test --release -p v1-compiler --lib 214 passed / 0 failed; regen_stage0 --verify divergence 0.

Note on an overlapping hunk

The branch carries the one-row nfr roster backfill also shipped standalone as #6541 (main is whole-corpus red without it — #6533 landed frontier_blocker_class_matches unrostered; my falsifier receipt above needs the row to run green). Whichever merges first, the other's hunk falls out cleanly.

Remaining Track A mass after this cut, per the receipt: typecheck cold computes (197s — cross-worker share, Inc B territory) and reconcile_assembly (104s — resolver-graph-major lane), both handed off with numbers.

🤖 Generated with Claude Code

briansrls and others added 6 commits July 13, 2026 20:31
@gunbai-bot gunbai-bot Bot changed the title corpus OOM Track A memo cut: per-module normalize+ownership memoization — resolve 371s→319s, both stages −95%, fingerprints byte-identical Jul 13, 2026
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review July 13, 2026 21:29
@briansrls
briansrls merged commit 590e2b3 into main Jul 13, 2026
7 of 8 checks passed
@briansrls
briansrls deleted the session/sleek-deer-172-resolve-memo branch July 13, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant