SWDEV-385406 - [hipcc] Pass HIP_PATH to clang (#3174)
The HIP_PATH env var has been broken by an earlier patch to change the
linking to the HIP runtime with --hip-link in hipcc. We need to detect
when the HIP_PATH env var is defined, we have to pass that to the clang.
Change-Id: Iea939893844cce426d4bc4ace3539fc241363ff3
[ROCm/hip commit: 3fb0920a55]
Dieser Commit ist enthalten in:
committet von
GitHub
Ursprung
c808e5394f
Commit
dd539e475d
@@ -52,15 +52,21 @@ if(scalar @ARGV == 0){
|
||||
|
||||
# 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 {
|
||||
sub get_path_options {
|
||||
my $rocm_path="";
|
||||
my $hip_path="";
|
||||
my @CLArgs = @ARGV;
|
||||
foreach $arg (@CLArgs) {
|
||||
if (index($arg,"--rocm-path=") != -1) {
|
||||
($rocm_path) = $arg=~ /=\s*(.*)\s*$/;
|
||||
next;
|
||||
}
|
||||
if (index($arg,"--hip-path=") != -1) {
|
||||
($hip_path) = $arg=~ /=\s*(.*)\s*$/;
|
||||
next;
|
||||
}
|
||||
}
|
||||
return $rocm_path;
|
||||
return ($rocm_path, $hip_path);
|
||||
}
|
||||
|
||||
$verbose = $ENV{'HIPCC_VERBOSE'} // 0;
|
||||
@@ -99,13 +105,16 @@ sub delete_temp_dirs {
|
||||
}
|
||||
|
||||
my $base_dir;
|
||||
my $rocmPath;
|
||||
BEGIN {
|
||||
$base_dir = dirname(Cwd::realpath(__FILE__) );
|
||||
$rocmPath = get_rocm_path_option();
|
||||
if ($rocmPath ne '') {
|
||||
my ($rocm_path, $hip_path) = get_path_options();
|
||||
if ($rocm_path ne '') {
|
||||
# --rocm-path takes precedence over ENV{ROCM_PATH}
|
||||
$ENV{ROCM_PATH}=$rocmPath;
|
||||
$ENV{ROCM_PATH}=$rocm_path;
|
||||
}
|
||||
if ($hip_path ne '') {
|
||||
# --rocm-path takes precedence over ENV{ROCM_PATH}
|
||||
$ENV{HIP_PATH}=$hip_path;
|
||||
}
|
||||
}
|
||||
use lib "$base_dir/";
|
||||
@@ -556,6 +565,13 @@ if ($HIP_PLATFORM eq "amd") {
|
||||
}
|
||||
}
|
||||
|
||||
# If the HIP_PATH env var is defined, pass that path to Clang
|
||||
if ($ENV{'HIP_PATH'}) {
|
||||
my $hip_path_flag = " --hip-path=\"$HIP_PATH\"";
|
||||
$HIPCXXFLAGS .= $hip_path_flag;
|
||||
$HIPLDFLAGS .= $hip_path_flag;
|
||||
}
|
||||
|
||||
if ($hasHIP) {
|
||||
if (defined $DEVICE_LIB_PATH) {
|
||||
$HIPCXXFLAGS .= " --hip-device-lib-path=\"$DEVICE_LIB_PATH\"";
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren