[PATCH] D77885: AMDGPU: Search for new ROCm bitcode library structure

Matt Arsenault via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 10 10:03:20 PDT 2020


arsenm created this revision.
arsenm added reviewers: yaxunl, b-sumner, hliao.
Herald added subscribers: kerbowa, t-tye, tpr, dstuttard, nhaehnle, wdng, jvesely, kzhuravl.

The current install situation is a mess, but I'm working on fixing
it. Search for the target layout instead of one of the N options that
exist today.


https://reviews.llvm.org/D77885

Files:
  clang/lib/Driver/ToolChains/AMDGPU.cpp
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/hip.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/ockl.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_correctly_rounded_sqrt_on.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_daz_opt_off.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_daz_opt_on.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_finite_only_off.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_finite_only_on.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_isa_version_1010.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_isa_version_1011.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_isa_version_1012.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_isa_version_803.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_isa_version_900.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_unsafe_math_off.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_unsafe_math_on.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_wavefrontsize64_off.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/oclc_wavefrontsize64_on.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/ocml.bc
  clang/test/Driver/Inputs/rocm-device-libs/amdgcn/bitcode/opencl.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/hip.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/ockl.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_correctly_rounded_sqrt_off.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_correctly_rounded_sqrt_on.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_daz_opt_off.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_daz_opt_on.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_finite_only_off.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_finite_only_on.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_isa_version_1010.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_isa_version_1011.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_isa_version_1012.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_isa_version_803.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_isa_version_900.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_unsafe_math_off.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_unsafe_math_on.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_wavefrontsize64_off.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/oclc_wavefrontsize64_on.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/ocml.amdgcn.bc
  clang/test/Driver/Inputs/rocm-device-libs/lib/opencl.amdgcn.bc


Index: clang/lib/Driver/ToolChains/AMDGPU.cpp
===================================================================
--- clang/lib/Driver/ToolChains/AMDGPU.cpp
+++ clang/lib/Driver/ToolChains/AMDGPU.cpp
@@ -65,30 +65,18 @@
     if (InstallPath.empty() || !D.getVFS().exists(InstallPath))
       continue;
 
-    // FIXME: The install path situation is a real mess.
-
-    // For a cmake install, these are placed directly in
-    // ${INSTALL_PREFIX}/lib
-
-    // In the separate OpenCL builds, the bitcode libraries are placed in
-    // ${OPENCL_ROOT}/lib/x86_64/bitcode/*
-
-    // For the rocm installed packages, these are placed at
-    // /opt/rocm/opencl/lib/x86_64/bitcode
-
-    // An additional copy is installed, in scattered locations between
-    // /opt/rocm/hcc/rocdl/oclc
-    // /opt/rocm/hcc/rocdl/ockl
-    // /opt/rocm/hcc/rocdl/lib
+    // The install path situation in old versions of ROCm is a real mess, and
+    // use a different install layout. Multiple copies of the device libraries
+    // exist for each frontend project, and differ depending on which build
+    // system produced the packages. Standalone OpenCL builds also have a
+    // different directory structure from the ROCm OpenCL package.
     //
-    // Yet another complete set is installed to
-    // /opt/rocm/hcc/rocdl/lib
-
-    // For now just recognize the opencl package layout.
+    // The desired structure is (${ROCM_ROOT} or
+    // ${OPENCL_ROOT})/amdgcn/bitcode/*, so try to detect this layout.
 
     // BinPath = InstallPath + "/bin";
     llvm::sys::path::append(IncludePath, InstallPath, "include");
-    llvm::sys::path::append(LibDevicePath, InstallPath, "lib");
+    llvm::sys::path::append(LibDevicePath, InstallPath, "amdgcn", "bitcode");
 
     auto &FS = D.getVFS();
 
@@ -99,7 +87,7 @@
     if (CheckLibDevice && !FS.exists(LibDevicePath))
       continue;
 
-    const StringRef Suffix(".amdgcn.bc");
+    const StringRef Suffix(".bc");
 
     std::error_code EC;
     for (llvm::sys::fs::directory_iterator LI(LibDevicePath, EC), LE;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77885.256597.patch
Type: text/x-patch
Size: 2055 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200410/7c5ba742/attachment-0001.bin>


More information about the cfe-commits mailing list