Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL] Use CUDA_PATH as a candidate for path discovery #5194

Merged
merged 5 commits into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions clang/lib/Driver/ToolChains/Cuda.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" +
Expand Down
13 changes: 13 additions & 0 deletions clang/test/Driver/cuda-windows-cuda-path.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
///
/// Make sure that CUDA_PATH is picked up correctly when looking for CUDA
/// instalation.
jchlanda marked this conversation as resolved.
Show resolved Hide resolved
///

// 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 | \
bader marked this conversation as resolved.
Show resolved Hide resolved
mdtoguchi marked this conversation as resolved.
Show resolved Hide resolved
// RUN: FileCheck %s

// CHECK: Found CUDA installation: {{.*}}Inputs\CUDA_111\usr\local\cuda, version 11.1

int main() {}
jchlanda marked this conversation as resolved.
Show resolved Hide resolved