[codex] Cache monomorphic array guard feedback#5307
Merged
proggeramlug merged 1 commit intoJun 18, 2026
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
8a0c6c1 to
6a01499
Compare
ed71efd to
452b8d8
Compare
6a01499 to
6b54bf6
Compare
452b8d8 to
f49be7c
Compare
6b54bf6 to
0f46886
Compare
f49be7c to
f1945a4
Compare
0f46886 to
3b00735
Compare
f1945a4 to
73d3794
Compare
3b00735 to
83aa967
Compare
3af96b7
into
codex/perry-numeric-array-direct-fastpath
3 checks passed
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 a small lock-free, direct-mapped fast cache for monomorphic array typed-feedback guard sites. The cache is seeded by the existing slow
guard_observepath and only fast-passes when the current array observation exactly matches the cached feedback key and the runtime contract guard is valid.Slow paths still update the typed-feedback registry, failures, megamorphic state, observations, fallback counters, and trace metadata. Trace snapshots merge cache fast-pass counts back into
observed_count, per-site guard passes, and by-guard totals.This is stacked on #5302.
Benchmark Evidence
Baseline at
ed71efde8585from #5302:41079519680quick.shmatrix: 1745ms / 28MBperf statmatrix: 28.04B instructions, 4.65B branches, 6.34B cyclesAfter this change:
41079519680quick.shmatrix: 1228ms / 30MBperf statmatrix: 16.74B instructions, 3.09B branches, 4.49B cyclesMeasured impact:
quick.shmatrix: 1745ms -> 1228ms, 29.6% fastercompare.sh --quick --runs 3 --warn-onlynested_loops median: 921ms -> 662ms, 28.1% fasterVerification
cargo fmt --checkgit diff --checkcargo test -p perry-runtime typed_feedbackcargo test -p perry-codegen --test typed_feedbackcargo test -p perry-codegen --test typed_shape_descriptorsPERRY_BIN=target/release/perry python3 tests/test_typed_feedback_runtime_evidence.pytests/test_benchmark_output_verifier.shcargo build --releasetarget/release/perry compile --no-cache benchmarks/suite/16_matrix_multiply.ts -o /tmp/perry-matrix-array-guard-cache-final --quietbenchmarks/quick.shbenchmarks/compare.sh --quick --runs 3 --warn-only --json-out /tmp/perry-array-guard-cache-final-ed71efde8.jsonNote:
benchmarks/baseline.jsonis stale for this Linux environment, so compare was run with--warn-onlyand the PR body uses the captured local #5302 baseline.