[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Where to put .hipVersion?



Hi Étienne,

On 2022-07-04 15:20, Étienne Mollier wrote:
Option 3 makes sense in a first time.  I'll be a bit short of
time this week, but may get back at patching it on week end,
unless someone else beats me at it.

There's nothing that can actually move forward until rocm-hipamd makes its way through the new queue, so that sounds grand. I've attached an example of how Option 3 could be implemented. It turns out that hipvars.pm already falls back to hardcoded versions if .hipVersion isn't found, so the change was quite minimal.

Sincerely,
Cory Bloor
diff --git a/hip/bin/hipcc b/hip/bin/hipcc
index 4174ebe..29b27a7 100755
--- a/hip/bin/hipcc
+++ b/hip/bin/hipcc
@@ -105,6 +105,9 @@ $ROCM_PATH      =   $hipvars::ROCM_PATH;
 $HIP_VERSION    =   $hipvars::HIP_VERSION;
 $HSA_PATH       =   $hipvars::HSA_PATH;
 $HIP_ROCCLR_HOME =   $hipvars::HIP_ROCCLR_HOME;
+$HIP_VERSION_MAJOR = $hipvars::HIP_VERSION_MAJOR;
+$HIP_VERSION_MINOR = $hipvars::HIP_VERSION_MINOR;
+$HIP_VERSION_PATCH = $hipvars::HIP_VERSION_PATCH;
 
 if ($HIP_PLATFORM eq "amd") {
   # If using ROCclr runtime, need to find HIP_ROCCLR_HOME
@@ -208,6 +208,12 @@ if ($HIP_PLATFORM eq "amd") {
         $HIPCFLAGS .= " -isystem $HSA_PATH/include";
     }
 
+    # debian: there is no FHS compliant location for .hipVersion where clang will still be
+    # able to find it, so .hipVersion has been omitted and the hip version is passed explicitly
+    $HIPCXXFLAGS .= " --hip-version=$HIP_VERSION_MAJOR.$HIP_VERSION_MINOR.$HIP_VERSION_PATCH";
+    $HIPCFLAGS .= " --hip-version=$HIP_VERSION_MAJOR.$HIP_VERSION_MINOR.$HIP_VERSION_PATCH";
+    $HIPLDFLAGS .= " --hip-version=$HIP_VERSION_MAJOR.$HIP_VERSION_MINOR.$HIP_VERSION_PATCH";
+
 } elsif ($HIP_PLATFORM eq "nvidia") {
     $CUDA_PATH=$ENV{'CUDA_PATH'} // '/usr/local/cuda';
     $HIP_INCLUDE_PATH = "$HIP_PATH/include";

Reply to: