Skip to content

Commit 5ec3d36

Browse files
agunasheSyamaAmd
authored andcommitted
SWDEV-475293 - strip --hip-path and --rocm-path for nvidia
Change-Id: Ib4ef8d4e9e2f964be8aaad5f0b3e4aa3b8d7fec0 (cherry picked from commit 50a97b7)
1 parent 8921bcb commit 5ec3d36

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

amd/hipcc/bin/hipcc.pl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,11 @@ sub get_normalized_path {
267267
$trimarg =~ s/^\s+|\s+$//g; # Remive whitespace
268268
my $swallowArg = 0;
269269
my $escapeArg = 1;
270+
if ($HIP_PLATFORM eq "nvidia") {
271+
if (($trimarg =~ /--rocm-path/) or ($trimarg =~ /--hip-path/)) {
272+
next;
273+
}
274+
}
270275
if ($arg eq '-c' or $arg eq '--genco' or $arg eq '-E') {
271276
$compileOnly = 1;
272277
$needLDFLAGS = 0;

amd/hipcc/src/hipBin_nvidia.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,10 @@ void HipBinNvidia::executeHipCCCmd(vector<string> argv) {
396396
for (unsigned int i = 2; i < argv.size(); i++) {
397397
string isaarg = argv.at(i);
398398
ISACMD += " ";
399-
if (!hipBinUtilPtr_->substringPresent(isaarg,"--rocm-path=")) {
399+
if (hipBinUtilPtr_->substringPresent(isaarg,"--rocm-path=") ||
400+
hipBinUtilPtr_->substringPresent(isaarg,"--hip-path=")) {
401+
ISACMD += "-I" + hipBinUtilPtr_->splitStr(isaarg, '=')[1] + "/include";
402+
} else {
400403
ISACMD += isaarg;
401404
}
402405
}
@@ -417,6 +420,12 @@ void HipBinNvidia::executeHipCCCmd(vector<string> argv) {
417420
string trimarg = hipBinUtilPtr_->replaceRegex(arg, toRemove, "");
418421
bool swallowArg = false;
419422
bool escapeArg = true;
423+
// do not pass amd paths to nvcc
424+
if (hipBinUtilPtr_->substringPresent(arg,"--rocm-path=") ||
425+
hipBinUtilPtr_->substringPresent(arg,"--hip-path=")) {
426+
continue;
427+
}
428+
420429
if (arg == "-c" || arg == "--genco" || arg == "-E") {
421430
compileOnly = true;
422431
needLDFLAGS = false;

0 commit comments

Comments
 (0)