From 560bee0df3b95d9cf18d5e52d7fa99ffe6b0f488 Mon Sep 17 00:00:00 2001 From: Jeremy Newton Date: Wed, 31 May 2023 10:51:27 -0400 Subject: [PATCH] Improve HIP_CLANG_PATH detection Instead of checking for windows, it seems better to detect the location of the clang binary. Normally distros put clang bin in the same directory as hipcc, so this will improve the experience there too. Change-Id: I506faa15c8cc69500436f2dec3cdfd3f86356fab Signed-off-by: Jeremy Newton --- bin/hipvars.pm | 4 ++-- src/hipBin_amd.h | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/hipvars.pm b/bin/hipvars.pm index bea4ec7..0bf8c69 100644 --- a/bin/hipvars.pm +++ b/bin/hipvars.pm @@ -83,8 +83,8 @@ if (-e "$HIP_PATH/bin/rocm_agent_enumerator") { } $CUDA_PATH=$ENV{'CUDA_PATH'} // '/usr/local/cuda'; -# Windows has a different structure, all binaries are inside hip/bin -if ($isWindows) { +# 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") { $HIP_CLANG_PATH=$ENV{'HIP_CLANG_PATH'} // "$HIP_PATH/bin"; } else { $HIP_CLANG_PATH=$ENV{'HIP_CLANG_PATH'} // "$ROCM_PATH/llvm/bin"; diff --git a/src/hipBin_amd.h b/src/hipBin_amd.h index 21102bc..6401585 100644 --- a/src/hipBin_amd.h +++ b/src/hipBin_amd.h @@ -218,11 +218,14 @@ void HipBinAmd::constructCompilerPath() { if (osInfo == windows) { complierPath = getHipPath(); hipClangPath = complierPath; - hipClangPath /= "bin"; } else { complierPath = getRoccmPath(); hipClangPath = complierPath; + } + if (fs::exists("llvm/bin/clang++")) { hipClangPath /= "llvm/bin"; + } else { + hipClangPath /= "bin"; } complierPath = hipClangPath.string(); } else {