File pytorch-hipify-rocm_version_h-path.patch of Package python-torch-oldstable

diff --git a/torch/utils/hipify/cuda_to_hip_mappings.py b/torch/utils/hipify/cuda_to_hip_mappings.py
index 3e4f5de43..e1e3b7b08 100644
--- a/torch/utils/hipify/cuda_to_hip_mappings.py
+++ b/torch/utils/hipify/cuda_to_hip_mappings.py
@@ -38,10 +38,14 @@ except (FileNotFoundError, PermissionError, NotADirectoryError):
     # Do not print warning. This is okay. This file can also be imported for non-ROCm builds.
     pass
 
+hip_path = os.environ.get('HIP_PATH') or "/usr"
+
 rocm_version = (0, 0, 0)
 rocm_version_h = f"{rocm_path}/include/rocm-core/rocm_version.h"
 if not os.path.isfile(rocm_version_h):
     rocm_version_h = f"{rocm_path}/include/rocm_version.h"
+if not os.path.isfile(rocm_version_h):
+    rocm_version_h = f"{hip_path}/include/rocm-core/rocm_version.h"
 
 # The file could be missing due to 1) ROCm version < 5.2, or 2) no ROCm install.
 if os.path.isfile(rocm_version_h):
@@ -60,6 +64,7 @@ if os.path.isfile(rocm_version_h):
         if match:
             patch = int(match.group(1))
     rocm_version = (major, minor, patch)
+print(f"Determined ROCm version {rocm_version}")
 
 # List of math functions that should be replaced inside device code only.
 MATH_TRANSPILATIONS = collections.OrderedDict(
openSUSE Build Service is sponsored by