Repository navigation
Add typed_module_cache retention measurement instrument (cache_walk + CacheWalkReport) - #5888
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both are diagnostic-only; dissolution trigger is func_env.sig Rc-sharing rising above 1.0× in corpus (the dedup PR, currently parked). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
Adds
cache_walkdiagnostic binary andCacheWalkReport/measure_caches()toMultiEntryIndexto measure typed_module_cache retention at full corpus scale. Motivated by the ~4 GiB floor peak: this instrument measures the 3-way split (retention-of-all-at-once vs replication vs genuine-distinct) across both source roots combined.SCAFFOLD — dissolution trigger: func_env.sig Rc-sharing > 1.0× in corpus (the dedup PR, currently parked on variant-owner grounding).
Retention measurement results
Runs against
--source-root src/v2 --source-root dslwith all 426*_test.dagentries:3-way split at saturation (981 modules, 4.17 GiB)
Retention-of-all-at-once (~96%) — dominant: all 981 typed module graphs held simultaneously (no eviction). The typed item subtrees (function bodies, expression trees) are genuinely distinct — eviction (Lever C) is the primary lever.
Replication via func_env.signatures (~4%, ~173 MiB) — secondary:
591,867 total / 591,867 distinct (1.0× sharing). Every Rc is a fresh allocation; each module re-allocates sigs from its entire transitive import closure rather than sharing the parent's Rc. Fix is the dedup PR (#5884, parked). Reference: TypeEnv.bindings already achieves 99.0× sharing (262,149 total / 2,648 distinct) — that's the target model.Genuine-distinct (irreducible) — 15,583 distinct typed items, 2,648 distinct TypeEnv bindings (already maximally shared), 981 distinct parse module nodes.
intern_table receipt — NOT a #5867 regression
distinct Rc<InternTable>: 4 at 5 entries (0.80/entry), 416 at 426 entries (0.977/entry) — ~1:1 per entry.Mechanism: when a
resolve_entry_with_indexcall interns new types,Rc::make_mut()sees strong-count > 1 (prior cached modules still hold their Rc to the existing table) and clones — leaving those modules frozen on Rc(N-1) while the new entry's modules get Rc(N). Within a singleresolve_entry_with_indexcall: all modules share exactly 1 intern_table throughout. This is what #5867 fixed, and it still holds.Conclusion: the 416 is cross-entry accumulation across a 426-entry single-process run. The floor's separate-process-per-shard model is NOT affected — each shard process resolves its entries independently and does not exhibit cross-entry sharing degradation. #5867 regression = NO.
How to run
VmHWM measurement: pipe through a
/proc/$PID/statuspoller (no/usr/bin/time -von runners);CTRL_BUILD_BYPASS_SHIMS=1bypasses the ctrl-build shim for local builds.Fixed-seed emit diff harness (for #5884 reference)
To verify #5884 is a no-op on emit output (requires grounding lane to land first):
The 24-file non-empty diff on the current #5884 is scope-driven (variant owner chosen by import order, not field type) — not a no-op until the variant-owner-by-expected-type grounding lane lands (stern-moth).
3 discriminating sites (right-vs-wrong per direction):
dsl/std/types.dag— baseline picksBoolFalseas owner via import scope; fix picksBoolTruevia field-type; structural diff in emitted enumdsl/std/integer.dag— baseline uses one ordering, fix another forIntVariantowners; both compile but emit different variant-ownership orderingdsl/extdeps/os/os.dag— baseline / fix swapPresent/Absentvariant ownership; semantically equivalent but different emitted RustTest plan
cargo fmt --all— clean (verified locally after each push)cargo clippy --all-targets -- -D warnings— passes in CIcargo nextest run— passes in CI.dagfiles touched; no substrate changes