@@ -111,21 +111,24 @@ end
111111end
112112
113113"""
114- store(arr::TileArray, index, tile::Tile) -> Nothing
114+ store(arr::TileArray, index, tile::Tile) -> Tile
115115
116116Store a tile to a TileArray at the given index. Index is 1-indexed.
117+ Returns the stored tile (enables chaining and helps constant folding).
117118"""
118119# Regular N-D tiles (N >= 1)
119120@inline function store (arr:: TileArray{T} , index, tile:: Tile{T, Shape} ) where {T, Shape}
120121 tv = Intrinsics. make_tensor_view (arr)
121122 pv = Intrinsics. make_partition_view (tv, Val (Shape), PaddingMode. Undetermined)
122123 Intrinsics. store_partition_view (pv, tile, (promote (index... ) .- One ()). .. )
124+ return tile # XXX : enables constant folding; remove when possible (see "constant folding" test)
123125end
124126
125127@inline function store (arr:: TileArray{T} , index:: Integer , tile:: Tile{T, Shape} ) where {T, Shape}
126128 tv = Intrinsics. make_tensor_view (arr)
127129 pv = Intrinsics. make_partition_view (tv, Val (Shape), PaddingMode. Undetermined)
128130 Intrinsics. store_partition_view (pv, tile, index - One ())
131+ return tile # XXX : enables constant folding; remove when possible (see "constant folding" test)
129132end
130133
131134# Special case for 0D (scalar) tiles - reshape to 1D for partition view
@@ -135,13 +138,15 @@ end
135138 tile_1d = Intrinsics. reshape (tile, Val ((1 ,)))
136139 pv = Intrinsics. make_partition_view (tv, Val ((1 ,)), PaddingMode. Undetermined)
137140 Intrinsics. store_partition_view (pv, tile_1d, (promote (index... ) .- One ()). .. )
141+ return tile # XXX : enables constant folding; remove when possible (see "constant folding" test)
138142end
139143
140144@inline function store (arr:: TileArray{T} , index:: Integer , tile:: Tile{T, ()} ) where {T}
141145 tv = Intrinsics. make_tensor_view (arr)
142146 tile_1d = Intrinsics. reshape (tile, Val ((1 ,)))
143147 pv = Intrinsics. make_partition_view (tv, Val ((1 ,)), PaddingMode. Undetermined)
144148 Intrinsics. store_partition_view (pv, tile_1d, index - One ())
149+ return tile # XXX : enables constant folding; remove when possible (see "constant folding" test)
145150end
146151
147152# Keyword argument version - dispatch to positional version
0 commit comments