Skip to content

Commit

Permalink
Merge pull request ROCm#110 from ROCm-Developer-Tools/promotion/mainl…
Browse files Browse the repository at this point in the history
…ine/2023.07.17

Promote develop branch (as of ecda567) to mainline
  • Loading branch information
kzhuravl committed Jul 17, 2023
2 parents 2ec3de4 + 99b493b commit fb3ee7b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
22 changes: 8 additions & 14 deletions amd/hipcc/bin/hipcc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,17 @@ BEGIN
if($isWindows) {
$execExtension = ".exe";
}
$HIPCC="$HIP_CLANG_PATH/clang++" . $execExtension;
$HIPCC="\"$HIP_CLANG_PATH/clang++" . $execExtension . "\"";

# If $HIPCC clang++ is not compiled, use clang instead
if ( ! -e $HIPCC ) {
$HIPCC="$HIP_CLANG_PATH/clang" . $execExtension;
$HIPCC="\"$HIP_CLANG_PATH/clang" . $execExtension . "\"";
$HIPLDFLAGS = "--driver-mode=g++";
}
# to avoid using dk linker or MSVC linker
if($isWindows) {
$HIPLDFLAGS .= " -fuse-ld=lld";
$HIPLDFLAGS .= " --ld-path=$HIP_CLANG_PATH/lld-link.exe";

# escape possible spaces in path name
$HIPCC =~ s/\s/\\$&/g;
$HIPLDFLAGS .= " --ld-path=\"$HIP_CLANG_PATH/lld-link.exe\"";
}

# get Clang RT Builtin path
Expand Down Expand Up @@ -204,12 +201,12 @@ BEGIN
print ("CUDA_PATH=$CUDA_PATH\n");
}

$HIPCC="$CUDA_PATH/bin/nvcc";
$HIPCC="\"$CUDA_PATH/bin/nvcc\"";
$HIPCXXFLAGS .= " -Wno-deprecated-gpu-targets ";
$HIPCXXFLAGS .= " -isystem $CUDA_PATH/include";
$HIPCFLAGS .= " -isystem $CUDA_PATH/include";
$HIPCXXFLAGS .= " -isystem \"$CUDA_PATH/include\"";
$HIPCFLAGS .= " -isystem \"$CUDA_PATH/include\"";

$HIPLDFLAGS = " -Wno-deprecated-gpu-targets -lcuda -lcudart -L$CUDA_PATH/lib64";
$HIPLDFLAGS = " -Wno-deprecated-gpu-targets -lcuda -lcudart -L\"$CUDA_PATH/lib64\"";
} else {
printf ("error: unknown HIP_PLATFORM = '$HIP_PLATFORM'");
printf (" or HIP_COMPILER = '$HIP_COMPILER'");
Expand Down Expand Up @@ -469,10 +466,7 @@ BEGIN
if (not $isWindows and $escapeArg) {
$arg =~ s/[^-a-zA-Z0-9_=+,.\/]/\\$&/g;
}
if ($isWindows and $escapeArg) {
$arg =~ s/[^-a-zA-Z0-9_=+,.:\/\\]/\\$&/g;
}
$toolArgs .= " $arg" unless $swallowArg;
$toolArgs .= " \"$arg\"" unless $swallowArg;
$prevArg = $arg;
}

Expand Down
8 changes: 6 additions & 2 deletions amd/hipcc/bin/hipvars.pm
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ $isWindows = ($^O eq 'MSWin32' or $^O eq 'msys');
# ROCM_PATH is defined relative to HIP_PATH else it is hardcoded to /opt/rocm.
#
$HIP_PATH=$ENV{'HIP_PATH'} // dirname(Cwd::abs_path("$0/../")); # use parent directory of hipcc
if ($isWindows and defined $ENV{'HIP_PATH'}) {
$HIP_PATH =~ s/^"(.*)"$/$1/;
$HIP_PATH =~ s/\\/\//g;
}
if (-e "$HIP_PATH/bin/rocm_agent_enumerator") {
$ROCM_PATH=$ENV{'ROCM_PATH'} // "$HIP_PATH"; # use HIP_PATH
}elsif (-e "$HIP_PATH/../bin/rocm_agent_enumerator") { # case for backward compatibility
Expand All @@ -84,7 +88,7 @@ if (-e "$HIP_PATH/bin/rocm_agent_enumerator") {
$CUDA_PATH=$ENV{'CUDA_PATH'} // '/usr/local/cuda';

# Windows/Distro's have a different structure, all binaries are with hipcc
if (-e "$HIP_PATH/bin/clang" or -e "$HIP_PATH/bin/clang.exe") {
if ($isWindows or -e "$HIP_PATH/bin/clang") {
$HIP_CLANG_PATH=$ENV{'HIP_CLANG_PATH'} // "$HIP_PATH/bin";
} else {
$HIP_CLANG_PATH=$ENV{'HIP_CLANG_PATH'} // "$ROCM_PATH/llvm/bin";
Expand Down Expand Up @@ -120,7 +124,7 @@ if (defined $HIP_RUNTIME and $HIP_RUNTIME eq "rocclr" and !defined $HIP_ROCCLR_H
}

if (not defined $HIP_PLATFORM) {
if (can_run("$HIP_CLANG_PATH/clang++") or can_run("clang++")) {
if (can_run("\"$HIP_CLANG_PATH/clang++\"") or can_run("clang++")) {
$HIP_PLATFORM = "amd";
} elsif (can_run("$CUDA_PATH/bin/nvcc") or can_run("nvcc")) {
$HIP_PLATFORM = "nvidia";
Expand Down

0 comments on commit fb3ee7b

Please sign in to comment.