Commit 262c841
Report IndexLinear for contiguous-order DataLayouts [perf]
A DataLayout's IndexStyle now reports IndexLinear directly whenever a point's
linear index equals its parent array's linear index -- when there is at most
one dimension, a single component, or the F axis and every axis after it are
singleton -- instead of deferring to the parent array's IndexStyle in the
latter two cases. This is determined by the logical column-major shape, so it
holds for any parent array type. A contiguous property-view SubArray reports
IndexCartesian even though its linear order matches the layout's, so deferring
to it routed every linear point access through a needless CartesianIndices
conversion; reporting IndexLinear directly removes that conversion, which
shrinks the typed IR of each access and lowers compilation memory. The change
does not affect operator inlining, so it introduces no runtime regression, and
it never reports IndexLinear where a point's order differs from its parent's
(e.g. a multi-component layout with a non-singleton axis after F), which is
verified by a new correctness test.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent ef0a74e commit 262c841
2 files changed
Lines changed: 44 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
7 | 15 | | |
8 | | - | |
9 | | - | |
10 | | - | |
| 16 | + | |
| 17 | + | |
11 | 18 | | |
12 | 19 | | |
13 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
0 commit comments