From 2f69e975b3860e35d7b5a5d105523587be2d05a6 Mon Sep 17 00:00:00 2001 From: Jakub Chlanda Date: Tue, 21 Dec 2021 13:47:44 +0000 Subject: [PATCH 1/5] [SYCL] Use CUDA_PATH as a candidate for path discovery --- clang/lib/Driver/ToolChains/Cuda.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp index 0058def1aacfa..27853bd64b4fe 100644 --- a/clang/lib/Driver/ToolChains/Cuda.cpp +++ b/clang/lib/Driver/ToolChains/Cuda.cpp @@ -136,6 +136,11 @@ CudaInstallationDetector::CudaInstallationDetector( Candidates.emplace_back( Args.getLastArgValue(clang::driver::options::OPT_cuda_path_EQ).str()); } else if (HostTriple.isOSWindows()) { + // CUDA_PATH is set by the installer, prefer it over other versions that + // might be present on the system. + if (const char *CudaPathEnvVar = ::getenv("CUDA_PATH")) + Candidates.emplace_back(CudaPathEnvVar); + for (const char *Ver : Versions) Candidates.emplace_back( D.SysRoot + "/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v" + From 7e8600254b7c7b16a9ca33457f1452e8be29bd5e Mon Sep 17 00:00:00 2001 From: Jakub Chlanda Date: Thu, 13 Jan 2022 13:26:46 +0000 Subject: [PATCH 2/5] Test for cuda path. --- clang/test/Driver/cuda-windows-cuda-path.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 clang/test/Driver/cuda-windows-cuda-path.cpp diff --git a/clang/test/Driver/cuda-windows-cuda-path.cpp b/clang/test/Driver/cuda-windows-cuda-path.cpp new file mode 100644 index 0000000000000..c7ed0cc1f7c89 --- /dev/null +++ b/clang/test/Driver/cuda-windows-cuda-path.cpp @@ -0,0 +1,13 @@ +/// +/// Make sure that CUDA_PATH is picked up correctly when looking for CUDA +/// instalation. +/// + +// REQUIRES: system-windows +// RUN: env CUDA_PATH=%S\Inputs\CUDA_111\usr\local\cuda %clang -fsycl \ +// RUN: -fsycl-targets=nvptx64-nvidia-cuda -### -v %s 2>&1 | \ +// RUN: FileCheck %s + +// CHECK: Found CUDA installation: {{.*}}Inputs\CUDA_111\usr\local\cuda, version 11.1 + +int main() {} From b26aba1628943a953a8eda626c6012065e31c179 Mon Sep 17 00:00:00 2001 From: Jakub Chlanda Date: Thu, 13 Jan 2022 15:00:03 +0100 Subject: [PATCH 3/5] Update clang/test/Driver/cuda-windows-cuda-path.cpp Co-authored-by: Alexey Bader --- clang/test/Driver/cuda-windows-cuda-path.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/test/Driver/cuda-windows-cuda-path.cpp b/clang/test/Driver/cuda-windows-cuda-path.cpp index c7ed0cc1f7c89..dec3e2c73866f 100644 --- a/clang/test/Driver/cuda-windows-cuda-path.cpp +++ b/clang/test/Driver/cuda-windows-cuda-path.cpp @@ -10,4 +10,3 @@ // CHECK: Found CUDA installation: {{.*}}Inputs\CUDA_111\usr\local\cuda, version 11.1 -int main() {} From 99224077d906f58702cfabd81a76c02056e0cfce Mon Sep 17 00:00:00 2001 From: Jakub Chlanda Date: Thu, 13 Jan 2022 14:34:12 +0000 Subject: [PATCH 4/5] white space --- clang/test/Driver/cuda-windows-cuda-path.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/clang/test/Driver/cuda-windows-cuda-path.cpp b/clang/test/Driver/cuda-windows-cuda-path.cpp index dec3e2c73866f..20a3dee7d045b 100644 --- a/clang/test/Driver/cuda-windows-cuda-path.cpp +++ b/clang/test/Driver/cuda-windows-cuda-path.cpp @@ -9,4 +9,3 @@ // RUN: FileCheck %s // CHECK: Found CUDA installation: {{.*}}Inputs\CUDA_111\usr\local\cuda, version 11.1 - From b52d1a367ba9d9289bf98ce976070b742eac9cd8 Mon Sep 17 00:00:00 2001 From: Jakub Chlanda Date: Wed, 19 Jan 2022 09:09:13 +0100 Subject: [PATCH 5/5] Update clang/test/Driver/cuda-windows-cuda-path.cpp Co-authored-by: mdtoguchi --- clang/test/Driver/cuda-windows-cuda-path.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/test/Driver/cuda-windows-cuda-path.cpp b/clang/test/Driver/cuda-windows-cuda-path.cpp index 20a3dee7d045b..ddbf6b1e140da 100644 --- a/clang/test/Driver/cuda-windows-cuda-path.cpp +++ b/clang/test/Driver/cuda-windows-cuda-path.cpp @@ -1,6 +1,6 @@ /// /// Make sure that CUDA_PATH is picked up correctly when looking for CUDA -/// instalation. +/// installation. /// // REQUIRES: system-windows