Skip to content

Commit

Permalink
Stop hipcc from passing --hip-device-lib-path (#56)
Browse files Browse the repository at this point in the history
to clang by default.

Let clang determine device lib path by itself by default.

Only do that if env var DEVICE_LIB_PATH is set.

Change-Id: I403cf3e6a10215f85871f9dad79cd57f67395e59
  • Loading branch information
yxsamliu committed Feb 1, 2023
1 parent 25c471b commit e8a4f17
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions amd/hipcc/src/hipBin_amd.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,28 +331,7 @@ string HipBinAmd::getCppConfig() {

string HipBinAmd::getDeviceLibPath() const {
const EnvVariables& var = getEnvVariables();
const string& rocclrHomePath = getRocclrHomePath();
const string& roccmPath = getRoccmPath();
fs::path bitCodePath = rocclrHomePath;
bitCodePath /= "lib/bitcode";
string deviceLibPath = var.deviceLibPathEnv_;
if (deviceLibPath.empty() && fs::exists(bitCodePath)) {
deviceLibPath = bitCodePath.string();
}

if (deviceLibPath.empty()) {
fs::path amdgcnBitcode = roccmPath;
amdgcnBitcode /= "amdgcn/bitcode";
if (fs::exists(amdgcnBitcode)) {
deviceLibPath = amdgcnBitcode.string();
} else {
// This path is to support an older build of the device library
// TODO(hipcc): To be removed in the future.
fs::path lib = roccmPath;
lib /= "lib";
deviceLibPath = lib.string();
}
}
return deviceLibPath;
}

Expand Down Expand Up @@ -876,9 +855,7 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
}

if (hasHIP) {
fs::path bitcodeFs = roccmPath;
bitcodeFs /= "amdgcn/bitcode";
if (deviceLibPath != bitcodeFs.string()) {
if (!deviceLibPath.empty()) {
string hip_device_lib_str = " --hip-device-lib-path=\""
+ deviceLibPath + "\"";
HIPCXXFLAGS += hip_device_lib_str;
Expand Down

0 comments on commit e8a4f17

Please sign in to comment.