From a18fe67b9fcf3eb5cdaf8bbd4496f8653e4fc2b5 Mon Sep 17 00:00:00 2001 From: Siu Chi Chan Date: Wed, 11 Jan 2023 11:48:20 -0500 Subject: [PATCH] [AMDGCN] Update search path for device libraries - Add support for finding device libraries in new ROCm directory structure - Simplify and remove the handling of legacy ROCm directory structure Change-Id: I04da3bc9da85ced4b56b0225efb6b94448b8c5a1 Reviewed By: yaxunl Differential Revision: https://reviews.llvm.org/D140315 --- clang/lib/Driver/ToolChains/AMDGPU.cpp | 84 +++++++++------------- .../lib/amdgcn/bitcode/asanrtl.bc | 0 .../rocm_resource_dir/lib/amdgcn/bitcode/hip.bc | 0 .../rocm_resource_dir/lib/amdgcn/bitcode/ockl.bc | 0 .../lib/amdgcn/bitcode/oclc_abi_version_400.bc | 0 .../lib/amdgcn/bitcode/oclc_abi_version_500.bc | 0 .../bitcode/oclc_correctly_rounded_sqrt_off.bc | 0 .../bitcode/oclc_correctly_rounded_sqrt_on.bc | 0 .../lib/amdgcn/bitcode/oclc_daz_opt_off.bc | 0 .../lib/amdgcn/bitcode/oclc_daz_opt_on.bc | 0 .../lib/amdgcn/bitcode/oclc_finite_only_off.bc | 0 .../lib/amdgcn/bitcode/oclc_finite_only_on.bc | 0 .../lib/amdgcn/bitcode/oclc_isa_version_1010.bc | 0 .../lib/amdgcn/bitcode/oclc_isa_version_1011.bc | 0 .../lib/amdgcn/bitcode/oclc_isa_version_1012.bc | 0 .../lib/amdgcn/bitcode/oclc_isa_version_803.bc | 0 .../lib/amdgcn/bitcode/oclc_isa_version_900.bc | 0 .../lib/amdgcn/bitcode/oclc_isa_version_908.bc | 0 .../lib/amdgcn/bitcode/oclc_unsafe_math_off.bc | 0 .../lib/amdgcn/bitcode/oclc_unsafe_math_on.bc | 0 .../lib/amdgcn/bitcode/oclc_wavefrontsize64_off.bc | 0 .../lib/amdgcn/bitcode/oclc_wavefrontsize64_on.bc | 0 .../rocm_resource_dir/lib/amdgcn/bitcode/ocml.bc | 0 .../rocm_resource_dir/lib/amdgcn/bitcode/opencl.bc | 0 clang/test/Driver/hip-device-libs.hip | 74 ++++++++++++------- 25 files changed, 83 insertions(+), 75 deletions(-) create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/asanrtl.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/hip.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/ockl.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_abi_version_400.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_abi_version_500.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_correctly_rounded_sqrt_on.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_daz_opt_off.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_daz_opt_on.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_finite_only_off.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_finite_only_on.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_1010.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_1011.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_1012.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_803.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_900.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_908.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_unsafe_math_off.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_unsafe_math_on.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_wavefrontsize64_off.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_wavefrontsize64_on.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/ocml.bc create mode 100644 clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/opencl.bc diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp index 1a29854..c288236 100644 --- a/clang/lib/Driver/ToolChains/AMDGPU.cpp +++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp @@ -9,6 +9,7 @@ #include "AMDGPU.h" #include "CommonArgs.h" #include "clang/Basic/TargetID.h" +#include "clang/Config/config.h" #include "clang/Driver/Compilation.h" #include "clang/Driver/Distro.h" #include "clang/Driver/DriverDiagnostic.h" @@ -391,61 +392,44 @@ void RocmInstallationDetector::detectDeviceLibrary() { return; } - // 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. - auto &ROCmDirs = getInstallationPathCandidates(); - for (const auto &Candidate : ROCmDirs) { - auto CandidatePath = Candidate.Path; + // Check device library exists at the given path. + auto CheckDeviceLib = [&](StringRef Path, bool StrictChecking) { + bool CheckLibDevice = (!NoBuiltinLibs || StrictChecking); + if (CheckLibDevice && !FS.exists(Path)) + return false; - // Check device library exists at the given path. - auto CheckDeviceLib = [&](StringRef Path) { - bool CheckLibDevice = (!NoBuiltinLibs || Candidate.StrictChecking); - if (CheckLibDevice && !FS.exists(Path)) + scanLibDevicePath(Path); + + if (!NoBuiltinLibs) { + // Check that the required non-target libraries are all available. + if (!allGenericLibsValid()) return false; - scanLibDevicePath(Path); + // Check that we have found at least one libdevice that we can link in + // if -nobuiltinlib hasn't been specified. + if (LibDeviceMap.empty()) + return false; + } + return true; + }; - if (!NoBuiltinLibs) { - // Check that the required non-target libraries are all available. - if (!allGenericLibsValid()) - return false; + // Find device libraries in /lib/clang//lib/amdgcn/bitcode + LibDevicePath = D.ResourceDir; + llvm::sys::path::append(LibDevicePath, CLANG_INSTALL_LIBDIR_BASENAME, + "amdgcn", "bitcode"); + HasDeviceLibrary = CheckDeviceLib(LibDevicePath, true); + if (HasDeviceLibrary) + return; - // Check that we have found at least one libdevice that we can link in - // if -nobuiltinlib hasn't been specified. - if (LibDeviceMap.empty()) - return false; - } - return true; - }; - - // The possible structures are: - // - ${ROCM_ROOT}/amdgcn/bitcode/* - // - ${ROCM_ROOT}/lib/* - // - ${ROCM_ROOT}/lib/bitcode/* - // so try to detect these layouts. - static constexpr std::array SubDirsList[] = { - {"amdgcn", "bitcode"}, - {"lib", ""}, - {"lib", "bitcode"}, - }; - - // Make a path by appending sub-directories to InstallPath. - auto MakePath = [&](const llvm::ArrayRef &SubDirs) { - auto Path = CandidatePath; - for (auto SubDir : SubDirs) - llvm::sys::path::append(Path, SubDir); - return Path; - }; - - for (auto SubDirs : SubDirsList) { - LibDevicePath = MakePath(SubDirs); - HasDeviceLibrary = CheckDeviceLib(LibDevicePath); - if (HasDeviceLibrary) - return; - } + // Find device libraries in a legacy ROCm directory structure + // ${ROCM_ROOT}/amdgcn/bitcode/* + auto &ROCmDirs = getInstallationPathCandidates(); + for (const auto &Candidate : ROCmDirs) { + LibDevicePath = Candidate.Path; + llvm::sys::path::append(LibDevicePath, "amdgcn", "bitcode"); + HasDeviceLibrary = CheckDeviceLib(LibDevicePath, Candidate.StrictChecking); + if (HasDeviceLibrary) + return; } } diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/asanrtl.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/asanrtl.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/hip.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/hip.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/ockl.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/ockl.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_abi_version_400.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_abi_version_400.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_abi_version_500.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_abi_version_500.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_correctly_rounded_sqrt_on.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_correctly_rounded_sqrt_on.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_daz_opt_off.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_daz_opt_off.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_daz_opt_on.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_daz_opt_on.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_finite_only_off.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_finite_only_off.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_finite_only_on.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_finite_only_on.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_1010.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_1010.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_1011.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_1011.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_1012.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_1012.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_803.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_803.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_900.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_900.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_908.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_908.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_unsafe_math_off.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_unsafe_math_off.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_unsafe_math_on.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_unsafe_math_on.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_wavefrontsize64_off.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_wavefrontsize64_off.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_wavefrontsize64_on.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_wavefrontsize64_on.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/ocml.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/ocml.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/opencl.bc b/clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/opencl.bc new file mode 100644 index 0000000..e69de29 diff --git a/clang/test/Driver/hip-device-libs.hip b/clang/test/Driver/hip-device-libs.hip index d276f6e..fe58cc9 100644 --- a/clang/test/Driver/hip-device-libs.hip +++ b/clang/test/Driver/hip-device-libs.hip @@ -9,7 +9,7 @@ // RUN: --cuda-gpu-arch=gfx803 \ // RUN: --rocm-path=%S/Inputs/rocm \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ -// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD,ROCMDIR // Test subtarget with flushing off by ddefault. @@ -17,7 +17,7 @@ // RUN: --cuda-gpu-arch=gfx900 \ // RUN: --rocm-path=%S/Inputs/rocm \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ -// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD,ROCMDIR // Test explicit flag, opposite of target default. @@ -26,7 +26,7 @@ // RUN: -fgpu-flush-denormals-to-zero \ // RUN: --rocm-path=%S/Inputs/rocm \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ -// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD,ROCMDIR // Test explicit flag, opposite of target default. @@ -35,7 +35,7 @@ // RUN: -fno-gpu-flush-denormals-to-zero \ // RUN: --rocm-path=%S/Inputs/rocm \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ -// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD,ROCMDIR // Test explicit flag, same as target default. @@ -44,7 +44,7 @@ // RUN: -fno-gpu-flush-denormals-to-zero \ // RUN: --rocm-path=%S/Inputs/rocm \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ -// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD,ROCMDIR // Test explicit flag, same as target default. @@ -53,7 +53,7 @@ // RUN: -fgpu-flush-denormals-to-zero \ // RUN: --rocm-path=%S/Inputs/rocm \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ -// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD,ROCMDIR // Test last flag wins, not flushing @@ -62,7 +62,7 @@ // RUN: -fgpu-flush-denormals-to-zero -fno-gpu-flush-denormals-to-zero \ // RUN: --rocm-path=%S/Inputs/rocm \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ -// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD,ROCMDIR // RUN: %clang -### --target=x86_64-linux-gnu \ @@ -70,7 +70,7 @@ // RUN: -fgpu-flush-denormals-to-zero -fno-gpu-flush-denormals-to-zero \ // RUN: --rocm-path=%S/Inputs/rocm \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ -// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,NOFLUSHD,ROCMDIR // RUN: %clang -### --target=x86_64-linux-gnu \ @@ -78,7 +78,7 @@ // RUN: -fno-gpu-flush-denormals-to-zero -fgpu-flush-denormals-to-zero \ // RUN: --rocm-path=%S/Inputs/rocm \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ -// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD,ROCMDIR // RUN: %clang -### --target=x86_64-linux-gnu \ @@ -86,23 +86,44 @@ // RUN: -fno-gpu-flush-denormals-to-zero -fgpu-flush-denormals-to-zero \ // RUN: --rocm-path=%S/Inputs/rocm \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ -// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD,ROCMDIR +// Test finding device lib in resource dir +// RUN: %clang -### --target=x86_64-linux-gnu \ +// RUN: --offload-arch=gfx803 -nogpuinc \ +// RUN: -resource-dir=%S/Inputs/rocm_resource_dir \ +// RUN: %S/Inputs/hip_multiple_inputs/b.hip \ +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD,RESDIR // Test --hip-device-lib-path flag // RUN: %clang -### --target=x86_64-linux-gnu \ // RUN: --cuda-gpu-arch=gfx803 -nogpuinc \ // RUN: --hip-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ -// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD,ROCMDIR +// Test --hip-device-lib-path wins over -resource-dir +// RUN: %clang -### --target=x86_64-linux-gnu \ +// RUN: --cuda-gpu-arch=gfx803 -nogpuinc \ +// RUN: --hip-device-lib-path=%S/Inputs/rocm/amdgcn/bitcode \ +// RUN: -resource-dir=%S/Inputs/rocm_resource_dir \ +// RUN: %S/Inputs/hip_multiple_inputs/b.hip \ +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,FLUSHD,ROCMDIR // Test environment variable HIP_DEVICE_LIB_PATH // RUN: env HIP_DEVICE_LIB_PATH=%S/Inputs/rocm/amdgcn/bitcode \ // RUN: %clang -### --target=x86_64-linux-gnu \ // RUN: --cuda-gpu-arch=gfx900 -nogpuinc \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ -// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,ROCMDIR + +// Test environment variable HIP_DEVICE_LIB_PATH wins over -resource-dir +// RUN: env HIP_DEVICE_LIB_PATH=%S/Inputs/rocm/amdgcn/bitcode \ +// RUN: %clang -### --target=x86_64-linux-gnu \ +// RUN: --cuda-gpu-arch=gfx900 -nogpuinc \ +// RUN: -resource-dir=%S/Inputs/rocm_resource_dir \ +// RUN: %S/Inputs/hip_multiple_inputs/b.hip \ +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,ROCMDIR // Test --gpu-instrument-lib // RUN: %clang -### --target=x86_64-linux-gnu \ @@ -110,7 +131,7 @@ // RUN: --rocm-path=%S/Inputs/rocm \ // RUN: --gpu-instrument-lib=%S/Inputs/hip_multiple_inputs/instrument.bc \ // RUN: %S/Inputs/hip_multiple_inputs/b.hip \ -// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,INST +// RUN: 2>&1 | FileCheck %s --check-prefixes=ALL,INST,ROCMDIR // Test -fast-math // RUN: %clang -### --target=x86_64-linux-gnu --offload-arch=gfx900 \ @@ -181,18 +202,21 @@ // ALL-NOT: error: // ALL: {{"[^"]*clang[^"]*"}} -// ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}hip.bc" -// ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}ocml.bc" -// ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}ockl.bc" - -// FLUSHD-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_daz_opt_on.bc" -// NOFLUSHD-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_daz_opt_off.bc" - -// ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_unsafe_math_off.bc" -// ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_finite_only_off.bc" -// ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_correctly_rounded_sqrt_on.bc" -// ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_wavefrontsize64_on.bc" -// ALL-SAME: "-mlink-builtin-bitcode" "{{.*}}oclc_isa_version_{{[0-9]+}}.bc" + +// RESDIR-SAME: "-mlink-builtin-bitcode" "[[DEVICELIB_DIR:[^"]+(/|\\\\)rocm_resource_dir(/|\\\\)lib(/|\\\\)amdgcn(/|\\\\).*]]hip.bc" +// ROCMDIR-SAME: "-mlink-builtin-bitcode" "[[DEVICELIB_DIR:[^"]+(/|\\\\)rocm(/|\\\\)amdgcn(/|\\\\).*]]hip.bc" + +// ALL-SAME: "-mlink-builtin-bitcode" "[[DEVICELIB_DIR]]ocml.bc" +// ALL-SAME: "-mlink-builtin-bitcode" "[[DEVICELIB_DIR]]ockl.bc" + +// FLUSHD-SAME: "-mlink-builtin-bitcode" "[[DEVICELIB_DIR]]oclc_daz_opt_on.bc" +// NOFLUSHD-SAME: "-mlink-builtin-bitcode" "[[DEVICELIB_DIR]]oclc_daz_opt_off.bc" + +// ALL-SAME: "-mlink-builtin-bitcode" "[[DEVICELIB_DIR]]oclc_unsafe_math_off.bc" +// ALL-SAME: "-mlink-builtin-bitcode" "[[DEVICELIB_DIR]]oclc_finite_only_off.bc" +// ALL-SAME: "-mlink-builtin-bitcode" "[[DEVICELIB_DIR]]oclc_correctly_rounded_sqrt_on.bc" +// ALL-SAME: "-mlink-builtin-bitcode" "[[DEVICELIB_DIR]]oclc_wavefrontsize64_on.bc" +// ALL-SAME: "-mlink-builtin-bitcode" "[[DEVICELIB_DIR]]oclc_isa_version_{{[0-9]+}}.bc" // INST-SAME: "-mlink-builtin-bitcode" "{{.*}}instrument.bc" // FAST: "-mlink-builtin-bitcode" "{{.*}}oclc_daz_opt_off.bc" -- 2.7.4