Skip to content

[AMD][TDM] Verify descriptor and smem encodings#10372

Merged
antiagainst merged 6 commits into
triton-lang:mainfrom
binarman:fix_layout_tdm_copy
May 28, 2026
Merged

[AMD][TDM] Verify descriptor and smem encodings#10372
antiagainst merged 6 commits into
triton-lang:mainfrom
binarman:fix_layout_tdm_copy

Conversation

@alefimov-amd
Copy link
Copy Markdown
Contributor

This PR adds check that tensor descriptor and smem encodings are equal.

This PR adds check that tensor descriptor and smem encodings are equal.
if (failed(verifyResult))
return verifyResult;

if (tensorDescTy.getSharedLayout() &&
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Do we need explicit checking this first? Won't it automatically be checked at L653 if null attribute?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This additional condition skips the check if tensor descriptor do not have shared layout. I've added it because we have number of lit tests that do not care about both encodings and I did not want to change them. They have something like this: amdg.async_tdm_copy_local_to_global ...: !ttg.memdesc<128x64xf16, #shared> -> !tt.tensordesc<128x64xf16>.

I think this combination(one layout exists, second does not) is also illegal, but it will not go unnoticed in real applications. There are checks in other places: in gluon layout must be one of few particular classes, llvm lowering will simply crash.

My intent is to avoid confusing situations with two different encodings, because I've spend an hour debugging non-existent bug because of error in lit test yesterday.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not make this check strict just because I did not want to make lit tests too verbose, but if you think it worth it I can change this.

@antiagainst antiagainst marked this pull request as ready for review May 26, 2026 03:35
@alefimov-amd alefimov-amd force-pushed the fix_layout_tdm_copy branch from fa5dd9d to dba132a Compare May 26, 2026 12:29
@alefimov-amd alefimov-amd force-pushed the fix_layout_tdm_copy branch from dba132a to e782a85 Compare May 27, 2026 13:08
@alefimov-amd
Copy link
Copy Markdown
Contributor Author

I've made this check strict and adjusted lit tests, but removed checks from scatter/gather from this PR. I am not sure about some details, need to discuss operation design with the author first.

@alefimov-amd alefimov-amd force-pushed the fix_layout_tdm_copy branch from 9586233 to 0b6562e Compare May 28, 2026 11:39
@alefimov-amd alefimov-amd force-pushed the fix_layout_tdm_copy branch from 0b6562e to 2f365c4 Compare May 28, 2026 13:14
@alefimov-amd alefimov-amd requested a review from antiagainst May 28, 2026 14:17
@alefimov-amd
Copy link
Copy Markdown
Contributor Author

@antiagainst @zhanglx13 @ptillet
This PR is ready for review, PTAL

@antiagainst antiagainst merged commit 8631d02 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.

3 participants