Skip to content

[AMDGPU][True16] fix a bug in codeGen causing e64 with wrong vgpr type to shrink #102942

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 4 commits into from
Aug 12, 2024

Conversation

broxigarchen
Copy link
Contributor

@broxigarchen broxigarchen commented Aug 12, 2024

This bug is introduced in #102198

The previous path change to use realTrue16 flag, however, we have some t16 instructions that are implemented with fake16, and has Lo128 registers types. Thus we should still using hasTrue16Bit flag for shrinking check

@llvmbot
Copy link
Member

llvmbot commented Aug 12, 2024

@llvm/pr-subscribers-backend-amdgpu

Author: Brox Chen (broxigarchen)

Changes

This bug is introduced in #102198


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

1 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp (+1-1)
diff --git a/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp b/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
index 155747551471e..5d38cafd73dd9 100644
--- a/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
+++ b/llvm/lib/Target/AMDGPU/SIShrinkInstructions.cpp
@@ -1048,7 +1048,7 @@ bool SIShrinkInstructions::runOnMachineFunction(MachineFunction &MF) {
               MachineFunctionProperties::Property::NoVRegs))
         continue;
 
-      if (ST->useRealTrue16Insts() && AMDGPU::isTrue16Inst(MI.getOpcode()) &&
+      if (ST->hasTrue16BitInsts() && AMDGPU::isTrue16Inst(MI.getOpcode()) &&
           !shouldShrinkTrue16(MI))
         continue;
 

Copy link
Contributor

@Sisyph Sisyph left a comment

Choose a reason for hiding this comment

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

LGTM. We can revert this part of the patch until all instructions are properly updated.

@jayfoad
Copy link
Contributor

jayfoad commented Aug 12, 2024

Can you include a test case?

@hanhanW
Copy link
Contributor

hanhanW commented Aug 12, 2024

Thanks, I verified that it fixes the issue in our project!

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.

Needs test

@broxigarchen
Copy link
Contributor Author

Needs test

Added a small test to verify and to prevent furture failure. Should be expanded when more true16 and fake16 instructions are supported

@broxigarchen broxigarchen force-pushed the main-merge-true16-swap-mov branch from 109eaf0 to 6fb5015 Compare August 12, 2024 19:47
@raikonenfnu raikonenfnu self-requested a review August 12, 2024 20:12
@Sisyph Sisyph merged commit 6b7afaa into llvm:main Aug 12, 2024
6 of 7 checks passed
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