Skip to content

Commit 5e9e474

Browse files
authored
Merge pull request #19 from agunashe/returnCode_deviceLibPath
SWDEV-326661 - device_lib_path, return error code when build fails
2 parents 92a2f08 + a40db81 commit 5e9e474

File tree

3 files changed

+7
-30
lines changed

3 files changed

+7
-30
lines changed

amd/hipcc/src/hipBin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ void HipBin::executeHipBin(string filename, int argc, char* argv[]) {
112112
cout << "Command " << filename
113113
<< " not supported. Name the exe as hipconfig"
114114
<< " or hipcc and then try again ..." << endl;
115+
exit(-1);
115116
}
116117
}
117118

amd/hipcc/src/hipBin_amd.h

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,13 @@ string HipBinAmd::getCppConfig() {
359359
}
360360

361361
string HipBinAmd::getDeviceLibPath() const {
362-
string deviceLibPath;
363362
const EnvVariables& var = getEnvVariables();
364363
const string& rocclrHomePath = getRocclrHomePath();
365364
const string& roccmPath = getRoccmPath();
366365
fs::path bitCodePath = rocclrHomePath;
367366
bitCodePath /= "lib/bitcode";
368-
if (var.deviceLibPathEnv_.empty() && fs::exists(bitCodePath)) {
367+
string deviceLibPath = var.deviceLibPathEnv_;
368+
if (deviceLibPath.empty() && fs::exists(bitCodePath)) {
369369
deviceLibPath = bitCodePath.string();
370370
}
371371

@@ -1160,20 +1160,8 @@ void HipBinAmd::executeHipCCCmd(vector<string> argv) {
11601160
sysOut = hipBinUtilPtr_->exec(CMD.c_str(), true);
11611161
string cmdOut = sysOut.out;
11621162
int CMD_EXIT_CODE = sysOut.exitCode;
1163-
if (CMD_EXIT_CODE == -1) {
1164-
cout << "failed to execute: $!\n";
1165-
} else if (CMD_EXIT_CODE & 127) {
1166-
string childOut;
1167-
int childCode;
1168-
(CMD_EXIT_CODE & 127), (CMD_EXIT_CODE & 128) ?
1169-
childOut = "with" : childOut = "without";
1170-
(CMD_EXIT_CODE & 127), (CMD_EXIT_CODE & 128) ?
1171-
childCode = (CMD_EXIT_CODE & 127) :
1172-
childCode = (CMD_EXIT_CODE & 128);
1173-
cout << "child died with signal " << childCode << "," << childOut <<
1174-
" coredump "<< " for cmd: " << CMD << endl;
1175-
} else {
1176-
CMD_EXIT_CODE = CMD_EXIT_CODE >> 8;
1163+
if (CMD_EXIT_CODE !=0) {
1164+
cout << "failed to execute:" << CMD << std::endl;
11771165
}
11781166
exit(CMD_EXIT_CODE);
11791167
} // end of runCmd section

amd/hipcc/src/hipBin_nvidia.h

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -591,20 +591,8 @@ void HipBinNvidia::executeHipCCCmd(vector<string> argv) {
591591
sysOut = hipBinUtilPtr_->exec(CMD.c_str(), true);
592592
string cmdOut = sysOut.out;
593593
int CMD_EXIT_CODE = sysOut.exitCode;
594-
if (CMD_EXIT_CODE == -1) {
595-
cout << "failed to execute: $!\n";
596-
} else if (CMD_EXIT_CODE & 127) {
597-
string childOut;
598-
int childCode;
599-
(CMD_EXIT_CODE & 127), (CMD_EXIT_CODE & 128) ?
600-
childOut = "with" : childOut = "without";
601-
(CMD_EXIT_CODE & 127), (CMD_EXIT_CODE & 128) ?
602-
childCode = (CMD_EXIT_CODE & 127) :
603-
childCode = (CMD_EXIT_CODE & 128);
604-
cout << "child died with signal " << childCode << "," <<
605-
childOut << " coredump "<< " for cmd: " << CMD << endl;
606-
} else {
607-
CMD_EXIT_CODE = CMD_EXIT_CODE >> 8;
594+
if (CMD_EXIT_CODE !=0) {
595+
cout << "failed to execute:" << CMD << std::endl;
608596
}
609597
exit(CMD_EXIT_CODE);
610598
}

0 commit comments

Comments
 (0)