Skip to content

Commit b6ec0c8

Browse files
rocm-cizhang2amd
authored andcommitted
SWDEV-343493 / SWDEV-363133 - hipcc ignores --rocm-path if env var such as ROCM_PATH is set (#2974)
Change-Id: I5723694158f35b73dc0c93e9dd9ee6666df1ca72
1 parent 9b1caa6 commit b6ec0c8

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

bin/hipcc.pl

+20-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@
5252
exit(-1);
5353
}
5454

55+
# retrieve --rocm-path hipcc option from command line.
56+
# We need to respect this over the env var ROCM_PATH for this compilation.
57+
sub get_rocm_path_option {
58+
my $rocm_path="";
59+
my @CLArgs = @ARGV;
60+
foreach $arg (@CLArgs) {
61+
if (index($arg,"--rocm-path=") != -1) {
62+
($rocm_path) = $arg=~ /=\s*(.*)\s*$/;
63+
}
64+
}
65+
return $rocm_path;
66+
}
67+
5568
$verbose = $ENV{'HIPCC_VERBOSE'} // 0;
5669
# Verbose: 0x1=commands, 0x2=paths, 0x4=hipcc args
5770

@@ -88,12 +101,18 @@ sub delete_temp_dirs {
88101
}
89102

90103
my $base_dir;
104+
my $rocmPath;
91105
BEGIN {
92106
$base_dir = dirname(Cwd::realpath(__FILE__) );
107+
$rocmPath = get_rocm_path_option();
108+
if ($rocmPath ne '') {
109+
# --rocm-path takes precedence over ENV{ROCM_PATH}
110+
$ENV{ROCM_PATH}=$rocmPath;
111+
}
93112
}
94113
use lib "$base_dir/";
95-
use hipvars;
96114

115+
use hipvars;
97116
$isWindows = $hipvars::isWindows;
98117
$HIP_RUNTIME = $hipvars::HIP_RUNTIME;
99118
$HIP_PLATFORM = $hipvars::HIP_PLATFORM;

0 commit comments

Comments
 (0)