Skip to content

Commit 9fc5fd0

Browse files
[NVPTX] Update the default SM to 7.5 (#176021)
Update NVPTX's default SM to sm_75. This matches the behavior of offline compilation tools in the CUDA Toolkit (nvcc, ptxas, ...)
1 parent aca0df9 commit 9fc5fd0

7 files changed

Lines changed: 28 additions & 11 deletions

File tree

‎llvm/docs/ReleaseNotes.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,13 @@ Changes to the LoongArch Backend
107107
Changes to the MIPS Backend
108108
---------------------------
109109

110+
Changes to the NVPTX Backend
111+
----------------------------
112+
113+
* The default SM version has been changed from `sm_30` to `sm_75`. `sm_75` is
114+
the oldest GPU variant compatible with the widest range of recent major CUDA
115+
Toolkit versions (11/12/13).
116+
110117
Changes to the PowerPC Backend
111118
------------------------------
112119

‎llvm/lib/Target/NVPTX/NVPTXSubtarget.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ class NVPTXSubtarget : public NVPTXGenSubtargetInfo {
294294
return getFullSmVersion() % 10 == 2 ? PTXVersion >= 88
295295
: hasArchAccelFeatures();
296296
}
297-
// If the user did not provide a target we default to the `sm_30` target.
297+
// If the user did not provide a target we default to the `sm_75` target.
298298
std::string getTargetName() const {
299-
return TargetName.empty() ? "sm_30" : TargetName;
299+
return TargetName.empty() ? "sm_75" : TargetName;
300300
}
301301
bool hasTargetName() const { return !TargetName.empty(); }
302302

‎llvm/test/CodeGen/NVPTX/LoadStoreVectorizer.ll‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2-
; RUN: llc < %s | FileCheck -check-prefix=ENABLED %s
3-
; RUN: llc -disable-nvptx-load-store-vectorizer < %s | FileCheck -check-prefix=DISABLED %s
4-
; RUN: %if ptxas %{ llc < %s | %ptxas-verify %}
5-
; RUN: %if ptxas %{ llc -disable-nvptx-load-store-vectorizer < %s | %ptxas-verify %}
2+
; RUN: llc < %s -mcpu=sm_30 | FileCheck -check-prefix=ENABLED %s
3+
; RUN: llc -disable-nvptx-load-store-vectorizer < %s -mcpu=sm_30 | FileCheck -check-prefix=DISABLED %s
4+
; RUN: %if ptxas-sm_30 %{ llc < %s -mcpu=sm_30 | %ptxas-verify -arch=sm_30 %}
5+
; RUN: %if ptxas-sm_30 %{ llc -disable-nvptx-load-store-vectorizer < %s -mcpu=sm_30 | %ptxas-verify -arch=sm_30 %}
66

77
target triple = "nvptx64-nvidia-cuda"
88

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
; RUN: llc < %s -mtriple=nvptx | FileCheck %s
2+
; RUN: llc < %s -mtriple=nvptx64 | FileCheck %s
3+
; RUN: %if ptxas-ptr32 %{ llc < %s -mtriple=nvptx | %ptxas-verify %}
4+
; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 | %ptxas-verify %}
5+
6+
; CHECK: .target sm_75
7+
8+
define void @foo() {
9+
ret void
10+
}

‎llvm/test/CodeGen/NVPTX/i128.ll‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2-
; RUN: llc < %s -mtriple=nvptx64-- 2>&1 | FileCheck %s
3-
; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64-- | %ptxas-verify %}
2+
; RUN: llc < %s -mtriple=nvptx64-- -mcpu=sm_30 2>&1 | FileCheck %s
3+
; RUN: %if ptxas-sm_30 %{ llc < %s -mtriple=nvptx64-- -mcpu=sm_30 | %ptxas-verify -arch=sm_30 %}
44

55
define i128 @srem_i128(i128 %lhs, i128 %rhs) {
66
; CHECK-LABEL: srem_i128(

‎llvm/test/CodeGen/NVPTX/math-intrins.ll‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2-
; RUN: llc < %s | FileCheck %s --check-prefixes=CHECK,CHECK-NOF16
2+
; RUN: llc < %s -mcpu=sm_30 | FileCheck %s --check-prefixes=CHECK,CHECK-NOF16
33
; RUN: llc < %s -mcpu=sm_80 -mattr +ptx70 | FileCheck %s --check-prefixes=CHECK,CHECK-F16
44
; RUN: llc < %s -mcpu=sm_80 -mattr +ptx70 --nvptx-no-f16-math | FileCheck %s --check-prefixes=CHECK,CHECK-SM80-NOF16
5-
; RUN: %if ptxas %{ llc < %s | %ptxas-verify %}
5+
; RUN: %if ptxas-sm_30 %{ llc < %s -mcpu=sm_30 | %ptxas-verify -arch=sm_30 %}
66
; RUN: %if ptxas-sm_80 %{ llc < %s -mcpu=sm_80 | %ptxas-verify -arch=sm_80 %}
77
; RUN: %if ptxas-sm_80 %{ llc < %s -mcpu=sm_80 --nvptx-no-f16-math | %ptxas-verify -arch=sm_80 %}
88

‎llvm/test/DebugInfo/NVPTX/dbg-declare-alloca.ll‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; RUN: llc < %s -mtriple=nvptx64-nvidia-cuda | FileCheck %s
22
; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64-nvidia-cuda | %ptxas-verify %}
33

4-
; CHECK: .target sm_30, debug
4+
; CHECK: .target sm_75, debug
55

66
; CHECK: .visible .func use_dbg_declare()
77
; CHECK: .local .align 8 .b8 __local_depot0[8];

0 commit comments

Comments
 (0)