Skip to content

[Gluon][Layout][AMD] Fix layoutToGluon() about handling PaddedSharedEncodingAttr's CGA-layout#10392

Merged
antiagainst merged 1 commit into
triton-lang:mainfrom
yangshuxin:shuxin/layoutToGluon
May 28, 2026
Merged

[Gluon][Layout][AMD] Fix layoutToGluon() about handling PaddedSharedEncodingAttr's CGA-layout#10392
antiagainst merged 1 commit into
triton-lang:mainfrom
yangshuxin:shuxin/layoutToGluon

Conversation

@yangshuxin
Copy link
Copy Markdown
Contributor

It is to the fix problem arises when layoutToGluon() converting a PaddedSharedEncodingAttr (w/ multicta) into a PaddedSharedLayout object.

Problem

Consider the case where PaddedSharedEncodingAttr has shape=[X, 128] and CGA-layout=[0,1],

  • Before the fix: PaddedSharedLayout.cga_layout is built directly from PaddedSharedEncodingAttr's "block" basis. It will be [0, 64=128/2]
  • After the fix: PaddedSharedLayout.cga_layout will be [0, 1]

The rationale can also be extrapolated from the PaddedSharedLayout::_to_ir() where the linear-layout is obtained by operator*(PaddedSharedLayout.offset_bases, PaddedSharedLayout.cga_layout) via function get_padded_shared_layout()

Test

  • command python3 -m pytest -v python/test/gluon/test_frontend.py::test_infer_layout_for_padded_shared
  • the ttgl.static_assert() in the kernel makes sure CGA layout is expected

…odingAttr's CGA-layout

It is to the fix problem arises when layoutToGluon() converting a PaddedSharedEncodingAttr (w/ multicta)
into a PaddedSharedLayout object.

Consider the case where PaddedSharedEncodingAttr has shape=[X, 128] and CGA-layout=[0,1],
  * Before the fix: PaddedSharedLayout.cga_layout is built directly from PaddedSharedEncodingAttr's "block" basis. It will be [0, 64=128/2]
  * After the fix: PaddedSharedLayout.cga_layout will be [0, 1]

The rationale can also be extrapolated from the `PaddedSharedLayout::_to_ir()` where
the linear-layout is obtained by `operator*(PaddedSharedLayout.offset_bases, PaddedSharedLayout.cga_layout)`
via function `get_padded_shared_layout()`

* command python3 -m pytest -v python/test/gluon/test_frontend.py::test_infer_layout_for_padded_shared
* ttgl.static_assert() in the kernel makes sure CGA layout is expected
@yangshuxin yangshuxin marked this pull request as ready for review May 27, 2026 19:29
@yangshuxin yangshuxin requested a review from peterbell10 as a code owner May 27, 2026 19:29
@antiagainst antiagainst merged commit a7512c9 into triton-lang:main May 28, 2026
10 checks passed
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