Commit 68ae496
Make flat_mode type-level to fix GPU compilation [perf]
F1's `flat_mode(data::DataLayout)` decided the leaf-access strategy in the value
domain, using a local `F = f_dim(data)` to slice `inferred_size(data)[F:end]`.
This constant-folds under CPU inference but could fail to fold under the weaker
device const-prop, leaving `_getidx_flat(flat_mode(data), ...)` a dynamic
dispatch that compiled the Val(2) property-view-root path (parentindices /
parent-of-parent) for unsupported layout types and emitted a runtime-checked
`getfield` (ijl_get_nth_field_checked) -> GPU InvalidIRError. This regressed the
Integrals (single_column_reduce!) and matrix-multiplication-recursion
(eager_copyto_stencil_kernel!) GPU jobs on the previous commit.
Redecide flat_mode entirely from the layout TYPE, mirroring `IndexStyle(::Type{D})`
(which is GPU-safe), and thread F as a `Val` type parameter so the
`inferred_size(D)[F:end]` slice is a compile-time literal. flat_mode is now a
guaranteed compile-time constant on every backend, so exactly one _getidx_flat /
_setidx_flat! method is compiled per concrete layout. Behavior is unchanged
(same Val(0/1/2) selection); CPU getindex/setindex remain checked-getfield-free
and the FD-stencil :kernel compile is unchanged (device-free checker).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent bd53967 commit 68ae496
1 file changed
Lines changed: 21 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
113 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
114 | 123 | | |
115 | 124 | | |
116 | 125 | | |
| |||
0 commit comments