Skip to content

Commit

Permalink
SWDEV-343493 / SWDEV-363133 - hipcc ignores --rocm-path if env var su…
Browse files Browse the repository at this point in the history
…ch as ROCM_PATH is set (#2974)

Change-Id: I5723694158f35b73dc0c93e9dd9ee6666df1ca72
  • Loading branch information
rocm-ci authored and zhang2amd committed Oct 28, 2022
1 parent 9b1caa6 commit b6ec0c8
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion bin/hipcc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@
exit(-1);
}

# retrieve --rocm-path hipcc option from command line.
# We need to respect this over the env var ROCM_PATH for this compilation.
sub get_rocm_path_option {
my $rocm_path="";
my @CLArgs = @ARGV;
foreach $arg (@CLArgs) {
if (index($arg,"--rocm-path=") != -1) {
($rocm_path) = $arg=~ /=\s*(.*)\s*$/;
}
}
return $rocm_path;
}

$verbose = $ENV{'HIPCC_VERBOSE'} // 0;
# Verbose: 0x1=commands, 0x2=paths, 0x4=hipcc args

Expand Down Expand Up @@ -88,12 +101,18 @@ sub delete_temp_dirs {
}

my $base_dir;
my $rocmPath;
BEGIN {
$base_dir = dirname(Cwd::realpath(__FILE__) );
$rocmPath = get_rocm_path_option();
if ($rocmPath ne '') {
# --rocm-path takes precedence over ENV{ROCM_PATH}
$ENV{ROCM_PATH}=$rocmPath;
}
}
use lib "$base_dir/";
use hipvars;

use hipvars;
$isWindows = $hipvars::isWindows;
$HIP_RUNTIME = $hipvars::HIP_RUNTIME;
$HIP_PLATFORM = $hipvars::HIP_PLATFORM;
Expand Down

0 comments on commit b6ec0c8

Please sign in to comment.