Skip to content

Commit 9e7aab9

Browse files
authored
[CUDA] Rename SM_32 to SM_32_ to work around AIX headers (#88779)
Summary: AIX headers define this, so we need to work around it. In the future this will be removed but for now we should just rename it to avoid these issues.
1 parent f69ded0 commit 9e7aab9

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

clang/include/clang/Basic/Cuda.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,15 @@ const char *CudaVersionToString(CudaVersion V);
5050
// Input is "Major.Minor"
5151
CudaVersion CudaStringToVersion(const llvm::Twine &S);
5252

53-
// We have a name conflict with sys/mac.h on AIX
54-
#ifdef SM_32
55-
#undef SM_32
56-
#endif
5753
enum class CudaArch {
5854
UNUSED,
5955
UNKNOWN,
56+
// TODO: Deprecate and remove GPU architectures older than sm_52.
6057
SM_20,
6158
SM_21,
6259
SM_30,
63-
SM_32,
60+
// This has a name conflict with sys/mac.h on AIX, rename it as a workaround.
61+
SM_32_,
6462
SM_35,
6563
SM_37,
6664
SM_50,

clang/lib/Basic/Cuda.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static const CudaArchToStringMap arch_names[] = {
8686
// clang-format off
8787
{CudaArch::UNUSED, "", ""},
8888
SM2(20, "compute_20"), SM2(21, "compute_20"), // Fermi
89-
SM(30), SM(32), SM(35), SM(37), // Kepler
89+
SM(30), {CudaArch::SM_32_, "sm_32", "compute_32"}, SM(35), SM(37), // Kepler
9090
SM(50), SM(52), SM(53), // Maxwell
9191
SM(60), SM(61), SM(62), // Pascal
9292
SM(70), SM(72), // Volta
@@ -186,7 +186,7 @@ CudaVersion MinVersionForCudaArch(CudaArch A) {
186186
case CudaArch::SM_20:
187187
case CudaArch::SM_21:
188188
case CudaArch::SM_30:
189-
case CudaArch::SM_32:
189+
case CudaArch::SM_32_:
190190
case CudaArch::SM_35:
191191
case CudaArch::SM_37:
192192
case CudaArch::SM_50:
@@ -231,7 +231,7 @@ CudaVersion MaxVersionForCudaArch(CudaArch A) {
231231
case CudaArch::SM_21:
232232
return CudaVersion::CUDA_80;
233233
case CudaArch::SM_30:
234-
case CudaArch::SM_32:
234+
case CudaArch::SM_32_:
235235
return CudaVersion::CUDA_102;
236236
case CudaArch::SM_35:
237237
case CudaArch::SM_37:

clang/lib/Basic/Targets/NVPTX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ void NVPTXTargetInfo::getTargetDefines(const LangOptions &Opts,
239239
return "210";
240240
case CudaArch::SM_30:
241241
return "300";
242-
case CudaArch::SM_32:
242+
case CudaArch::SM_32_:
243243
return "320";
244244
case CudaArch::SM_35:
245245
return "350";

clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3466,7 +3466,7 @@ void CGOpenMPRuntimeGPU::processRequiresDirective(
34663466
case CudaArch::SM_20:
34673467
case CudaArch::SM_21:
34683468
case CudaArch::SM_30:
3469-
case CudaArch::SM_32:
3469+
case CudaArch::SM_32_:
34703470
case CudaArch::SM_35:
34713471
case CudaArch::SM_37:
34723472
case CudaArch::SM_50:

0 commit comments

Comments
 (0)