Add compact strided TypeTree ranges for large arrays - #33
Closed
Dnreikronos wants to merge 1 commit into
Closed
Conversation
Dense per-element offsets waste memory and are dropped above
MaxTypeOffset (default 500), so mixed aggregates like
`{ i64, [f32; 1000] }` could not describe the final array element.
Introduce `start+stride*count` index syntax and first-class
StridedTypeRange storage so frontends can emit compact homogeneous
array regions that remain queryable past the offset cap.
Dnreikronos
force-pushed
the
typetree-strided-ranges
branch
from
August 11, 2026 16:21
eaa0656 to
5ce0a59
Compare
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
Dense per-element TypeTree offsets are impractical for large inline arrays and are dropped above Enzyme's
MaxTypeOffset(default 500). Mixed aggregates such as{ i64, [f32; 1000] }therefore could not describe the final array element, and a whole-region[-1]:Floatis wrong when a sibling field has another base type.This adds compact strided ranges:
{[-1,8+4*1000]:Float@float}meaning floats at8 + 4*kfork in 0..1000StridedTypeRangestorage (no per-element map keys)EnzymeTypeTreeInsertRangeEqC API for frontendsTypeAnalysis/stridedrange.llNeeded by rust-lang/rust#160701 so rustc can emit bounded inline-array metadata.
Test plan
enzyme/test/TypeAnalysis/stridedrange.llMade with Cursor