Juan Manuel Martinez =?utf-8?q?Caamaño?=,
Juan Manuel Martinez =?utf-8?q?Caamaño?Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>


================
@@ -456,8 +457,25 @@ void RocmInstallationDetector::detectHIPRuntime() {
     llvm::sys::path::append(BinPath, "bin");
     IncludePath = InstallPath;
     llvm::sys::path::append(IncludePath, "include");
-    LibPath = InstallPath;
-    llvm::sys::path::append(LibPath, "lib");
+
+    // ROCm's lib path is the place where the amdhsa64 library is located.
+    // Probe for it and fallback to /rocm/lib if we cannot find it.
+    StringRef LibAmdHip64 =
+        HostTriple.isOSMSVCRT() ? "amdhip64.lib" : "libamdhip64.so";
+    LibPath.clear();
+    for (StringRef LibPathSuffix : {"lib", "lib64"}) {
----------------
amd-shahab wrote:

Those "non-standard" builds/installs are built using `cmake` invocations like:

```
src/dev/clr
src_hip=/src/hip
bld=/bld/clr
inst=/inst/rocm
hipcc_bin_dir=/inst/rocm/bin
llvm_root=/inst/rocm/llvm
rocm=/inst/rocm

cmake -S ${src}                           \
      -B ${bld}                           \
      -G "Unix Makefiles"                 \
      -D CLR_BUILD_HIP=ON                 \
      -D HIP_COMMON_DIR=${src_hip}        \
      -D HIPCC_BIN_DIR=${hipcc_bin_dir}   \
      -D CMAKE_INSTALL_PREFIX=${inst}     \
      -D HIP_LLVM_ROOT=${llvm_root}       \
      -D CMAKE_PREFIX_PATH=${rocm}        \
      -D CMAKE_BUILD_TYPE=Release
```

The thing is `CMAKE_INSTALL_LIBDIR` is "auto-detected" during these build 
processes (See 
[[1](https://cmake.org/cmake/help/v3.14/module/GNUInstallDirs.html)]), and 
different distros set it differently (for example RHEL/Fedora/Slackware use 
`lib64`). If you want to "fix" this, you have to chase all _our_ code projects 
[2] and ask them to have:

```
set(CMAKE_INSTALL_LIBDIR "lib")
```
For the record, I advise against that. This is not normal.

[1] CMake -- GNUInstallDirs
https://cmake.org/cmake/help/v3.14/module/GNUInstallDirs.html

[2] Projects that I've tried and install in `lib64` based on their 
`CMakeList.txt`
```
$ tree -L 1 /inst/rocm/lib64

  [ removed symlinks from the output to de-clutter it ]

  /inst/rocm/lib64
  |-- cmake/
  |-- libamd_comgr.so.3.0.0
  |-- libamdhip64.so.6.4.43480-6057b6836
  |-- libhiprtc-builtins.so.6.4.43480-6057b6836
  |-- libhiprtc.so.6.4.43480-6057b6836
  |-- libhsa-runtime64.so.1.16.0
  |-- libhsakmt.a
  |-- librocm-dbgapi.so.0.77.3
  `-- pkgconfig/
```

https://github.com/llvm/llvm-project/pull/211587
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to