Skip to content

[NVPTX] Model SM architectures as subtarget features (NFC) - #214335

Merged
AlexMaclean merged 3 commits into
llvm:mainfrom
AlexMaclean:dev/amaclean/st-nvptx
Aug 7, 2026
Merged

AlexMaclean merged 3 commits into
llvm:mainfrom
AlexMaclean:dev/amaclean/st-nvptx

Conversation

@AlexMaclean

Copy link
Copy Markdown
Member

No description provided.

@llvmorg-github-actions

Copy link
Copy Markdown

@llvm/pr-subscribers-backend-nvptx

Author: Alex MacLean (AlexMaclean)

Changes

Patch is 123.97 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/214335.diff

9 Files Affected:

  • (modified) llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp (-3)
  • (modified) llvm/lib/Target/NVPTX/NVPTX.h (+3)
  • (modified) llvm/lib/Target/NVPTX/NVPTX.td (+87-76)
  • (modified) llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp (+5-4)
  • (modified) llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp (+36-35)
  • (modified) llvm/lib/Target/NVPTX/NVPTXInstrInfo.td (+50-78)
  • (modified) llvm/lib/Target/NVPTX/NVPTXIntrinsics.td (+170-170)
  • (modified) llvm/lib/Target/NVPTX/NVPTXSubtarget.cpp (+64-97)
  • (modified) llvm/lib/Target/NVPTX/NVPTXSubtarget.h (+91-123)
diff --git a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp
index 9db838523fdcd..7e5dbfcea5588 100644
--- a/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp
+++ b/llvm/lib/Target/NVPTX/MCTargetDesc/NVPTXInstPrinter.cpp
@@ -29,9 +29,6 @@ using namespace llvm;
 
 #define DEBUG_TYPE "asm-printer"
 
-#define GET_SUBTARGETINFO_ENUM
-#include "NVPTXGenSubtargetInfo.inc"
-
 #include "NVPTXGenAsmWriter.inc"
 
 static bool hasParamSubqualifiers(const MCSubtargetInfo &STI) {
diff --git a/llvm/lib/Target/NVPTX/NVPTX.h b/llvm/lib/Target/NVPTX/NVPTX.h
index 914295bf76e93..161afbc2be4ee 100644
--- a/llvm/lib/Target/NVPTX/NVPTX.h
+++ b/llvm/lib/Target/NVPTX/NVPTX.h
@@ -299,4 +299,7 @@ void initializeNVPTXDAGToDAGISelLegacyPass(PassRegistry &);
 #define GET_INSTRINFO_OPERAND_ENUM
 #include "NVPTXGenInstrInfo.inc"
 
+#define GET_SUBTARGETINFO_ENUM
+#include "NVPTXGenSubtargetInfo.inc"
+
 #endif
diff --git a/llvm/lib/Target/NVPTX/NVPTX.td b/llvm/lib/Target/NVPTX/NVPTX.td
index cb9aef2a1cd42..8804e5c57e5fc 100644
--- a/llvm/lib/Target/NVPTX/NVPTX.td
+++ b/llvm/lib/Target/NVPTX/NVPTX.td
@@ -14,100 +14,111 @@
 
 include "llvm/Target/Target.td"
 
-include "NVPTXRegisterInfo.td"
-include "NVPTXInstrInfo.td"
-
 //===----------------------------------------------------------------------===//
-// Subtarget Features.
-// - We use the SM version number instead of explicit feature table.
-// - Need at least one feature to avoid generating zero sized array by
-//   TableGen in NVPTXGenSubtarget.inc.
+// PTX ISA versions.
 //===----------------------------------------------------------------------===//
 
-class FeatureSM<string sm, int value>:
-   SubtargetFeature<"sm_"# sm, "FullSmVersion",
-                    "" # value,
-                    "Target SM " # sm>;
-
 class FeaturePTX<int version>:
    SubtargetFeature<"ptx"# version, "PTXVersion",
                     "" # version,
                     "Use PTX version " # version>;
-// NVPTX Architecture Hierarchy and Ordering:
-//
-// GPU architectures: sm_2Y/sm_3Y/sm_5Y/sm_6Y/sm_7Y/sm_8Y/sm_9Y/sm_10Y/sm_12Y
-// ('Y' represents version within the architecture)
-// The architectures have name of form sm_XYz where 'X' represent the generation
-// number, 'Y' represents the version within the architecture, and 'z' represents
-// the optional feature suffix.
-// If X1Y1 <= X2Y2, then GPU capabilities of sm_X1Y1 are included in sm_X2Y2.
-// For example, take sm_90 (9 represents 'X', 0 represents 'Y', and no feature
-// suffix) and sm_103 architectures (10 represents 'X', 3 represents 'Y', and no
-// feature suffix). Since 90 <= 103, sm_90 is compatible with sm_103.
-//
-// The family-specific variants have 'f' feature suffix and they follow
-// following order:
-// sm_X{Y2}f > sm_X{Y1}f iff Y2 > Y1
-// sm_XY{f} > sm_{XY}{}
-//
-// For example, take sm_100f (10 represents 'X', 0 represents 'Y', and 'f'
-// represents 'z') and sm_103f (10 represents 'X', 3 represents 'Y', and 'f'
-// represents 'z') architecture variants. Since Y1 < Y2, sm_100f is compatible with
-// sm_103f. Similarly based on the second rule, sm_90 is compatible with sm_103f.
+
+foreach version = [32, 40, 41, 42, 43, 50, 60, 61, 62, 63, 64, 65, 70, 71, 72,
+                   73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88,
+                   90, 91, 92, 93, 94] in
+  def PTX#version : FeaturePTX<version>;
+
+//===----------------------------------------------------------------------===//
+// Target architectures.
 //
-// Some counter examples, take sm_100f and sm_120f (12 represents 'X', 0
-// represents 'Y', and 'f' represents 'z') architecture variants. Since both
-// belongs to different family i.e. X1 != X2, sm_100f is not compatible with
-// sm_120f.
+// Architectures are named sm_XYz, where 'X' is the generation, 'Y' the version
+// within the generation, and 'z' an optional feature suffix. Together they form
+// a lattice, spelled out below as `Implies` edges: sm_A implies sm_B exactly
+// when PTX written against sm_B is accepted for sm_A. Every edge is listed
+// rather than leaning on `Implies` being transitive, which costs nothing
+// because a feature's implied set is a fixed-size bitset either way. Asking
+// whether a target may use what sm_B introduced is then a single bit test.
 //
-// The architecture-specific variants have 'a' feature suffix and they follow
-// following order:
-// sm_XY{a} > sm_XY{f} > sm_{XY}{}
+// The three tiers below are the three portability guarantees the PTX ISA
+// defines for a `.target`; see the .target directive in the PTX ISA manual.
 //
-// For example, take sm_103a (10 represents 'X', 3 represents 'Y', and 'a'
-// represents 'z'), sm_103f, and sm_103 architecture variants. The sm_103 is
-// compatible with sm_103a and sm_103f, and sm_103f is compatible with sm_103a.
+//  * Base architectures are portable: what they introduce is supported on all
+//    later architectures, including ones in other families. This is the "onion
+//    layer" model, and it makes them totally ordered by their number, so sm_120
+//    implies sm_110, which implies sm_107, and so on.
 //
-// Encoding := Arch * 10 + ArchSuffixOffset
-// Arch := X * 10 + Y
-// ArchSuffixOffset := 0 (base), 2 ('f'), or 3 ('a')
+//  * A family-specific variant sm_XYf is portable within its family only, so
+//    sm_103f implies sm_100f. A family is the set of architectures sharing an
+//    SM major version. There are no edges between families, which is what makes
+//    sm_120f and sm_100f incomparable.
 //
-// For example, sm_103a is encoded as 1033 (103 * 10 + 3) and sm_103f is
-// encoded as 1032 (103 * 10 + 2).
+//  * An architecture-specific variant sm_XYa is not portable at all, so
+//    sm_103a implies sm_103f and nothing implies sm_103a.
 //
-// This encoding allows simple partial ordering of the architectures.
-//  + Compare Family and Arch by dividing FullSMVersion by 100 and 10
-//    respectively before the comparison.
-//  + Compare within the family by comparing FullSMVersion, given both belongs to
-//    the same family.
-//  + Detect 'a' variants by checking FullSMVersion & 1.
+// There is deliberately no numeric encoding of an architecture. Asking whether a
+// target may use something is a bit test against the node that introduced it,
+// which is what the partial order above requires; a number would only invite the
+// ordered comparisons it cannot answer.
+//===----------------------------------------------------------------------===//
+
+class FeatureSM<list<SubtargetFeature> implies>:
+   SubtargetFeature<"sm_"# !substr(NAME, 2), "HasArchitecture", "true",
+                    "Target SM " # !substr(NAME, 2), implies>,
+   Predicate<"Subtarget->hasFeature(NVPTX::" # NAME # ")"> {
+  assert !eq(!substr(NAME, 0, 2), "SM"),
+         "architecture record " # NAME # " must be named SM<version>";
+}
+
 class Proc<FeatureSM SM>
  : Processor<SM.Name, NoItineraries, [SM]>;
 
-foreach sm = [20, 21, 30, 32, 35, 37, 50, 52, 53, 60,
-              61, 62, 70, 72, 75, 80, 86, 87, 88, 89,
-              90, 100, 101, 103, 107, 110, 120, 121] in {
-  // Base SM version (e.g. FullSMVersion for sm_100 is 1000)
-  def SM#sm : FeatureSM<""#sm, !mul(sm, 10)>;
-  def : Proc<!cast<FeatureSM>("SM"#sm)>;
-
-  // Family-specific variants, compatible within same family (e.g. sm_100f = 1002)
-  if !ge(sm, 100) then {
-    def SM#sm#f : FeatureSM<""#sm#"f", !add(!mul(sm, 10), 2)>;
-    def : Proc<!cast<FeatureSM>("SM"#sm#"f")>;
-  }
-
-  // Architecture-specific variants, incompatible across architectures (e.g. sm_100a = 1003)
-  if !ge(sm, 90) then {
-    def SM#sm#a : FeatureSM<""#sm#"a", !add(!mul(sm, 10), 3)>;
-    def : Proc<!cast<FeatureSM>("SM"#sm#"a")>;
-  }
+multiclass ProcSM<list<SubtargetFeature> implies> {
+  def NAME : FeatureSM<implies>;
+  def : Proc<!cast<FeatureSM>(NAME)>;
 }
 
-foreach version = [32, 40, 41, 42, 43, 50, 60, 61, 62, 63, 64, 65, 70, 71, 72,
-                   73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 86, 87, 88,
-                   90, 91, 92, 93, 94] in
-  def PTX#version : FeaturePTX<version>;
+// Base architectures, in increasing order. Each implies the features of every
+// earlier one.
+defvar SMVersions = [20, 21, 30, 32, 35, 37, 50, 52, 53, 60,
+                     61, 62, 70, 72, 75, 80, 86, 87, 88, 89,
+                     90, 100, 103, 107, 110, 120, 121];
+
+foreach sm = SMVersions in
+  defm SM#sm : ProcSM<!foreach(earlier, !filter(v, SMVersions, !lt(v, sm)),
+                               !cast<SubtargetFeature>("SM"#earlier))>;
+
+// Defines the family-specific ('f') and architecture-specific ('a') variants of
+// the base architecture this is named after.
+multiclass FeatureSMVariants<list<SubtargetFeature> EarlierInFamily> {
+  defm f : ProcSM<[!cast<SubtargetFeature>(NAME)] # EarlierInFamily>;
+  defm a : ProcSM<[!cast<SubtargetFeature>(NAME # "f")]>;
+}
+
+// The families, each listed in increasing order, mirroring the architecture
+// family table in the PTX ISA manual.
+defvar SMFamilies = [[100, 103, 107],  // sm_10x
+                     [110],            // sm_11x
+                     [120, 121]];      // sm_12x
+
+foreach Family = SMFamilies in
+  foreach sm = Family in
+    defm SM#sm : FeatureSMVariants<
+        !foreach(earlier, !filter(v, Family, !lt(v, sm)),
+                 !cast<SubtargetFeature>("SM" # earlier # "f"))>;
+
+// sm_90 predates family-specific variants, so sm_90a is the only member of the
+// sm_9x family and stands in for its 'f' variant, which does not exist.
+defm SM90a : ProcSM<[SM90]>;
+
+// sm_101 was the name PTX 8.6 through 8.8 used for what PTX 9.0 renamed to
+// sm_110. The two names describe the same hardware, so they share a node rather
+// than duplicating one.
+def : ProcessorAlias<"sm_101", "sm_110">;
+def : ProcessorAlias<"sm_101f", "sm_110f">;
+def : ProcessorAlias<"sm_101a", "sm_110a">;
+
+include "NVPTXRegisterInfo.td"
+include "NVPTXInstrInfo.td"
 
 def Is64Bit : Predicate<"Subtarget->getTargetTriple().getArch() == Triple::nvptx64">;
 def NVPTX64 : HwMode<[Is64Bit]>;
diff --git a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
index 2b676bc239d86..43c36648c4ed6 100644
--- a/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXAsmPrinter.cpp
@@ -989,7 +989,7 @@ void NVPTXAsmPrinter::emitKernelFunctionDirectives(const Function &F,
   const NVPTXTargetMachine &NTM = static_cast<const NVPTXTargetMachine &>(TM);
   const NVPTXSubtarget *STI = &NTM.getSubtarget<NVPTXSubtarget>(F);
 
-  if (STI->getSmVersion() >= 90) {
+  if (STI->hasFeature(NVPTX::SM90)) {
     const auto ClusterDim = getClusterDim(F);
     const bool BlocksAreClusters = hasBlocksAreClusters(F);
 
@@ -1232,7 +1232,8 @@ DwarfDebug *NVPTXAsmPrinter::createDwarfDebug() {
 bool NVPTXAsmPrinter::doInitialization(Module &M) {
   const NVPTXTargetMachine &NTM = static_cast<const NVPTXTargetMachine &>(TM);
   const NVPTXSubtarget &STI = *NTM.getSubtargetImpl();
-  if (M.alias_size() && (STI.getPTXVersion() < 63 || STI.getSmVersion() < 30))
+  if (M.alias_size() &&
+      (STI.getPTXVersion() < 63 || !STI.hasFeature(NVPTX::SM30)))
     report_fatal_error(".alias requires PTX version >= 6.3 and sm_30");
 
   // We need to call the parent's one explicitly.
@@ -1540,7 +1541,7 @@ void NVPTXAsmPrinter::emitPTXGlobalVariableDefinition(
   emitPTXAddressSpace(GVar->getAddressSpace(), O);
 
   if (isManaged(*GVar)) {
-    if (STI.getPTXVersion() < 40 || STI.getSmVersion() < 30)
+    if (STI.getPTXVersion() < 40 || !STI.hasFeature(NVPTX::SM30))
       report_fatal_error(
           ".attribute(.managed) requires PTX version >= 4.0 and sm_30");
     O << " .attribute(.managed)";
@@ -1839,7 +1840,7 @@ void NVPTXAsmPrinter::emitPTXGlobalVariable(const GlobalVariable *GVar,
   O << ".";
   emitPTXAddressSpace(GVar->getType()->getAddressSpace(), O);
   if (isManaged(*GVar)) {
-    if (STI.getPTXVersion() < 40 || STI.getSmVersion() < 30)
+    if (STI.getPTXVersion() < 40 || !STI.hasFeature(NVPTX::SM30))
       report_fatal_error(
           ".attribute(.managed) requires PTX version >= 4.0 and sm_30");
 
diff --git a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
index 29921ff86b352..e5c5050cac34f 100644
--- a/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
+++ b/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp
@@ -560,11 +560,11 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
     case ISD::FMINIMUM:
     case ISD::FMAXIMUMNUM:
     case ISD::FMINIMUMNUM:
-      IsOpSupported &= STI.getSmVersion() >= 80 && STI.getPTXVersion() >= 70;
+      IsOpSupported &= STI.hasFeature(NVPTX::SM80) && STI.getPTXVersion() >= 70;
       break;
     case ISD::FEXP2:
     case ISD::FTANH:
-      IsOpSupported &= STI.getSmVersion() >= 75 && STI.getPTXVersion() >= 70;
+      IsOpSupported &= STI.hasFeature(NVPTX::SM75) && STI.getPTXVersion() >= 70;
       break;
     }
     setOperationAction(Op, VT, IsOpSupported ? Action : NoF16Action);
@@ -587,7 +587,7 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
     case ISD::SMIN:
     case ISD::UMIN:
     case ISD::UMAX:
-      IsOpSupported = STI.getSmVersion() >= 90 && STI.getPTXVersion() >= 80;
+      IsOpSupported = STI.hasFeature(NVPTX::SM90) && STI.getPTXVersion() >= 80;
       break;
     }
     setOperationAction(Op, VT, IsOpSupported ? Action : NoI16x2Action);
@@ -618,7 +618,7 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
   setOperationAction(ISD::VECTOR_SHUFFLE, MVT::v2f16, Expand);
 
   setOperationAction(ISD::READCYCLECOUNTER, MVT::i64, Legal);
-  if (STI.getSmVersion() >= 30 && STI.getPTXVersion() > 31)
+  if (STI.hasFeature(NVPTX::SM30) && STI.getPTXVersion() > 31)
     setOperationAction(ISD::READSTEADYCOUNTER, MVT::i64, Legal);
 
   setFP16OperationAction(ISD::SETCC, MVT::f16, Legal, Promote);
@@ -953,7 +953,7 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
   }
 
   // f16/f16x2 neg was introduced in PTX 60, SM_53.
-  const bool IsFP16FP16x2NegAvailable = STI.getSmVersion() >= 53 &&
+  const bool IsFP16FP16x2NegAvailable = STI.hasFeature(NVPTX::SM53) &&
                                         STI.getPTXVersion() >= 60 &&
                                         STI.allowFP16Math();
   for (const auto &VT : {MVT::f16, MVT::v2f16})
@@ -979,10 +979,10 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
       AddPromotedToType(Op, MVT::bf16, MVT::f32);
   }
 
-  if (STI.getSmVersion() < 80 || STI.getPTXVersion() < 71) {
+  if (!STI.hasFeature(NVPTX::SM80) || STI.getPTXVersion() < 71) {
     setOperationAction(ISD::BF16_TO_FP, MVT::f32, Expand);
   }
-  if (STI.getSmVersion() < 90 || STI.getPTXVersion() < 78) {
+  if (!STI.hasFeature(NVPTX::SM90) || STI.getPTXVersion() < 78) {
     for (MVT VT : {MVT::bf16, MVT::f32, MVT::f64}) {
       setOperationAction(ISD::FP_EXTEND, VT, Custom);
       setOperationAction(ISD::FP_ROUND, VT, Custom);
@@ -996,7 +996,7 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
 
   // sm_80 only has conversions between f32 and bf16. Custom lower all other
   // bf16 conversions.
-  if (STI.getSmVersion() < 90 || STI.getPTXVersion() < 78) {
+  if (!STI.hasFeature(NVPTX::SM90) || STI.getPTXVersion() < 78) {
     for (MVT VT : {MVT::i1, MVT::i16, MVT::i32, MVT::i64}) {
       setOperationAction(
           {ISD::SINT_TO_FP, ISD::UINT_TO_FP, ISD::FP_TO_SINT, ISD::FP_TO_UINT},
@@ -1048,7 +1048,7 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
   // - f16/f16x2 (sm_75+, PTX 7.0+)
   // - bf16/bf16x2 (sm_90+, PTX 7.8+)
   // When f16/bf16 types aren't supported, they are promoted/expanded to f32.
-  if (STI.getSmVersion() >= 75 && STI.getPTXVersion() >= 70)
+  if (STI.hasFeature(NVPTX::SM75) && STI.getPTXVersion() >= 70)
     setOperationAction(ISD::FTANH, MVT::f32, Legal);
   setOperationAction(ISD::FTANH, MVT::v2f32, Expand);
 
@@ -1089,7 +1089,7 @@ NVPTXTargetLowering::NVPTXTargetLowering(const NVPTXTargetMachine &TM,
     setOperationAction(Op, MVT::v2f32, Expand);
   }
   bool SupportsF32MinMaxNaN =
-      STI.getSmVersion() >= 80 && STI.getPTXVersion() >= 70;
+      STI.hasFeature(NVPTX::SM80) && STI.getPTXVersion() >= 70;
   for (const auto &Op : {ISD::FMINIMUM, ISD::FMAXIMUM}) {
     setOperationAction(Op, MVT::f32, SupportsF32MinMaxNaN ? Legal : Expand);
     setFP16OperationAction(Op, MVT::f16, Legal, Expand);
@@ -1278,7 +1278,8 @@ static SDValue correctParamType(SDValue V, EVT ExpectedVT,
 SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
                                        SmallVectorImpl<SDValue> &InVals) const {
 
-  if (CLI.IsVarArg && (STI.getPTXVersion() < 60 || STI.getSmVersion() < 30))
+  if (CLI.IsVarArg &&
+      (STI.getPTXVersion() < 60 || !STI.hasFeature(NVPTX::SM30)))
     report_fatal_error(
         "Support for variadic functions (unsized array parameter) introduced "
         "in PTX ISA version 6.0 and requires target sm_30.");
@@ -1681,7 +1682,7 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
 SDValue NVPTXTargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
                                                      SelectionDAG &DAG) const {
 
-  if (STI.getPTXVersion() < 73 || STI.getSmVersion() < 52) {
+  if (STI.getPTXVersion() < 73 || !STI.hasFeature(NVPTX::SM52)) {
     const Function &Fn = DAG.getMachineFunction().getFunction();
 
     DAG.getContext()->diagnose(DiagnosticInfoUnsupported(
@@ -1722,7 +1723,7 @@ SDValue NVPTXTargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
 SDValue NVPTXTargetLowering::LowerSTACKRESTORE(SDValue Op,
                                                SelectionDAG &DAG) const {
   SDLoc DL(Op.getNode());
-  if (STI.getPTXVersion() < 73 || STI.getSmVersion() < 52) {
+  if (STI.getPTXVersion() < 73 || !STI.hasFeature(NVPTX::SM52)) {
     const Function &Fn = DAG.getMachineFunction().getFunction();
 
     DAG.getContext()->diagnose(DiagnosticInfoUnsupported(
@@ -1744,7 +1745,7 @@ SDValue NVPTXTargetLowering::LowerSTACKRESTORE(SDValue Op,
 SDValue NVPTXTargetLowering::LowerSTACKSAVE(SDValue Op,
                                             SelectionDAG &DAG) const {
   SDLoc DL(Op.getNode());
-  if (STI.getPTXVersion() < 73 || STI.getSmVersion() < 52) {
+  if (STI.getPTXVersion() < 73 || !STI.hasFeature(NVPTX::SM52)) {
     const Function &Fn = DAG.getMachineFunction().getFunction();
 
     DAG.getContext()->diagnose(DiagnosticInfoUnsupported(
@@ -1900,7 +1901,7 @@ SDValue NVPTXTargetLowering::LowerVECREDUCE(SDValue Op,
 
   // Whether we can use 3-input min/max when expanding the reduction.
   const bool CanUseMinMax3 =
-      EltTy == MVT::f32 && STI.getSmVersion() >= 100 &&
+      EltTy == MVT::f32 && STI.hasFeature(NVPTX::SM100) &&
       STI.getPTXVersion() >= 88 &&
       (Opcode == ISD::VECREDUCE_FMAX || Opcode == ISD::VECREDUCE_FMIN ||
        Opcode == ISD::VECREDUCE_FMAXIMUM || Opcode == ISD::VECREDUCE_FMINIMUM);
@@ -2124,7 +2125,7 @@ SDValue NVPTXTargetLowering::LowerShiftRightParts(SDValue Op,
   SDValue ShAmt  = Op.getOperand(2);
   unsigned Opc = (Op.getOpcode() == ISD::SRA_PARTS) ? ISD::SRA : ISD::SRL;
 
-  if (VTBits == 32 && STI.getSmVersion() >= 35) {
+  if (VTBits == 32 && STI.hasFeature(NVPTX::SM35)) {
     // For 32bit and sm35, we can use the funnel shift 'shf' instruction.
     // {dHi, dLo} = {aHi, aLo} >> Amt
     //   dHi = aHi >> Amt
@@ -2184,7 +2185,7 @@ SDValue NVPTXTargetLowering::LowerShiftLeftParts(SDValue Op,
   SDValue ShOpHi = Op.getOperand(1);
   SDValue ShAmt  = Op.getOperand(2);
 
-  if (VTBits == 32 && STI.getSmVersion() >= 35) {
+  if (VTBits == 32 && STI.hasFeature(NVPTX::SM35)) {
     // For 32bit and sm35, we can use the funnel shift 'shf' instruction.
     // {dHi, dLo} = {aHi, aLo} << Amt
     //   dHi = shf.l.clamp aLo, aHi, Amt
@@ -2359,7 +2360,7 @@ SDValue NVPTXTargetLowering::PromoteBinOpIfF32FTZ(SDValue Op,
 
 SDValue NVPTXTargetLowering::LowerINT_TO_FP(SDValue Op,
                                             SelectionDAG &DAG) const {
-  assert(STI.getSmVersion() < 90 || STI.getPTXVersion() < 78);
+  assert(!STI.hasFeature(NVPTX::SM90) || STI.getPTXVersion() < 78);
 
   if (Op.getValueType() == MVT::bf16) {
     SDLoc Loc(Op);
@@ -2375,7 +2376,7 @@ SDValue NVPTXTargetLowering...
[truncated]

@github-actions

github-actions Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

✅ With the latest revision this PR passed the C/C++ code formatter.

// than duplicating one.
def : ProcessorAlias<"sm_101", "sm_110">;
def : ProcessorAlias<"sm_101f", "sm_110f">;
def : ProcessorAlias<"sm_101a", "sm_110a">;

@durga4github durga4github Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So, this will generate .target as sm_110 (where we had sm_101 before) right?

I wonder why there are no updates to existing tests, corresponding to this change..

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So, this will generate .target as sm_110 (where we had sm_101 before) right?

No, there are 2 layers here which normally agree but diverge for the sm_101/sm_110 case. The .target directive is chosen by the "CPU" the user names. The feature set is determined by these TableGen features and processors. sm_101/sm_110 share the sm_110 feature set, simplifying feature selection predicates, but they don't share a name/enum value.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ah ok, thanks for clarifying!

@durga4github

Copy link
Copy Markdown
Contributor

The general direction LGTM, Alex! Please double-check once the sm-101/sm-110 (test) updates.

@durga4github durga4github left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@justinfargnoli

Copy link
Copy Markdown
Contributor

Could we do something similar for the PTX version as well, or is there something that blocks that?

@AlexMaclean
AlexMaclean force-pushed the dev/amaclean/st-nvptx branch from 2adacbe to ad6c1fa Compare August 6, 2026 19:41
@AlexMaclean
AlexMaclean enabled auto-merge (squash) August 6, 2026 19:50
@AlexMaclean
AlexMaclean merged commit 1b8dcb4 into llvm:main Aug 7, 2026
11 of 12 checks passed
@llvm-ci

llvm-ci commented Aug 7, 2026

Copy link
Copy Markdown

LLVM Buildbot has detected a new failure on builder amdgpu-clang-flang running on AMD-bb-w-05 while building llvm at step 3 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/234/builds/1664

Here is the relevant piece of the build log for the reference
Step 3 (annotate) failure: 'python ../llvm.src/offload/ci/openmp-offload-amdgpu-clang-flang.py ...' (failure)
...
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: libc/rpc_callback.cpp (798 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: libc/fwrite.c (799 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: libc/assert.c (800 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: libc/malloc.c (801 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: libc/server.c (802 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: mapping/auto_zero_copy_apu.cpp (803 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: jit/type_punning.c (804 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: libc/global_ctor_dtor.cpp (805 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: mapping/auto_zero_copy_globals.cpp (806 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: mapping/auto_zero_copy.cpp (807 of 1354)
FAIL: libomptarget :: amdgpu-amd-amdhsa :: offloading/xteam_atomic_reduction_usm.cpp (808 of 1354)
******************** TEST 'libomptarget :: amdgpu-amd-amdhsa :: offloading/xteam_atomic_reduction_usm.cpp' FAILED ********************
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 4
/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./bin/clang++ -fopenmp    -I /home/botworker/bbot/amdgpu-clang-flang/llvm.src/offload/test -I /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/openmp/runtime/src  -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib -Xoffload-linker -L/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/amdgpu-amd-amdhsa -Xoffload-linker -L/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/clang/24/lib/amdgpu-amd-amdhsa  -fopenmp-targets=amdgpu-amd-amdhsa /home/botworker/bbot/amdgpu-clang-flang/llvm.src/offload/test/offloading/xteam_atomic_reduction_usm.cpp -o /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/offload/test/amdgpu-amd-amdhsa/offloading/Output/xteam_atomic_reduction_usm.cpp.tmp -Xoffload-linker -lompdevice -fopenmp-force-usm    -fopenmp-target-atomic-reduction && env HSA_XNACK=1    /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/offload/test/amdgpu-amd-amdhsa/offloading/Output/xteam_atomic_reduction_usm.cpp.tmp | /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./bin/FileCheck /home/botworker/bbot/amdgpu-clang-flang/llvm.src/offload/test/offloading/xteam_atomic_reduction_usm.cpp
# executed command: /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./bin/clang++ -fopenmp -I /home/botworker/bbot/amdgpu-clang-flang/llvm.src/offload/test -I /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib -Xoffload-linker -L/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/amdgpu-amd-amdhsa -Xoffload-linker -L/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/clang/24/lib/amdgpu-amd-amdhsa -fopenmp-targets=amdgpu-amd-amdhsa /home/botworker/bbot/amdgpu-clang-flang/llvm.src/offload/test/offloading/xteam_atomic_reduction_usm.cpp -o /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/offload/test/amdgpu-amd-amdhsa/offloading/Output/xteam_atomic_reduction_usm.cpp.tmp -Xoffload-linker -lompdevice -fopenmp-force-usm -fopenmp-target-atomic-reduction
# note: command had no output on stdout or stderr
# executed command: env HSA_XNACK=1 /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/offload/test/amdgpu-amd-amdhsa/offloading/Output/xteam_atomic_reduction_usm.cpp.tmp
# .---command stderr------------
# | Display only launched kernel:
# | Kernel 'omp target in main @ 23 (__omp_offloading_fc00_4b294ff_main_l23)'
# | OFFLOAD ERROR: memory access fault by GPU 2 (agent 0x5cc28fb97440) at virtual address 0xc100000000. Reasons: Unknown (0)
# | Use 'OFFLOAD_TRACK_ALLOCATION_TRACES=true' to track device allocations
# `-----------------------------
# error: command failed with exit status: -6
# executed command: /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./bin/FileCheck /home/botworker/bbot/amdgpu-clang-flang/llvm.src/offload/test/offloading/xteam_atomic_reduction_usm.cpp
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./bin/FileCheck /home/botworker/bbot/amdgpu-clang-flang/llvm.src/offload/test/offloading/xteam_atomic_reduction_usm.cpp
# `-----------------------------
# error: command failed with exit status: 2

--

********************
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/is_initial_device.c (809 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_get_num_procs.c (810 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_host_pinned_memory_alloc.c (811 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_device_managed_memory_alloc.c (812 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_target_memcpy_async1.c (813 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_indirect_call.c (814 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_host_call.c (815 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_host_pinned_memory.c (816 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_target_memcpy_rect_async1.c (817 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_target_memcpy_async2.c (818 of 1354)
PASS: libomptarget :: amdgpu-amd-amdhsa :: unified_shared_memory/close_enter_exit.c (819 of 1354)
Step 9 (Add check check-offload) failure: Add check check-offload (failure)
...
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: libc/rpc_callback.cpp (798 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: libc/fwrite.c (799 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: libc/assert.c (800 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: libc/malloc.c (801 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: libc/server.c (802 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: mapping/auto_zero_copy_apu.cpp (803 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: jit/type_punning.c (804 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: libc/global_ctor_dtor.cpp (805 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: mapping/auto_zero_copy_globals.cpp (806 of 1354)
UNSUPPORTED: libomptarget :: x86_64-unknown-linux-gnu :: mapping/auto_zero_copy.cpp (807 of 1354)
FAIL: libomptarget :: amdgpu-amd-amdhsa :: offloading/xteam_atomic_reduction_usm.cpp (808 of 1354)
******************** TEST 'libomptarget :: amdgpu-amd-amdhsa :: offloading/xteam_atomic_reduction_usm.cpp' FAILED ********************
Exit Code: 2

Command Output (stdout):
--
# RUN: at line 4
/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./bin/clang++ -fopenmp    -I /home/botworker/bbot/amdgpu-clang-flang/llvm.src/offload/test -I /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/openmp/runtime/src  -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib -Xoffload-linker -L/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/amdgpu-amd-amdhsa -Xoffload-linker -L/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/clang/24/lib/amdgpu-amd-amdhsa  -fopenmp-targets=amdgpu-amd-amdhsa /home/botworker/bbot/amdgpu-clang-flang/llvm.src/offload/test/offloading/xteam_atomic_reduction_usm.cpp -o /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/offload/test/amdgpu-amd-amdhsa/offloading/Output/xteam_atomic_reduction_usm.cpp.tmp -Xoffload-linker -lompdevice -fopenmp-force-usm    -fopenmp-target-atomic-reduction && env HSA_XNACK=1    /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/offload/test/amdgpu-amd-amdhsa/offloading/Output/xteam_atomic_reduction_usm.cpp.tmp | /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./bin/FileCheck /home/botworker/bbot/amdgpu-clang-flang/llvm.src/offload/test/offloading/xteam_atomic_reduction_usm.cpp
# executed command: /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./bin/clang++ -fopenmp -I /home/botworker/bbot/amdgpu-clang-flang/llvm.src/offload/test -I /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib -L /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/openmp/runtime/src -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/x86_64-unknown-linux-gnu -Wl,-rpath,/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib -Xoffload-linker -L/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/amdgpu-amd-amdhsa -Xoffload-linker -L/home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./lib/clang/24/lib/amdgpu-amd-amdhsa -fopenmp-targets=amdgpu-amd-amdhsa /home/botworker/bbot/amdgpu-clang-flang/llvm.src/offload/test/offloading/xteam_atomic_reduction_usm.cpp -o /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/offload/test/amdgpu-amd-amdhsa/offloading/Output/xteam_atomic_reduction_usm.cpp.tmp -Xoffload-linker -lompdevice -fopenmp-force-usm -fopenmp-target-atomic-reduction
# note: command had no output on stdout or stderr
# executed command: env HSA_XNACK=1 /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/runtimes/runtimes-bins/offload/test/amdgpu-amd-amdhsa/offloading/Output/xteam_atomic_reduction_usm.cpp.tmp
# .---command stderr------------
# | Display only launched kernel:
# | Kernel 'omp target in main @ 23 (__omp_offloading_fc00_4b294ff_main_l23)'
# | OFFLOAD ERROR: memory access fault by GPU 2 (agent 0x5cc28fb97440) at virtual address 0xc100000000. Reasons: Unknown (0)
# | Use 'OFFLOAD_TRACK_ALLOCATION_TRACES=true' to track device allocations
# `-----------------------------
# error: command failed with exit status: -6
# executed command: /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./bin/FileCheck /home/botworker/bbot/amdgpu-clang-flang/llvm.src/offload/test/offloading/xteam_atomic_reduction_usm.cpp
# .---command stderr------------
# | FileCheck error: '<stdin>' is empty.
# | FileCheck command line:  /home/botworker/bbot/amdgpu-clang-flang/build/llvm.build/./bin/FileCheck /home/botworker/bbot/amdgpu-clang-flang/llvm.src/offload/test/offloading/xteam_atomic_reduction_usm.cpp
# `-----------------------------
# error: command failed with exit status: 2

--

********************
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/is_initial_device.c (809 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_get_num_procs.c (810 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_host_pinned_memory_alloc.c (811 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_device_managed_memory_alloc.c (812 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_target_memcpy_async1.c (813 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_indirect_call.c (814 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_host_call.c (815 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_host_pinned_memory.c (816 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_target_memcpy_rect_async1.c (817 of 1354)
PASS: libomptarget :: x86_64-unknown-linux-gnu :: api/omp_target_memcpy_async2.c (818 of 1354)
PASS: libomptarget :: amdgpu-amd-amdhsa :: unified_shared_memory/close_enter_exit.c (819 of 1354)

@rajatbajpai

Copy link
Copy Markdown
Contributor

LGTM, nice cleanup!

jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 7, 2026
…name, r=folkertdev

rustc_codegen_llvm: handle sm_101* features being an alias

LLVM 24 [moved sm_101{,a,f} features](llvm/llvm-project#214335) to just be an alias for the matching sm_110 feature. Since the sm_110 feature already exists, we can do the remapping unconditionally rather than gating it on LLVM 24.

@rustbot label: +llvm-main
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 7, 2026
…name, r=folkertdev

rustc_codegen_llvm: handle sm_101* features being an alias

LLVM 24 [moved sm_101{,a,f} features](llvm/llvm-project#214335) to just be an alias for the matching sm_110 feature. Since the sm_110 feature already exists, we can do the remapping unconditionally rather than gating it on LLVM 24.

@rustbot label: +llvm-main
pull Bot pushed a commit to LeeeeeeM/miri that referenced this pull request Aug 8, 2026
…olkertdev

rustc_codegen_llvm: handle sm_101* features being an alias

LLVM 24 [moved sm_101{,a,f} features](llvm/llvm-project#214335) to just be an alias for the matching sm_110 feature. Since the sm_110 feature already exists, we can do the remapping unconditionally rather than gating it on LLVM 24.

@rustbot label: +llvm-main
Wolfram70 added a commit to Wolfram70/llvm-project that referenced this pull request Nov 23, 2026
This change replaces the integer SM encoding used by the `NVVMRequiresSM`
traits (e.g. `sm_100f` as 1002) with one TableGen record per
architecture, related by the same `implies` lattice the NVPTX backend
uses for its architecture features (llvm#214335).

The `NVVMRequiresSMa`, `NVVMRequiresSMf` and `NVVMRequiresSMaOrSMf`
classes are folded into a single `NVVMRequiresSM` that takes a list of
architectures, e.g. `NVVMRequiresSM<[SM100f, SM110f]>`.
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.

5 participants