Skip to content

Commit 1a368ae

Browse files
Artem-Brupprecht
authored andcommitted
[CUDA] fix builtin constraints for PTX 7.2
This fixes build issues w/ CUDA-11 introduced by https://reviews.llvm.org/D95974 Reviewed By: yaxunl Differential Revision: https://reviews.llvm.org/D97009
1 parent 43fa23a commit 1a368ae

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

clang/include/clang/Basic/BuiltinsNVPTX.def

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
#pragma push_macro("PTX65")
3939
#pragma push_macro("PTX70")
4040
#pragma push_macro("PTX71")
41-
#define PTX71 "ptx71"
41+
#pragma push_macro("PTX72")
42+
#define PTX72 "ptx72"
43+
#define PTX71 "ptx71|" PTX72
4244
#define PTX70 "ptx70|" PTX71
4345
#define PTX65 "ptx65|" PTX70
4446
#define PTX64 "ptx64|" PTX65
@@ -740,3 +742,4 @@ TARGET_BUILTIN(__imma_m8n8k32_st_c_i32, "vi*iC*UiIi", "", AND(SM_75,PTX63))
740742
#pragma pop_macro("PTX65")
741743
#pragma pop_macro("PTX70")
742744
#pragma pop_macro("PTX71")
745+
#pragma pop_macro("PTX72")

clang/test/CodeGen/builtins-nvptx-sm_70.cu

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
// RUN: -fcuda-is-device -target-feature +ptx61 -DPTX61 \
77
// RUN: -S -emit-llvm -o - -x cuda %s \
88
// RUN: | FileCheck -check-prefixes=CHECK_M16,CHECK_M32_M8 %s
9+
// Make sure builtins still work with the latest combination of GPU & PTX.
10+
// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -target-cpu sm_86 \
11+
// RUN: -fcuda-is-device -target-feature +ptx72 -DPTX61 \
12+
// RUN: -S -emit-llvm -o - -x cuda %s \
13+
// RUN: | FileCheck -check-prefixes=CHECK_M16,CHECK_M32_M8 %s
914
// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_60 \
1015
// RUN: -DPTX61 -fcuda-is-device -S -o /dev/null -x cuda -verify=pre-sm_70 %s
1116
// RUN: %clang_cc1 -triple nvptx-unknown-unknown \

0 commit comments

Comments
 (0)