Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hipcc] Populate compiler and linker flags on AMD platform #185

Open
wants to merge 1 commit into
base: amd-staging
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions amd/hipcc/src/hipBin_amd.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,17 @@ void HipBinAmd::initializeHipLdFlags() {
if (!fs::exists(hipCC)) {
hipLdFlags = "--driver-mode=g++";
}
string hipLib = getHipLibPath();
hipLdFlags += " -L \"" + hipLib + "\"" + " -lamdhip64";
hipLdFlags_ = hipLdFlags;
}

void HipBinAmd::initializeHipCFlags() {
string hipCFlags;
string hipIncludePath = getHipInclude();
hipCFlags += " -isystem \"" + hipIncludePath + "\"";

hipCFlags_ = hipCFlags;
}

const string& HipBinAmd::getHipCXXFlags() const {
Expand Down Expand Up @@ -192,6 +199,8 @@ void HipBinAmd::initializeHipCXXFlags() {
hipCXXFlags +=
" -Xclang -fallow-half-arguments-and-returns -D__HIP_HCC_COMPAT_MODE__=1";
}
string hipIncludePath = getHipInclude();
hipCXXFlags += " -isystem \"" + hipIncludePath + "\"";

hipCXXFlags_ = hipCXXFlags;
}
Expand Down Expand Up @@ -367,16 +376,15 @@ bool HipBinAmd::detectPlatform() {
}

string HipBinAmd::getHipLibPath() const {
string hipLibPath;
const EnvVariables& env = getEnvVariables();
if (!env.hipLibPathEnv_.empty()) {
hipLibPath = env.hipLibPathEnv_;
}
else if (!env.hipPathEnv_.empty()) {
fs::path p = env.hipLibPathEnv_;
p /= "lib";
hipLibPath = p.string();
const string& rocclrHomePath = getRocclrHomePath();
fs::path hipLibfs = rocclrHomePath;
hipLibfs /= "lib";
if (hipLibfs.string().empty()) {
const string& hipPath = getHipPath();
hipLibfs = hipPath;
hipLibfs /= "include";
}
string hipLibPath = hipLibfs.string();
return hipLibPath;
}

Expand Down