Skip to content

Commit

Permalink
[CUDA][FIX] Fix name conflict in getNVPTXTargetFeatures
Browse files Browse the repository at this point in the history
Summary:
There was a naming conflict in the getNVPTXTargetFeatures function that
prevented some compilers from correctly disambiguating between the
enumeration and variable of the same name. Rename the variable to avoid
this.
  • Loading branch information
jhuber6 committed Mar 24, 2022
1 parent f74413d commit d912232
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions clang/lib/Driver/ToolChains/Cuda.cpp
Expand Up @@ -633,17 +633,17 @@ void NVPTX::OpenMPLinker::ConstructJob(Compilation &C, const JobAction &JA,
void NVPTX::getNVPTXTargetFeatures(const Driver &D, const llvm::Triple &Triple,
const llvm::opt::ArgList &Args,
std::vector<StringRef> &Features,
Optional<clang::CudaVersion> CudaVersion) {
if (!CudaVersion) {
Optional<clang::CudaVersion> Version) {
if (!Version) {
CudaInstallationDetector CudaInstallation(D, Triple, Args);
CudaVersion = CudaInstallation.version();
Version = CudaInstallation.version();
}

// New CUDA versions often introduce new instructions that are only supported
// by new PTX version, so we need to raise PTX level to enable them in NVPTX
// back-end.
const char *PtxFeature = nullptr;
switch (*CudaVersion) {
switch (*Version) {
#define CASE_CUDA_VERSION(CUDA_VER, PTX_VER) \
case CudaVersion::CUDA_##CUDA_VER: \
PtxFeature = "+ptx" #PTX_VER; \
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Driver/ToolChains/Cuda.h
Expand Up @@ -127,7 +127,7 @@ class LLVM_LIBRARY_VISIBILITY OpenMPLinker : public Tool {
void getNVPTXTargetFeatures(const Driver &D, const llvm::Triple &Triple,
const llvm::opt::ArgList &Args,
std::vector<StringRef> &Features,
Optional<clang::CudaVersion> CudaVersion = None);
Optional<clang::CudaVersion> Version = None);

} // end namespace NVPTX
} // end namespace tools
Expand Down

0 comments on commit d912232

Please sign in to comment.