From 618185c951ec57dbd18a72d7c7134a6849cefc6b Mon Sep 17 00:00:00 2001 From: ROCm CI Service Account <66695075+rocm-ci@users.noreply.github.com> Date: Mon, 10 Oct 2022 15:25:37 +0530 Subject: [PATCH] SWDEV-343493 - hipcc ignores --rocm-path if env var such as ROCM_PATH is set (#2974) Change-Id: I5723694158f35b73dc0c93e9dd9ee6666df1ca72 [ROCm/hip commit: 825225b232c86d2643689e3fa1844aa54b0f5dd9] --- projects/hip/bin/hipcc.pl | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/projects/hip/bin/hipcc.pl b/projects/hip/bin/hipcc.pl index 76163d97b6..da9559be9e 100755 --- a/projects/hip/bin/hipcc.pl +++ b/projects/hip/bin/hipcc.pl @@ -52,6 +52,19 @@ if(scalar @ARGV == 0){ 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 @@ -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;