[clang] [CUDA][NFC] CudaArch to GpuArch rename (PR #97028)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 28 02:37:41 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-codegen
@llvm/pr-subscribers-clang
Author: Jakub Chlanda (jchlanda)
<details>
<summary>Changes</summary>
Rename `CudaArch` to `GpuArch` to better reflect its content and the use.
Apply a similar rename to helpers handling the enum.
---
Patch is 39.03 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/97028.diff
11 Files Affected:
- (modified) clang/include/clang/Basic/Cuda.h (+14-14)
- (modified) clang/lib/Basic/Cuda.cpp (+52-54)
- (modified) clang/lib/Basic/Targets/NVPTX.cpp (+80-80)
- (modified) clang/lib/Basic/Targets/NVPTX.h (+10-10)
- (modified) clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp (+86-87)
- (modified) clang/lib/Driver/Driver.cpp (+19-19)
- (modified) clang/lib/Driver/OffloadBundler.cpp (+1-1)
- (modified) clang/lib/Driver/ToolChains/AMDGPUOpenMP.cpp (+1-1)
- (modified) clang/lib/Driver/ToolChains/Cuda.cpp (+16-16)
- (modified) clang/lib/Driver/ToolChains/Cuda.h (+2-2)
- (modified) clang/lib/Sema/SemaDeclAttr.cpp (+7-7)
``````````diff
diff --git a/clang/include/clang/Basic/Cuda.h b/clang/include/clang/Basic/Cuda.h
index 01cfe286c491b..b0999d2c5d1ac 100644
--- a/clang/include/clang/Basic/Cuda.h
+++ b/clang/include/clang/Basic/Cuda.h
@@ -52,7 +52,7 @@ const char *CudaVersionToString(CudaVersion V);
// Input is "Major.Minor"
CudaVersion CudaStringToVersion(const llvm::Twine &S);
-enum class CudaArch {
+enum class GpuArch {
UNUSED,
UNKNOWN,
// TODO: Deprecate and remove GPU architectures older than sm_52.
@@ -133,8 +133,8 @@ enum class CudaArch {
// public one.
LAST,
- CudaDefault = CudaArch::SM_52,
- HIPDefault = CudaArch::GFX906,
+ CudaDefault = GpuArch::SM_52,
+ HIPDefault = GpuArch::GFX906,
};
enum class CUDAFunctionTarget {
@@ -145,26 +145,26 @@ enum class CUDAFunctionTarget {
InvalidTarget
};
-static inline bool IsNVIDIAGpuArch(CudaArch A) {
- return A >= CudaArch::SM_20 && A < CudaArch::GFX600;
+static inline bool IsNVIDIAGpuArch(GpuArch A) {
+ return A >= GpuArch::SM_20 && A < GpuArch::GFX600;
}
-static inline bool IsAMDGpuArch(CudaArch A) {
+static inline bool IsAMDGpuArch(GpuArch A) {
// Generic processor model is for testing only.
- return A >= CudaArch::GFX600 && A < CudaArch::Generic;
+ return A >= GpuArch::GFX600 && A < GpuArch::Generic;
}
-const char *CudaArchToString(CudaArch A);
-const char *CudaArchToVirtualArchString(CudaArch A);
+const char *GpuArchToString(GpuArch A);
+const char *GpuArchToVirtualArchString(GpuArch A);
// The input should have the form "sm_20".
-CudaArch StringToCudaArch(llvm::StringRef S);
+GpuArch StringToGpuArch(llvm::StringRef S);
-/// Get the earliest CudaVersion that supports the given CudaArch.
-CudaVersion MinVersionForCudaArch(CudaArch A);
+/// Get the earliest CudaVersion that supports the given GpuArch.
+CudaVersion MinVersionForGpuArch(GpuArch A);
-/// Get the latest CudaVersion that supports the given CudaArch.
-CudaVersion MaxVersionForCudaArch(CudaArch A);
+/// Get the latest CudaVersion that supports the given GpuArch.
+CudaVersion MaxVersionForGpuArch(GpuArch A);
// Various SDK-dependent features that affect CUDA compilation
enum class CudaFeature {
diff --git a/clang/lib/Basic/Cuda.cpp b/clang/lib/Basic/Cuda.cpp
index af99c4d61021e..e31f09dce0f3a 100644
--- a/clang/lib/Basic/Cuda.cpp
+++ b/clang/lib/Basic/Cuda.cpp
@@ -72,23 +72,21 @@ CudaVersion ToCudaVersion(llvm::VersionTuple Version) {
}
namespace {
-struct CudaArchToStringMap {
- CudaArch arch;
+struct GpuArchToStringMap {
+ GpuArch arch;
const char *arch_name;
const char *virtual_arch_name;
};
} // namespace
-#define SM2(sm, ca) \
- { CudaArch::SM_##sm, "sm_" #sm, ca }
+#define SM2(sm, ca) {GpuArch::SM_##sm, "sm_" #sm, ca}
#define SM(sm) SM2(sm, "compute_" #sm)
-#define GFX(gpu) \
- { CudaArch::GFX##gpu, "gfx" #gpu, "compute_amdgcn" }
-static const CudaArchToStringMap arch_names[] = {
+#define GFX(gpu) {GpuArch::GFX##gpu, "gfx" #gpu, "compute_amdgcn"}
+static const GpuArchToStringMap arch_names[] = {
// clang-format off
- {CudaArch::UNUSED, "", ""},
+ {GpuArch::UNUSED, "", ""},
SM2(20, "compute_20"), SM2(21, "compute_20"), // Fermi
- SM(30), {CudaArch::SM_32_, "sm_32", "compute_32"}, SM(35), SM(37), // Kepler
+ SM(30), {GpuArch::SM_32_, "sm_32", "compute_32"}, SM(35), SM(37), // Kepler
SM(50), SM(52), SM(53), // Maxwell
SM(60), SM(61), SM(62), // Pascal
SM(70), SM(72), // Volta
@@ -112,7 +110,7 @@ static const CudaArchToStringMap arch_names[] = {
GFX(803), // gfx803
GFX(805), // gfx805
GFX(810), // gfx810
- {CudaArch::GFX9_GENERIC, "gfx9-generic", "compute_amdgcn"},
+ {GpuArch::GFX9_GENERIC, "gfx9-generic", "compute_amdgcn"},
GFX(900), // gfx900
GFX(902), // gfx902
GFX(904), // gfx903
@@ -124,12 +122,12 @@ static const CudaArchToStringMap arch_names[] = {
GFX(940), // gfx940
GFX(941), // gfx941
GFX(942), // gfx942
- {CudaArch::GFX10_1_GENERIC, "gfx10-1-generic", "compute_amdgcn"},
+ {GpuArch::GFX10_1_GENERIC, "gfx10-1-generic", "compute_amdgcn"},
GFX(1010), // gfx1010
GFX(1011), // gfx1011
GFX(1012), // gfx1012
GFX(1013), // gfx1013
- {CudaArch::GFX10_3_GENERIC, "gfx10-3-generic", "compute_amdgcn"},
+ {GpuArch::GFX10_3_GENERIC, "gfx10-3-generic", "compute_amdgcn"},
GFX(1030), // gfx1030
GFX(1031), // gfx1031
GFX(1032), // gfx1032
@@ -137,7 +135,7 @@ static const CudaArchToStringMap arch_names[] = {
GFX(1034), // gfx1034
GFX(1035), // gfx1035
GFX(1036), // gfx1036
- {CudaArch::GFX11_GENERIC, "gfx11-generic", "compute_amdgcn"},
+ {GpuArch::GFX11_GENERIC, "gfx11-generic", "compute_amdgcn"},
GFX(1100), // gfx1100
GFX(1101), // gfx1101
GFX(1102), // gfx1102
@@ -145,46 +143,46 @@ static const CudaArchToStringMap arch_names[] = {
GFX(1150), // gfx1150
GFX(1151), // gfx1151
GFX(1152), // gfx1152
- {CudaArch::GFX12_GENERIC, "gfx12-generic", "compute_amdgcn"},
+ {GpuArch::GFX12_GENERIC, "gfx12-generic", "compute_amdgcn"},
GFX(1200), // gfx1200
GFX(1201), // gfx1201
- {CudaArch::AMDGCNSPIRV, "amdgcnspirv", "compute_amdgcn"},
- {CudaArch::Generic, "generic", ""},
+ {GpuArch::AMDGCNSPIRV, "amdgcnspirv", "compute_amdgcn"},
+ {GpuArch::Generic, "generic", ""},
// clang-format on
};
#undef SM
#undef SM2
#undef GFX
-const char *CudaArchToString(CudaArch A) {
+const char *GpuArchToString(GpuArch A) {
auto result = std::find_if(
std::begin(arch_names), std::end(arch_names),
- [A](const CudaArchToStringMap &map) { return A == map.arch; });
+ [A](const GpuArchToStringMap &map) { return A == map.arch; });
if (result == std::end(arch_names))
return "unknown";
return result->arch_name;
}
-const char *CudaArchToVirtualArchString(CudaArch A) {
+const char *GpuArchToVirtualArchString(GpuArch A) {
auto result = std::find_if(
std::begin(arch_names), std::end(arch_names),
- [A](const CudaArchToStringMap &map) { return A == map.arch; });
+ [A](const GpuArchToStringMap &map) { return A == map.arch; });
if (result == std::end(arch_names))
return "unknown";
return result->virtual_arch_name;
}
-CudaArch StringToCudaArch(llvm::StringRef S) {
+GpuArch StringToGpuArch(llvm::StringRef S) {
auto result = std::find_if(
std::begin(arch_names), std::end(arch_names),
- [S](const CudaArchToStringMap &map) { return S == map.arch_name; });
+ [S](const GpuArchToStringMap &map) { return S == map.arch_name; });
if (result == std::end(arch_names))
- return CudaArch::UNKNOWN;
+ return GpuArch::UNKNOWN;
return result->arch;
}
-CudaVersion MinVersionForCudaArch(CudaArch A) {
- if (A == CudaArch::UNKNOWN)
+CudaVersion MinVersionForGpuArch(GpuArch A) {
+ if (A == GpuArch::UNKNOWN)
return CudaVersion::UNKNOWN;
// AMD GPUs do not depend on CUDA versions.
@@ -192,58 +190,58 @@ CudaVersion MinVersionForCudaArch(CudaArch A) {
return CudaVersion::CUDA_70;
switch (A) {
- case CudaArch::SM_20:
- case CudaArch::SM_21:
- case CudaArch::SM_30:
- case CudaArch::SM_32_:
- case CudaArch::SM_35:
- case CudaArch::SM_37:
- case CudaArch::SM_50:
- case CudaArch::SM_52:
- case CudaArch::SM_53:
+ case GpuArch::SM_20:
+ case GpuArch::SM_21:
+ case GpuArch::SM_30:
+ case GpuArch::SM_32_:
+ case GpuArch::SM_35:
+ case GpuArch::SM_37:
+ case GpuArch::SM_50:
+ case GpuArch::SM_52:
+ case GpuArch::SM_53:
return CudaVersion::CUDA_70;
- case CudaArch::SM_60:
- case CudaArch::SM_61:
- case CudaArch::SM_62:
+ case GpuArch::SM_60:
+ case GpuArch::SM_61:
+ case GpuArch::SM_62:
return CudaVersion::CUDA_80;
- case CudaArch::SM_70:
+ case GpuArch::SM_70:
return CudaVersion::CUDA_90;
- case CudaArch::SM_72:
+ case GpuArch::SM_72:
return CudaVersion::CUDA_91;
- case CudaArch::SM_75:
+ case GpuArch::SM_75:
return CudaVersion::CUDA_100;
- case CudaArch::SM_80:
+ case GpuArch::SM_80:
return CudaVersion::CUDA_110;
- case CudaArch::SM_86:
+ case GpuArch::SM_86:
return CudaVersion::CUDA_111;
- case CudaArch::SM_87:
+ case GpuArch::SM_87:
return CudaVersion::CUDA_114;
- case CudaArch::SM_89:
- case CudaArch::SM_90:
+ case GpuArch::SM_89:
+ case GpuArch::SM_90:
return CudaVersion::CUDA_118;
- case CudaArch::SM_90a:
+ case GpuArch::SM_90a:
return CudaVersion::CUDA_120;
default:
llvm_unreachable("invalid enum");
}
}
-CudaVersion MaxVersionForCudaArch(CudaArch A) {
+CudaVersion MaxVersionForGpuArch(GpuArch A) {
// AMD GPUs do not depend on CUDA versions.
if (IsAMDGpuArch(A))
return CudaVersion::NEW;
switch (A) {
- case CudaArch::UNKNOWN:
+ case GpuArch::UNKNOWN:
return CudaVersion::UNKNOWN;
- case CudaArch::SM_20:
- case CudaArch::SM_21:
+ case GpuArch::SM_20:
+ case GpuArch::SM_21:
return CudaVersion::CUDA_80;
- case CudaArch::SM_30:
- case CudaArch::SM_32_:
+ case GpuArch::SM_30:
+ case GpuArch::SM_32_:
return CudaVersion::CUDA_102;
- case CudaArch::SM_35:
- case CudaArch::SM_37:
+ case GpuArch::SM_35:
+ case GpuArch::SM_37:
return CudaVersion::CUDA_118;
default:
return CudaVersion::NEW;
diff --git a/clang/lib/Basic/Targets/NVPTX.cpp b/clang/lib/Basic/Targets/NVPTX.cpp
index 8e9006853db65..5b45806c500f3 100644
--- a/clang/lib/Basic/Targets/NVPTX.cpp
+++ b/clang/lib/Basic/Targets/NVPTX.cpp
@@ -59,7 +59,7 @@ NVPTXTargetInfo::NVPTXTargetInfo(const llvm::Triple &Triple,
// Define available target features
// These must be defined in sorted order!
NoAsmVariants = true;
- GPU = CudaArch::UNUSED;
+ GPU = GpuArch::UNUSED;
// PTX supports f16 as a fundamental type.
HasLegalHalfType = true;
@@ -175,117 +175,117 @@ void NVPTXTargetInfo::getTargetDefines(const LangOptions &Opts,
Builder.defineMacro("__NVPTX__");
// Skip setting architecture dependent macros if undefined.
- if (GPU == CudaArch::UNUSED && !HostTarget)
+ if (GPU == GpuArch::UNUSED && !HostTarget)
return;
if (Opts.CUDAIsDevice || Opts.OpenMPIsTargetDevice || !HostTarget) {
// Set __CUDA_ARCH__ for the GPU specified.
std::string CUDAArchCode = [this] {
switch (GPU) {
- case CudaArch::GFX600:
- case CudaArch::GFX601:
- case CudaArch::GFX602:
- case CudaArch::GFX700:
- case CudaArch::GFX701:
- case CudaArch::GFX702:
- case CudaArch::GFX703:
- case CudaArch::GFX704:
- case CudaArch::GFX705:
- case CudaArch::GFX801:
- case CudaArch::GFX802:
- case CudaArch::GFX803:
- case CudaArch::GFX805:
- case CudaArch::GFX810:
- case CudaArch::GFX9_GENERIC:
- case CudaArch::GFX900:
- case CudaArch::GFX902:
- case CudaArch::GFX904:
- case CudaArch::GFX906:
- case CudaArch::GFX908:
- case CudaArch::GFX909:
- case CudaArch::GFX90a:
- case CudaArch::GFX90c:
- case CudaArch::GFX940:
- case CudaArch::GFX941:
- case CudaArch::GFX942:
- case CudaArch::GFX10_1_GENERIC:
- case CudaArch::GFX1010:
- case CudaArch::GFX1011:
- case CudaArch::GFX1012:
- case CudaArch::GFX1013:
- case CudaArch::GFX10_3_GENERIC:
- case CudaArch::GFX1030:
- case CudaArch::GFX1031:
- case CudaArch::GFX1032:
- case CudaArch::GFX1033:
- case CudaArch::GFX1034:
- case CudaArch::GFX1035:
- case CudaArch::GFX1036:
- case CudaArch::GFX11_GENERIC:
- case CudaArch::GFX1100:
- case CudaArch::GFX1101:
- case CudaArch::GFX1102:
- case CudaArch::GFX1103:
- case CudaArch::GFX1150:
- case CudaArch::GFX1151:
- case CudaArch::GFX1152:
- case CudaArch::GFX12_GENERIC:
- case CudaArch::GFX1200:
- case CudaArch::GFX1201:
- case CudaArch::AMDGCNSPIRV:
- case CudaArch::Generic:
- case CudaArch::LAST:
+ case GpuArch::GFX600:
+ case GpuArch::GFX601:
+ case GpuArch::GFX602:
+ case GpuArch::GFX700:
+ case GpuArch::GFX701:
+ case GpuArch::GFX702:
+ case GpuArch::GFX703:
+ case GpuArch::GFX704:
+ case GpuArch::GFX705:
+ case GpuArch::GFX801:
+ case GpuArch::GFX802:
+ case GpuArch::GFX803:
+ case GpuArch::GFX805:
+ case GpuArch::GFX810:
+ case GpuArch::GFX9_GENERIC:
+ case GpuArch::GFX900:
+ case GpuArch::GFX902:
+ case GpuArch::GFX904:
+ case GpuArch::GFX906:
+ case GpuArch::GFX908:
+ case GpuArch::GFX909:
+ case GpuArch::GFX90a:
+ case GpuArch::GFX90c:
+ case GpuArch::GFX940:
+ case GpuArch::GFX941:
+ case GpuArch::GFX942:
+ case GpuArch::GFX10_1_GENERIC:
+ case GpuArch::GFX1010:
+ case GpuArch::GFX1011:
+ case GpuArch::GFX1012:
+ case GpuArch::GFX1013:
+ case GpuArch::GFX10_3_GENERIC:
+ case GpuArch::GFX1030:
+ case GpuArch::GFX1031:
+ case GpuArch::GFX1032:
+ case GpuArch::GFX1033:
+ case GpuArch::GFX1034:
+ case GpuArch::GFX1035:
+ case GpuArch::GFX1036:
+ case GpuArch::GFX11_GENERIC:
+ case GpuArch::GFX1100:
+ case GpuArch::GFX1101:
+ case GpuArch::GFX1102:
+ case GpuArch::GFX1103:
+ case GpuArch::GFX1150:
+ case GpuArch::GFX1151:
+ case GpuArch::GFX1152:
+ case GpuArch::GFX12_GENERIC:
+ case GpuArch::GFX1200:
+ case GpuArch::GFX1201:
+ case GpuArch::AMDGCNSPIRV:
+ case GpuArch::Generic:
+ case GpuArch::LAST:
break;
- case CudaArch::UNKNOWN:
+ case GpuArch::UNKNOWN:
assert(false && "No GPU arch when compiling CUDA device code.");
return "";
- case CudaArch::UNUSED:
- case CudaArch::SM_20:
+ case GpuArch::UNUSED:
+ case GpuArch::SM_20:
return "200";
- case CudaArch::SM_21:
+ case GpuArch::SM_21:
return "210";
- case CudaArch::SM_30:
+ case GpuArch::SM_30:
return "300";
- case CudaArch::SM_32_:
+ case GpuArch::SM_32_:
return "320";
- case CudaArch::SM_35:
+ case GpuArch::SM_35:
return "350";
- case CudaArch::SM_37:
+ case GpuArch::SM_37:
return "370";
- case CudaArch::SM_50:
+ case GpuArch::SM_50:
return "500";
- case CudaArch::SM_52:
+ case GpuArch::SM_52:
return "520";
- case CudaArch::SM_53:
+ case GpuArch::SM_53:
return "530";
- case CudaArch::SM_60:
+ case GpuArch::SM_60:
return "600";
- case CudaArch::SM_61:
+ case GpuArch::SM_61:
return "610";
- case CudaArch::SM_62:
+ case GpuArch::SM_62:
return "620";
- case CudaArch::SM_70:
+ case GpuArch::SM_70:
return "700";
- case CudaArch::SM_72:
+ case GpuArch::SM_72:
return "720";
- case CudaArch::SM_75:
+ case GpuArch::SM_75:
return "750";
- case CudaArch::SM_80:
+ case GpuArch::SM_80:
return "800";
- case CudaArch::SM_86:
+ case GpuArch::SM_86:
return "860";
- case CudaArch::SM_87:
+ case GpuArch::SM_87:
return "870";
- case CudaArch::SM_89:
+ case GpuArch::SM_89:
return "890";
- case CudaArch::SM_90:
- case CudaArch::SM_90a:
+ case GpuArch::SM_90:
+ case GpuArch::SM_90a:
return "900";
}
- llvm_unreachable("unhandled CudaArch");
+ llvm_unreachable("unhandled GpuArch");
}();
Builder.defineMacro("__CUDA_ARCH__", CUDAArchCode);
- if (GPU == CudaArch::SM_90a)
+ if (GPU == GpuArch::SM_90a)
Builder.defineMacro("__CUDA_ARCH_FEAT_SM90_ALL", "1");
}
}
diff --git a/clang/lib/Basic/Targets/NVPTX.h b/clang/lib/Basic/Targets/NVPTX.h
index f476d49047c01..9c956ca19d9cd 100644
--- a/clang/lib/Basic/Targets/NVPTX.h
+++ b/clang/lib/Basic/Targets/NVPTX.h
@@ -62,7 +62,7 @@ static const int NVPTXDWARFAddrSpaceMap[] = {
class LLVM_LIBRARY_VISIBILITY NVPTXTargetInfo : public TargetInfo {
static const char *const GCCRegNames[];
- CudaArch GPU;
+ GpuArch GPU;
uint32_t PTXVersion;
std::unique_ptr<TargetInfo> HostTarget;
@@ -79,8 +79,8 @@ class LLVM_LIBRARY_VISIBILITY NVPTXTargetInfo : public TargetInfo {
initFeatureMap(llvm::StringMap<bool> &Features, DiagnosticsEngine &Diags,
StringRef CPU,
const std::vector<std::string> &FeaturesVec) const override {
- if (GPU != CudaArch::UNUSED)
- Features[CudaArchToString(GPU)] = true;
+ if (GPU != GpuArch::UNUSED)
+ Features[GpuArchToString(GPU)] = true;
Features["ptx" + std::to_string(PTXVersion)] = true;
return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
}
@@ -121,18 +121,18 @@ class LLVM_LIBRARY_VISIBILITY NVPTXTargetInfo : public TargetInfo {
}
bool isValidCPUName(StringRef Name) const override {
- return StringToCudaArch(Name) != CudaArch::UNKNOWN;
+ return StringToGpuArch(Name) != GpuArch::UNKNOWN;
}
void fillValidCPUList(SmallVectorImpl<StringRef> &Values) const override {
- for (int i = static_cast<int>(CudaArch::SM_20);
- i < static_cast<int>(CudaArch::Generic); ++i)
- Values.emplace_back(CudaArchToString(static_cast<CudaArch>(i)));
+ for (int i = static_cast<int>(GpuArch::SM_20);
+ i < static_cast<int>(GpuArch::Generic); ++i)
+ Values.emplace_back(GpuArchToString(static_cast<GpuArch>(i)));
}
bool setCPU(const std::string &Name) override {
- GPU = StringToCudaArch(Name);
- return GPU != CudaArch::UNKNOWN;
+ GPU = StringToGpuArch(Name);
+ return GPU != GpuArch::UNKNOWN;
}
void setSupportedOpenCLOpts() override {
@@ -183,7 +183,7 @@ class LLVM_LIBRARY_VISIBILITY NVPTXTargetInfo : public TargetInfo {
bool hasBitIntType() const override { return true; }
bool hasBFloat16Type() const override { return true; }
- CudaArch getGPU() const { return GPU; }
+ GpuArch getGPU() const { return GPU; }
};
} // namespace targets
} // namespace clang
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
index f4eba14da51a5..8071c46b242cf 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -2227,113 +2227,112 @@ bool CGOpenMPRuntimeGPU::hasAllocateAttributeForGlobalVar(const VarDecl *VD,
return false;
}
-// Get current CudaArch and ignore any unknown values
-static CudaArch getCudaArch(CodeGenModule &CGM) {
+// Get current GpuArch and ignore any unknown values
+static GpuArch getGpuArch(CodeGenModule &CGM) {
if (!CGM.getTarget().hasFeature("ptx"))
- return CudaArch::UNKNOWN;
+ return GpuArch::UNKNOWN;
for (const auto &Feature : CGM.getTarget().getTargetOpts().FeatureMap) {
if (Feature.getValue()) {
- CudaArch Arch = StringToCudaArch(Feature.getKey());
- if (Arch != CudaArch::UNKNOWN)
+ GpuArch Arch = StringToGpuArch(Feature.getKey());
+ if (Arch != GpuArch::UNKNOWN)
return Arch;
}
}
- return CudaArch::UNKNOWN;
+ return GpuArch::UNKNOWN;
}
/// Check to see if target architecture supports unified addressing which is
/// a restriction for OpenMP requires clause "unified_shared_memory".
-void CGOpenMPRuntimeGPU::processRequiresDirective(
- const OMPRequiresDecl *D) {
+void CGOpenMPRuntimeGPU::processRequiresDirective(const OMPRequiresDecl *D) {
for (const OMPClause *Clause : D->clauselists()) {
if (Clause->getClauseKind() == OMPC_unified_shared_memory) {
- CudaArch Arch = getCudaArch(CGM);
+ GpuArch Arch = getGpuArch(CGM);
switch (Arch) {
- case CudaArch::SM_20:
- case CudaArch::SM_21:
- case CudaArch::SM_30:
- case CudaArch::SM_32_:
- case CudaArch::SM_35:
- case CudaArch::SM_37:
- case CudaArch::SM_50:
- case CudaArch::SM_52:
- case CudaArch::SM_53: {
+ case GpuArch::SM_20:
+ case GpuArch::SM_21:
+ case GpuArch::SM_30:
+ case GpuArch::SM_32_:
+ case GpuArch::SM_35:
+ case GpuArch::SM_37:
+ case GpuArch::SM_50:
+ case GpuArch::SM_52:
+ case GpuArch::SM_53: {
SmallString<256> Buffer;
llvm::raw_svector_ostream Out(Buffer);
- Out << "Target architecture " << CudaArchToString(Arch)
+ Out ...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/97028
More information about the cfe-commits
mailing list