Skip to content
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

AMDGPU: Use isWave[32|64] instead of comparing size value #117411

Merged

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Nov 23, 2024

No description provided.

@arsenm arsenm marked this pull request as ready for review November 23, 2024 03:05
@llvmbot
Copy link
Member

llvmbot commented Nov 23, 2024

@llvm/pr-subscribers-backend-amdgpu

Author: Matt Arsenault (arsenm)

Changes

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

3 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/SIISelLowering.cpp (+2-2)
  • (modified) llvm/lib/Target/AMDGPU/SIInstrInfo.cpp (+3-3)
  • (modified) llvm/lib/Target/AMDGPU/SIInstrInfo.td (+2-2)
diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
index e520dfff1016b2..73ca59fe320d27 100644
--- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
+++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp
@@ -16677,8 +16677,8 @@ SITargetLowering::getRegClassFor(MVT VT, bool isDivergent) const {
   const TargetRegisterClass *RC = TargetLoweringBase::getRegClassFor(VT, false);
   const SIRegisterInfo *TRI = Subtarget->getRegisterInfo();
   if (RC == &AMDGPU::VReg_1RegClass && !isDivergent)
-    return Subtarget->getWavefrontSize() == 64 ? &AMDGPU::SReg_64RegClass
-                                               : &AMDGPU::SReg_32RegClass;
+    return Subtarget->isWave64() ? &AMDGPU::SReg_64RegClass
+                                 : &AMDGPU::SReg_32RegClass;
   if (!TRI->isSGPRClass(RC) && !isDivergent)
     return TRI->getEquivalentSGPRClass(RC);
   if (TRI->isSGPRClass(RC) && isDivergent)
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index b7c008235fb7ae..74c840f5b3ba07 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -7699,8 +7699,8 @@ void SIInstrInfo::lowerSelect(SIInstrWorklist &Worklist, MachineInstr &Inst,
       // Insert a trivial select instead of creating a copy, because a copy from
       // SCC would semantically mean just copying a single bit, but we may need
       // the result to be a vector condition mask that needs preserving.
-      unsigned Opcode = (ST.getWavefrontSize() == 64) ? AMDGPU::S_CSELECT_B64
-                                                      : AMDGPU::S_CSELECT_B32;
+      unsigned Opcode =
+          ST.isWave64() ? AMDGPU::S_CSELECT_B64 : AMDGPU::S_CSELECT_B32;
       auto NewSelect =
           BuildMI(MBB, MII, DL, get(Opcode), NewCondReg).addImm(-1).addImm(0);
       NewSelect->getOperand(3).setIsUndef(Cond.isUndef());
@@ -8712,7 +8712,7 @@ uint64_t SIInstrInfo::getScratchRsrcWords23() const {
   }
 
   // IndexStride = 64 / 32.
-  uint64_t IndexStride = ST.getWavefrontSize() == 64 ? 3 : 2;
+  uint64_t IndexStride = ST.isWave64() ? 3 : 2;
   Rsrc23 |= IndexStride << AMDGPU::RSRC_INDEX_STRIDE_SHIFT;
 
   // If TID_ENABLE is set, DATA_FORMAT specifies stride bits [14:17].
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.td b/llvm/lib/Target/AMDGPU/SIInstrInfo.td
index 885f72494a8f68..78348b8fab0c6a 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.td
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.td
@@ -6,9 +6,9 @@
 //
 //===----------------------------------------------------------------------===//
 
-def isWave32 : Predicate<"Subtarget->getWavefrontSize() == 32">,
+def isWave32 : Predicate<"Subtarget->isWave32()">,
   AssemblerPredicate <(all_of FeatureWavefrontSize32)>;
-def isWave64 : Predicate<"Subtarget->getWavefrontSize() == 64">,
+def isWave64 : Predicate<"Subtarget->isWave64()">,
   AssemblerPredicate <(all_of FeatureWavefrontSize64)>;
 
 class AMDGPUMnemonicAlias<string From, string To, string VariantName = "">

Copy link
Contributor

@jhuber6 jhuber6 left a comment

Choose a reason for hiding this comment

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

LG

@arsenm arsenm force-pushed the users/arsenm/remove-wave64-feature-from-default-target branch from dad0898 to a9b9b65 Compare November 23, 2024 05:55
@arsenm arsenm force-pushed the users/arsenm/wavesize-check-iswavesize-instead-of-value branch from 7016169 to 7dfd593 Compare November 23, 2024 05:55
@arsenm arsenm force-pushed the users/arsenm/wavesize-check-iswavesize-instead-of-value branch from 7dfd593 to baa4dc1 Compare November 23, 2024 05:59
@arsenm arsenm force-pushed the users/arsenm/remove-wave64-feature-from-default-target branch from 0f6254a to 79ff6e6 Compare November 23, 2024 16:06
@arsenm arsenm force-pushed the users/arsenm/wavesize-check-iswavesize-instead-of-value branch from baa4dc1 to af7d891 Compare November 23, 2024 16:06
Copy link
Contributor Author

arsenm commented Nov 23, 2024

Merge activity

  • Nov 23, 12:16 PM EST: A user started a stack merge that includes this pull request via Graphite.
  • Nov 23, 12:28 PM EST: Graphite rebased this pull request as part of a merge.
  • Nov 23, 12:30 PM EST: A user merged this pull request with Graphite.

@arsenm arsenm force-pushed the users/arsenm/remove-wave64-feature-from-default-target branch from 79ff6e6 to 6fa5b9a Compare November 23, 2024 17:25
Base automatically changed from users/arsenm/remove-wave64-feature-from-default-target to main November 23, 2024 17:27
@arsenm arsenm force-pushed the users/arsenm/wavesize-check-iswavesize-instead-of-value branch from af7d891 to 149c84e Compare November 23, 2024 17:28
@arsenm arsenm merged commit 1944d19 into main Nov 23, 2024
4 of 8 checks passed
@arsenm arsenm deleted the users/arsenm/wavesize-check-iswavesize-instead-of-value branch November 23, 2024 17:31
huixie90 pushed a commit to huixie90/llvm-project that referenced this pull request Nov 23, 2024
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.

3 participants