[codex] Lower loop-bound array indices as i32#5310
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 |
554dcdd to
ec79e68
Compare
9667292 to
9bacb98
Compare
ec79e68 to
4a132f8
Compare
9bacb98 to
8a6db40
Compare
4a132f8 to
33e8555
Compare
8a6db40 to
2095f68
Compare
33e8555 to
d966c2c
Compare
2095f68 to
7f98910
Compare
d966c2c to
fd22011
Compare
8d1c99b
into
codex/perry-numeric-array-guard-precheck
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
xs[i * size + 1]inside ani < sizeloopWhy
After the numeric array guard precheck stack, matrix multiplication still spent work rebuilding hot indices like
i * size + kthrough double arithmetic before the typed-feedback get guard. Loop-bound analysis had already hoistedsizeas an i32 bound, but that slot was not visible to computed index lowering.Benchmark Notes
Stacked on
codex/perry-numeric-array-guard-precheck/ PR #5309.Baseline #5309:
This branch:
The wall-time signal is positive and the generated IR removes the double multiply/add index chain from the two hot matmul get sites. The single perf sample is mixed: instructions are slightly lower, while cycles and branch misses are slightly higher.
Validation
cargo fmt --checkgit diff --checkcargo 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-i32-index-proto --trace llvm --quietbenchmarks/quick.shbenchmarks/compare.sh --quick --runs 3 --warn-only --json-out /tmp/perry-i32-index-proto.json