Skip to content

Commit 172e160

Browse files
committed
Return double quote on linux + fix CUDA_PATH
1 parent f44c1b5 commit 172e160

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

amd/hipcc/bin/hipcc.pl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,7 @@ BEGIN
133133
$HIP_ROCCLR_HOME = $hipvars::HIP_ROCCLR_HOME;
134134

135135
sub get_normalized_path {
136-
if ($isWindows) {
137-
return $doubleQuote . $_[0] . $doubleQuote;
138-
} else {
139-
return $_[0];
140-
}
136+
return $doubleQuote . $_[0] . $doubleQuote;
141137
}
142138

143139
if ($HIP_PLATFORM eq "amd") {

amd/hipcc/bin/hipvars.pm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ sub can_run {
6161
}
6262

6363
$isWindows = ($^O eq 'MSWin32' or $^O eq 'msys');
64-
$doubleQuote = "";
65-
if ($isWindows) {
66-
$doubleQuote = "\"";
67-
}
64+
$doubleQuote = "\"";
6865

6966
#
7067
# TODO: Fix rpath LDFLAGS settings
@@ -90,6 +87,10 @@ if (-e "$HIP_PATH/bin/rocm_agent_enumerator") {
9087
$ROCM_PATH=$ENV{'ROCM_PATH'} // "/opt/rocm";
9188
}
9289
$CUDA_PATH=$ENV{'CUDA_PATH'} // '/usr/local/cuda';
90+
if ($isWindows and defined $ENV{'CUDA_PATH'}) {
91+
$CUDA_PATH =~ s/^"(.*)"$/$1/;
92+
$CUDA_PATH =~ s/\\/\//g;
93+
}
9394

9495
# Windows/Distro's have a different structure, all binaries are with hipcc
9596
if ($isWindows or -e "$HIP_PATH/bin/clang") {
@@ -130,7 +131,7 @@ if (defined $HIP_RUNTIME and $HIP_RUNTIME eq "rocclr" and !defined $HIP_ROCCLR_H
130131
if (not defined $HIP_PLATFORM) {
131132
if (can_run($doubleQuote . "$HIP_CLANG_PATH/clang++" . $doubleQuote) or can_run("clang++")) {
132133
$HIP_PLATFORM = "amd";
133-
} elsif (can_run("$CUDA_PATH/bin/nvcc") or can_run("nvcc")) {
134+
} elsif (can_run($doubleQuote . "$CUDA_PATH/bin/nvcc" . $doubleQuote) or can_run("nvcc")) {
134135
$HIP_PLATFORM = "nvidia";
135136
$HIP_COMPILER = "nvcc";
136137
$HIP_RUNTIME = "cuda";

0 commit comments

Comments
 (0)