@@ -77,6 +77,8 @@ CudaVersion getCudaVersion(uint32_t raw_version) {
7777 return CudaVersion::CUDA_110;
7878 if (raw_version < 11020 )
7979 return CudaVersion::CUDA_111;
80+ if (raw_version < 11030 )
81+ return CudaVersion::CUDA_112;
8082 return CudaVersion::LATEST;
8183}
8284
@@ -131,7 +133,9 @@ CudaInstallationDetector::CudaInstallationDetector(
131133 SmallVector<Candidate, 4 > Candidates;
132134
133135 // In decreasing order so we prefer newer versions to older versions.
134- std::initializer_list<const char *> Versions = {" 8.0" , " 7.5" , " 7.0" };
136+ std::initializer_list<const char *> Versions = {
137+ " 11.4" , " 11.3" , " 11.2" , " 11.1" , " 10.2" , " 10.1" , " 10.0" ,
138+ " 9.2" , " 9.1" , " 9.0" , " 8.0" , " 7.5" , " 7.0" };
135139 auto &FS = D.getVFS ();
136140
137141 if (Args.hasArg (clang::driver::options::OPT_cuda_path_EQ)) {
@@ -193,18 +197,27 @@ CudaInstallationDetector::CudaInstallationDetector(
193197 if (CheckLibDevice && !FS.exists (LibDevicePath))
194198 continue ;
195199
196- // On Linux, we have both lib and lib64 directories, and we need to choose
197- // based on our triple. On MacOS, we have only a lib directory.
198- //
199- // It's sufficient for our purposes to be flexible: If both lib and lib64
200- // exist, we choose whichever one matches our triple. Otherwise, if only
201- // lib exists, we use it.
202- if (HostTriple.isArch64Bit () && FS.exists (InstallPath + " /lib64" ))
203- LibPath = InstallPath + " /lib64" ;
204- else if (FS.exists (InstallPath + " /lib" ))
205- LibPath = InstallPath + " /lib" ;
206- else
207- continue ;
200+ if (HostTriple.isOSWindows ()) {
201+ if (HostTriple.isArch64Bit () && FS.exists (InstallPath + " /lib/x64" ))
202+ LibPath = InstallPath + " /lib/x64" ;
203+ else if (FS.exists (InstallPath + " /lib/Win32" ))
204+ LibPath = InstallPath + " /lib/Win32" ;
205+ else
206+ continue ;
207+ } else {
208+ // On Linux, we have both lib and lib64 directories, and we need to choose
209+ // based on our triple. On MacOS, we have only a lib directory.
210+ //
211+ // It's sufficient for our purposes to be flexible: If both lib and lib64
212+ // exist, we choose whichever one matches our triple. Otherwise, if only
213+ // lib exists, we use it.
214+ if (HostTriple.isArch64Bit () && FS.exists (InstallPath + " /lib64" ))
215+ LibPath = InstallPath + " /lib64" ;
216+ else if (FS.exists (InstallPath + " /lib" ))
217+ LibPath = InstallPath + " /lib" ;
218+ else
219+ continue ;
220+ }
208221
209222 CudaVersionInfo VersionInfo = {" " , CudaVersion::UNKNOWN};
210223 if (auto VersionFile = FS.getBufferForFile (InstallPath + " /version.txt" ))
@@ -722,7 +735,14 @@ void CudaToolChain::addClangTargetOptions(
722735 llvm::sys::path::append (WithInstallPath, Twine (" ../../../share/clc" ));
723736 LibraryPaths.emplace_back (WithInstallPath.c_str ());
724737
725- std::string LibSpirvTargetName = " libspirv-nvptx64--nvidiacl.bc" ;
738+ // Select remangled libclc variant. 64-bit longs default, 32-bit longs on
739+ // Windows
740+ std::string LibSpirvTargetName =
741+ " remangled-l64-signed_char.libspirv-nvptx64--nvidiacl.bc" ;
742+ if (HostTC.getTriple ().isOSWindows ())
743+ LibSpirvTargetName =
744+ " remangled-l32-signed_char.libspirv-nvptx64--nvidiacl.bc" ;
745+
726746 for (StringRef LibraryPath : LibraryPaths) {
727747 SmallString<128 > LibSpirvTargetFile (LibraryPath);
728748 llvm::sys::path::append (LibSpirvTargetFile, LibSpirvTargetName);
0 commit comments