@@ -191,21 +191,21 @@ Clearly, CuTe does not use arrays to store shapes or strides and the above code
191
191
192
192
#### Example 1 -- Reshape a layout into a matrix
193
193
194
- `20:2 o (5,4):(4,1)`.
194
+ `20:2 o (5,4):(4,1)`. Composition formulation.
195
195
196
196
This describes interpreting the layout `20:2`
197
197
as a 5x4 matrix in a row-major order.
198
198
199
- 1. ` = 20:2 o (5:4,4:1)`. Concatenation of sublayouts.
199
+ 1. ` = 20:2 o (5:4,4:1)`. Layout `(5,4):(4,1)` as concatenation of sublayouts.
200
200
201
201
2. ` = (20:2 o 5:4, 20:2 o 4:1)`. Left distributivity.
202
202
203
203
* `20:2 o 5:4 => 5:8`. Trivial case.
204
204
* `20:2 o 4:1 => 4:2`. Trivial case.
205
205
206
- 3. ` = (5:8, 4:2)`.
206
+ 3. ` = (5:8, 4:2)`. Composed Layout as concatenation of sublayouts.
207
207
208
- 4. ` = (5,4):(8,2)`. Concatenation of sublayouts .
208
+ 4. ` = (5,4):(8,2)`. Final composed layout .
209
209
210
210
#### Example 2 -- Reshape a layout into a matrix
211
211
@@ -214,18 +214,18 @@ as a 5x4 matrix in a row-major order.
214
214
This describes interpreting the layout `(10,2):(16,4)`
215
215
as a 5x4 matrix in a column-major order.
216
216
217
- 1. ` = (10,2):(16,4) o (5:1,4:5)`. Concatenation of sublayouts.
217
+ 1. ` = (10,2):(16,4) o (5:1,4:5)`. Layout `(5,4):(1,5)` as concatenation of sublayouts.
218
218
219
219
2. ` = ((10,2):(16,4) o 5:1, (10,2):(16,4) o 4:5)`. Left distributivity.
220
220
221
221
* `(10,2):(16,4) o 5:1 => (5,1):(16,4)`. Mod out the shape `5`.
222
222
* `(10,2):(16,4) o 4:5 => (2,2):(80,4)`. Div out the stride `5`.
223
223
224
- 3. ` = ((5,1):(16,4), (2,2):(80,4))`. Collect results .
224
+ 3. ` = ((5,1):(16,4), (2,2):(80,4))`. Composed Layout as concatenation of sublayouts .
225
225
226
226
4. ` = (5:16, (2,2):(80,4))`. By-mode coalesce.
227
227
228
- 5. ` = (5,(2,2))):(16,(80,4))`. Concatenation of sublayouts .
228
+ 5. ` = (5,(2,2))):(16,(80,4))`. Final composed layout .
229
229
230
230
We get exactly this result with CuTe
231
231
if we use compile-time shapes and strides.
0 commit comments