File amd-hipcc-use-rocm-tools.patch of Package rocm-llvm
diff --git a/amd/hipcc/src/hipBin_amd.h b/amd/hipcc/src/hipBin_amd.h
index e845139080c4..4f2dd74a4a95 100644
--- a/amd/hipcc/src/hipBin_amd.h
+++ b/amd/hipcc/src/hipBin_amd.h
@@ -153,7 +153,7 @@ void HipBinAmd::initializeHipLdFlags() {
string hipLdFlags;
const string& hipClangPath = getCompilerPath();
// If $HIPCC clang++ is not compiled, use clang instead
- string hipCC = "\"" + hipClangPath + "/clang++";
+ string hipCC = "\"" + hipClangPath + "/clang++-rocm\"";
if (!fs::exists(hipCC)) {
hipLdFlags = "--driver-mode=g++";
}
@@ -201,15 +201,15 @@ void HipBinAmd::constructCompilerPath() {
const EnvVariables& envVariables = getEnvVariables();
if (envVariables.hipClangPathEnv_.empty()) {
fs::path hipClangPath;
- if (isWindows()) {
+ // if (isWindows()) {
compilerPath = getHipPath();
hipClangPath = compilerPath;
hipClangPath /= "bin";
- } else {
- compilerPath = getRoccmPath();
- hipClangPath = compilerPath;
- hipClangPath /= "lib/llvm/bin";
- }
+ // } else {
+ // compilerPath = getRoccmPath();
+ // hipClangPath = compilerPath;
+ // hipClangPath /= "lib/llvm/bin";
+ // }
compilerPath = hipClangPath.string();
} else {
@@ -240,9 +240,9 @@ void HipBinAmd::printCompilerInfo() const {
system(cmd.c_str()); // ld flags
cout << endl;
} else {
- string cmd = hipClangPath + "/clang++ --version";
+ string cmd = hipClangPath + "/clang++-rocm --version";
system(cmd.c_str()); // hipclang version
- cmd = hipClangPath + "/llc --version";
+ cmd = hipClangPath + "/llc-rocm --version";
system(cmd.c_str()); // llc version
cout << "hip-clang-cxxflags :" << endl;
cmd = hipPath + "/bin/hipcc --cxxflags";
@@ -258,7 +258,7 @@ string HipBinAmd::getCompilerVersion() {
string out, compilerVersion;
const string& hipClangPath = getCompilerPath();
fs::path cmdAmd = hipClangPath;
- cmdAmd /= "clang++";
+ cmdAmd /= "clang++-rocm";
if (canRunCompiler(cmdAmd.string(), out) || canRunCompiler("amdclang++", out)) {
regex regexp("([0-9.]+)");
smatch m;
@@ -340,7 +340,7 @@ bool HipBinAmd::detectPlatform() {
constructCompilerPath();
const string& hipClangPath = getCompilerPath();
fs::path cmdAmd = hipClangPath;
- cmdAmd /= "clang++";
+ cmdAmd /= "clang++-rocm";
const EnvVariables& var = getEnvVariables();
bool detected = false;
if (var.hipPlatformEnv_.empty()) {
@@ -372,8 +372,8 @@ string HipBinAmd::getHipLibPath() const {
hipLibPath = env.hipLibPathEnv_;
}
else if (!env.hipPathEnv_.empty()) {
- fs::path p = env.hipLibPathEnv_;
- p /= "lib";
+ fs::path p = env.hipPathEnv_;
+ p /= "lib" stringify(HIPCC_LIB_SUFFIX);
hipLibPath = p.string();
}
return hipLibPath;
@@ -386,11 +386,11 @@ string HipBinAmd::getHipCC() const {
if (isWindows())
compiler /= "clang.exe";
else
- compiler /= "clang++";
+ compiler /= "clang++-rocm";
if (!fs::exists(compiler)) {
fs::path compiler = hipClangPath;
- compiler /= "clang";
+ compiler /= "clang-rocm";
}
hipCC = compiler.string();
@@ -782,7 +782,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
} else if (os != windows) {
// Else try using rocm_agent_enumerator
string ROCM_AGENT_ENUM;
- ROCM_AGENT_ENUM = roccmPath + "/bin/rocm_agent_enumerator";
+ ROCM_AGENT_ENUM = hipPath + "/bin/rocm_agent_enumerator";
targetsStr = ROCM_AGENT_ENUM +" -t GPU";
SystemCmdOut sysOut = hipBinUtilPtr_->exec(targetsStr.c_str());
regex toReplace("\n+");
diff --git a/amd/hipcc/src/utils.h b/amd/hipcc/src/utils.h
index 426a09e43100..f035c4c94d48 100644
--- a/amd/hipcc/src/utils.h
+++ b/amd/hipcc/src/utils.h
@@ -4,6 +4,8 @@
#include <string>
#include <vector>
+#define stringify(x) #x
+
namespace hipcc {
namespace utils {
// gets the path of the executable name