Commit 176df8a
committed
arena ToT: single-pass DistArray construction (drop buffering)
The arena-ToT construction paths pre-walked their cells twice: the
two-pass make_nested_tile invoked its source once to size each cell and
again to fill it, so callers with a single-pass source materialized the
whole outer tile into a temporary vector first. ArenaToTBuilder makes a
single ascending pass possible everywhere.
- make_nested_tile (arena_kernels.h): rebuilt on ArenaToTBuilder --
inner_range_fn and inner_fill_fn are now interleaved per cell instead
of two full passes; no separate all-ranges walk. Cells stay
zero-initialized so the no-op-fill (shape-only) path is unchanged.
- DistArray::make_arena_nested_tile: rebuilt on ArenaToTBuilder;
cell_source is invoked exactly once per cell in ascending order.
- DistArray::init_elements (arena branch): drops the std::vector<R>
that collected every inner tensor of the outer tile before building.
- DistArray::set(i, InIter) (arena branch): drops the std::vector that
buffered the single-pass iterator; it now feeds straight through.
- ArrayImpl retile (arena-ToT branch): builds each target tile with
ArenaToTBuilder, one source-cell lookup per cell instead of two.
Eliminates a peak-memory doubling during construction (the temporary
held the whole tile's data alongside the arena slab). foreach /
make_array were also reviewed: both are tile-type-agnostic (the result
tile is default-constructed and the user op populates it) -- no
two-pass machinery there, nothing to relax.1 parent 3372118 commit 176df8a
3 files changed
Lines changed: 69 additions & 77 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1001 | 1001 | | |
1002 | 1002 | | |
1003 | 1003 | | |
1004 | | - | |
1005 | 1004 | | |
1006 | 1005 | | |
1007 | 1006 | | |
| |||
1024 | 1023 | | |
1025 | 1024 | | |
1026 | 1025 | | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
1037 | | - | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
1042 | 1040 | | |
1043 | 1041 | | |
1044 | 1042 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
811 | 811 | | |
812 | 812 | | |
813 | 813 | | |
814 | | - | |
815 | | - | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
816 | 817 | | |
817 | 818 | | |
818 | | - | |
819 | | - | |
820 | | - | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
826 | 825 | | |
827 | 826 | | |
828 | 827 | | |
| |||
1165 | 1164 | | |
1166 | 1165 | | |
1167 | 1166 | | |
1168 | | - | |
1169 | | - | |
1170 | | - | |
1171 | | - | |
1172 | | - | |
1173 | | - | |
| 1167 | + | |
| 1168 | + | |
1174 | 1169 | | |
1175 | | - | |
1176 | | - | |
| 1170 | + | |
| 1171 | + | |
1177 | 1172 | | |
1178 | 1173 | | |
1179 | 1174 | | |
| |||
1927 | 1922 | | |
1928 | 1923 | | |
1929 | 1924 | | |
1930 | | - | |
1931 | | - | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
1932 | 1929 | | |
1933 | 1930 | | |
1934 | 1931 | | |
1935 | 1932 | | |
1936 | 1933 | | |
1937 | 1934 | | |
1938 | | - | |
1939 | | - | |
1940 | | - | |
1941 | | - | |
1942 | | - | |
1943 | | - | |
1944 | | - | |
1945 | | - | |
1946 | | - | |
1947 | | - | |
1948 | | - | |
1949 | | - | |
1950 | | - | |
1951 | | - | |
1952 | | - | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
1953 | 1950 | | |
1954 | 1951 | | |
1955 | 1952 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | 151 | | |
178 | 152 | | |
179 | 153 | | |
| |||
261 | 235 | | |
262 | 236 | | |
263 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
264 | 261 | | |
265 | 262 | | |
266 | 263 | | |
| |||
0 commit comments