Skip to content

Conversation

@yaoyaoding
Copy link
Member

@yaoyaoding yaoyaoding commented Dec 8, 2025

Previously, we use the following layout system for shared tensor:

axes: list[Var]
offset: Expr

where offset is an expression regards the axes.

This PR refactors the layout to a cute-like layout system:

shape: list[int]
mode_shape: list[int]
mode_strides: list[int]
swizzle: Optional[Swizzle]

For example, consider a shape of (64, 32), we can split the first dimension into two sub-dimensions (modes) of size 8 and 8, and the second dimension into two sub-dimensions (modes) of size 16 and 2. The mode shape would be (8, 8, 16, 2). We can have strides for each mode, for example, (256, 2, 16, 1). Then given the indices (i, j), we can compute the indices in the sub-dimensions (i1, i2, j1, j2) where i1 = i // 8, i2 = i % 8, j1 = j // 2, j2 = j % 2. The offset can be computed as:
offset = i1 * 256 + i2 * 2 + j1 * 16 + j2 * 1. To get the final offset in the shared tensor, we can use the formula:
(i, j) => ((i // 8) * 256) + ((i % 8) * 2) + ((j // 2) * 16) + ((j % 2) * 1).

@yaoyaoding yaoyaoding changed the title [Shared Layout] Refactor the shared layout system [Layout] Refactor the shared layout system Dec 8, 2025
@yaoyaoding yaoyaoding force-pushed the refactor-smem-layout branch from de6e426 to ab7bc61 Compare December 8, 2025 07:01
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
@yaoyaoding yaoyaoding force-pushed the refactor-smem-layout branch from baead80 to 9dd3e2b Compare December 8, 2025 07:25
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
Signed-off-by: Yaoyao Ding <[email protected]>
@yaoyaoding yaoyaoding merged commit 65d1a92 into main Dec 8, 2025
8 checks passed
@yaoyaoding yaoyaoding mentioned this pull request Dec 8, 2025
17 tasks
soodoshll pushed a commit to soodoshll/tilus that referenced this pull request Dec 15, 2025
soodoshll pushed a commit to soodoshll/tilus that referenced this pull request Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants