Skip to content

[AMDGPU][True16] set true16 mode as default on gfx110x #140736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2025

Conversation

broxigarchen
Copy link
Contributor

@broxigarchen broxigarchen commented May 20, 2025

Add RealTrue16Insts to FeatureISAVersion11_0_Common and set true16 mode as default on gfx110x.

@broxigarchen broxigarchen changed the title turn t16 as default on gfx1100 [AMDGPU][True16] turn on true16 mode as default on gfx1100 May 20, 2025
@broxigarchen broxigarchen changed the title [AMDGPU][True16] turn on true16 mode as default on gfx1100 [AMDGPU][True16] turn on true16 mode as default on gfx110x May 20, 2025
@broxigarchen broxigarchen changed the title [AMDGPU][True16] turn on true16 mode as default on gfx110x [AMDGPU][True16] set true16 mode as default on gfx110x May 20, 2025
@broxigarchen broxigarchen force-pushed the main-turn-true16-gfx1100 branch from 029c912 to d7c8994 Compare May 20, 2025 16:34
@broxigarchen broxigarchen marked this pull request as ready for review May 20, 2025 16:35
@broxigarchen broxigarchen requested review from Sisyph and kosarev May 20, 2025 16:35
@llvmbot
Copy link
Member

llvmbot commented May 20, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Brox Chen (broxigarchen)

Changes

Add RealTrue16Insts to FeatureISAVersion11_0_Common and set true16 mode as default on gfx110x


Full diff: https://github.com/llvm/llvm-project/pull/140736.diff

1 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/AMDGPU.td (+2-1)
diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td
index 764a7a9bf5e52..1120409de53a4 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPU.td
+++ b/llvm/lib/Target/AMDGPU/AMDGPU.td
@@ -1800,7 +1800,8 @@ def FeatureISAVersion11_0_Common : FeatureSet<
     [FeatureMSAALoadDstSelBug,
      FeatureVALUTransUseHazard,
      FeatureMADIntraFwdBug,
-     FeaturePrivEnabledTrap2NopBug])>;
+     FeaturePrivEnabledTrap2NopBug,
+     FeatureRealTrue16Insts])>;
 
 def FeatureISAVersion11_0_0 : FeatureSet<
   !listconcat(FeatureISAVersion11_0_Common.Features,

@broxigarchen broxigarchen requested a review from shiltian May 20, 2025 16:40
@broxigarchen
Copy link
Contributor Author

broxigarchen commented May 20, 2025

There are quite a number of changes being merged to enable the true16 mode on gfx11, and a set of tests are ran including lit test, cts test and performance test. We think it's the time now to try turning this mode on as default. Please let me know if there are still concerns to be address before merging this. Thanks!

@Sisyph Sisyph requested review from dstutt and rampitec May 20, 2025 18:57
@rampitec
Copy link
Collaborator

So what's about 16-bit inline asm constraints? Do we have it?

@broxigarchen
Copy link
Contributor Author

So what's about 16-bit inline asm constraints? Do we have it?

Hi Stanislav, is it the "f16 inline interpreted as 16bit value" issue you are pointing to?

@rampitec
Copy link
Collaborator

So what's about 16-bit inline asm constraints? Do we have it?

Hi Stanislav, is it the "f16 inline interpreted as 16bit value" issue you are pointing to?

If instruction needs VGPR_16 the constraint "v" will supply VGPR_32. I suspect inline asm will not work in this situation. At the very least it needs to be verified and tested.

@broxigarchen
Copy link
Contributor Author

So what's about 16-bit inline asm constraints? Do we have it?

Hi Stanislav, is it the "f16 inline interpreted as 16bit value" issue you are pointing to?

If instruction needs VGPR_16 the constraint "v" will supply VGPR_32. I suspect inline asm will not work in this situation. At the very least it needs to be verified and tested.

I see. Discussed offline with @Sisyph. I think the t16 mode asm inline is not yet supported. But I am not sure if it is blocking. The asm inline should still work with fake16 mode, and after this patch, the codegen can still be configured to use fake16 mode through the mattr setting, until when t16 inline is supported

@rampitec
Copy link
Collaborator

I see. Discussed offline with @Sisyph. I think the t16 mode asm inline is not yet supported. But I am not sure if it is blocking. The asm inline should still work with fake16 mode, and after this patch, the codegen can still be configured to use fake16 mode through the mattr setting, until when t16 inline is supported

I think it will be blocking, but it is not hard to add a new constraint.

@jayfoad
Copy link
Contributor

jayfoad commented May 21, 2025

What's the reason for restricting it to gfx110x? Are you just being cautious? Or are there known problems with gfx115x and gfx12?

@jayfoad jayfoad requested review from perlfu and piotrAMD May 21, 2025 12:04
@Sisyph
Copy link
Contributor

Sisyph commented May 21, 2025

What's the reason for restricting it to gfx110x? Are you just being cautious? Or are there known problems with gfx115x and gfx12?

There are known issues on both those subtargets.
For GFX115x, this is the only known issue. #138734
For GFX12, there are several things to implement, and it has not been tested yet.

@broxigarchen
Copy link
Contributor Author

I see. Discussed offline with @Sisyph. I think the t16 mode asm inline is not yet supported. But I am not sure if it is blocking. The asm inline should still work with fake16 mode, and after this patch, the codegen can still be configured to use fake16 mode through the mattr setting, until when t16 inline is supported

I think it will be blocking, but it is not hard to add a new constraint.

Opened a PR here #140946

@broxigarchen broxigarchen force-pushed the main-turn-true16-gfx1100 branch from d7c8994 to 9aaa68b Compare May 22, 2025 03:44
Copy link
Contributor

@arsenm arsenm left a comment

Choose a reason for hiding this comment

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

Missing test changes? I'd expect at least something would change that shows the default

@broxigarchen
Copy link
Contributor Author

broxigarchen commented May 22, 2025

Missing test changes? I'd expect at least something would change that shows the default

Hi Matt. Tests are handled seperately to address both true16 mode and non-true16 mode and the changes are merged already. We want this patch to be small so that if it hits some of the downstream branch it's easier to test and revert

@Sisyph
Copy link
Contributor

Sisyph commented May 22, 2025

Missing test changes? I'd expect at least something would change that shows the default

Hi Matt. Tests are handled and the changes are merged already. We want this patch to be small so that if it hits some of the downstream branch it's easier to test and revert

Do you WANT there to be a test change? We could have a small trivial test that shows the default. All the other tests have already been converted so they explicitly use +real-true16 or -real-true16 if there is a difference in output.

@arsenm
Copy link
Contributor

arsenm commented May 22, 2025

Do you WANT there to be a test change? We could have a small trivial test that shows the default. All the other tests have already been converted so they explicitly use +real-true16 or -real-true16 if there is a difference in output.

I guess but it doesn't really matter

@broxigarchen broxigarchen merged commit 04eaf61 into llvm:main May 27, 2025
9 of 11 checks passed
searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request May 28, 2025
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
Add RealTrue16Insts to FeatureISAVersion11_0_Common and set true16 mode
as default on gfx110x.
searlmc1 pushed a commit to ROCm/llvm-project that referenced this pull request Jun 5, 2025
llvm#140736 hit a failure in CI and
is reverted
096fe35
here. Reopen this patch

Also cherry-pick llvm#142822 which
address the issue. Updated the lit test

---------

Co-authored-by: Brox Chen <guochen2@amd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants