Skip to content

Commit 965ff7f

Browse files
authored
[NVPTX] Add SM versions for 101 and 120 (#124155)
This patch adds SM and PTX versions for SM 101, 120 and their arch-accelerated variants. All these are supported in cuda-12.8. sm120/120a requires ptx8.7 and the rest require ptx8.6. Signed-off-by: Durgadoss R <[email protected]>
1 parent 33fc477 commit 965ff7f

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

llvm/lib/Target/NVPTX/NVPTX.td

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,18 @@ class FeaturePTX<int version>:
3535
"Use PTX version " # version>;
3636

3737
foreach sm = [20, 21, 30, 32, 35, 37, 50, 52, 53,
38-
60, 61, 62, 70, 72, 75, 80, 86, 87, 89, 90, 100] in
38+
60, 61, 62, 70, 72, 75, 80, 86, 87,
39+
89, 90, 100, 101, 120] in
3940
def SM#sm: FeatureSM<""#sm, !mul(sm, 10)>;
4041

4142
def SM90a: FeatureSM<"90a", 901>;
4243
def SM100a: FeatureSM<"100a", 1001>;
44+
def SM101a: FeatureSM<"101a", 1011>;
45+
def SM120a: FeatureSM<"120a", 1201>;
4346

4447
foreach version = [32, 40, 41, 42, 43, 50, 60, 61, 62, 63, 64, 65,
4548
70, 71, 72, 73, 74, 75, 76, 77, 78,
46-
80, 81, 82, 83, 84, 85, 86] in
49+
80, 81, 82, 83, 84, 85, 86, 87] in
4750
def PTX#version: FeaturePTX<version>;
4851

4952
//===----------------------------------------------------------------------===//
@@ -76,6 +79,10 @@ def : Proc<"sm_90", [SM90, PTX78]>;
7679
def : Proc<"sm_90a", [SM90a, PTX80]>;
7780
def : Proc<"sm_100", [SM100, PTX86]>;
7881
def : Proc<"sm_100a", [SM100a, PTX86]>;
82+
def : Proc<"sm_101", [SM101, PTX86]>;
83+
def : Proc<"sm_101a", [SM101a, PTX86]>;
84+
def : Proc<"sm_120", [SM120, PTX87]>;
85+
def : Proc<"sm_120a", [SM120a, PTX87]>;
7986

8087
def NVPTXInstrInfo : InstrInfo {
8188
}

llvm/lib/Target/NVPTX/NVPTXInstrInfo.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ class hasSM<int version>: Predicate<"Subtarget->getSmVersion() >= " # version>;
172172

173173
// Explicit records for arch-accelerated SM versions
174174
def hasSM90a : Predicate<"Subtarget->getFullSmVersion() == 901">;
175+
def hasSM100a : Predicate<"Subtarget->getFullSmVersion() == 1001">;
176+
def hasSM101a : Predicate<"Subtarget->getFullSmVersion() == 1011">;
177+
def hasSM120a : Predicate<"Subtarget->getFullSmVersion() == 1201">;
175178

176179
// non-sync shfl instructions are not available on sm_70+ in PTX6.4+
177180
def hasSHFL : Predicate<"!(Subtarget->getSmVersion() >= 70"

llvm/test/CodeGen/NVPTX/sm-version.ll

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
; RUN: llc < %s -mtriple=nvptx -mcpu=sm_86 | FileCheck %s --check-prefix=SM86
1717
; RUN: llc < %s -mtriple=nvptx -mcpu=sm_90 | FileCheck %s --check-prefix=SM90
1818
; RUN: llc < %s -mtriple=nvptx -mcpu=sm_90a | FileCheck %s --check-prefix=SM90a
19+
; RUN: llc < %s -mtriple=nvptx -mcpu=sm_100 | FileCheck %s --check-prefix=SM100
20+
; RUN: llc < %s -mtriple=nvptx -mcpu=sm_100a | FileCheck %s --check-prefix=SM100a
21+
; RUN: llc < %s -mtriple=nvptx -mcpu=sm_101 | FileCheck %s --check-prefix=SM101
22+
; RUN: llc < %s -mtriple=nvptx -mcpu=sm_101a | FileCheck %s --check-prefix=SM101a
23+
; RUN: llc < %s -mtriple=nvptx -mcpu=sm_120 | FileCheck %s --check-prefix=SM120
24+
; RUN: llc < %s -mtriple=nvptx -mcpu=sm_120a | FileCheck %s --check-prefix=SM120a
1925

2026
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_20 | FileCheck %s --check-prefix=SM20
2127
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_21 | FileCheck %s --check-prefix=SM21
@@ -35,6 +41,12 @@
3541
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_86 | FileCheck %s --check-prefix=SM86
3642
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_90 | FileCheck %s --check-prefix=SM90
3743
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_90a | FileCheck %s --check-prefix=SM90a
44+
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_100 | FileCheck %s --check-prefix=SM100
45+
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_100a | FileCheck %s --check-prefix=SM100a
46+
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_101 | FileCheck %s --check-prefix=SM101
47+
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_101a | FileCheck %s --check-prefix=SM101a
48+
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_120 | FileCheck %s --check-prefix=SM120
49+
; RUN: llc < %s -mtriple=nvptx64 -mcpu=sm_120a | FileCheck %s --check-prefix=SM120a
3850

3951
; SM20: .version 3.2
4052
; SM21: .version 3.2
@@ -54,6 +66,12 @@
5466
; SM86: .version 7.1
5567
; SM90: .version 7.8
5668
; SM90a: .version 8.0
69+
; SM100: .version 8.6
70+
; SM100a: .version 8.6
71+
; SM101: .version 8.6
72+
; SM101a: .version 8.6
73+
; SM120: .version 8.7
74+
; SM120a: .version 8.7
5775

5876
; SM20: .target sm_20
5977
; SM21: .target sm_21
@@ -73,3 +91,9 @@
7391
; SM86: .target sm_86
7492
; SM90: .target sm_90
7593
; SM90a: .target sm_90a
94+
; SM100: .target sm_100
95+
; SM100a: .target sm_100a
96+
; SM101: .target sm_101
97+
; SM101a: .target sm_101a
98+
; SM120: .target sm_120
99+
; SM120a: .target sm_120a

0 commit comments

Comments
 (0)