[clang] a18fe67 - [AMDGCN] Update search path for device libraries
Siu Chi Chan via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 11 08:53:08 PST 2023
Author: Siu Chi Chan
Date: 2023-01-11T11:51:30-05:00
New Revision: a18fe67b9fcf3eb5cdaf8bbd4496f8653e4fc2b5
URL: https://github.com/llvm/llvm-project/commit/a18fe67b9fcf3eb5cdaf8bbd4496f8653e4fc2b5
DIFF: https://github.com/llvm/llvm-project/commit/a18fe67b9fcf3eb5cdaf8bbd4496f8653e4fc2b5.diff
LOG: [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
Added:
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/asanrtl.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/hip.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/ockl.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_abi_version_400.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_abi_version_500.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_correctly_rounded_sqrt_off.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_correctly_rounded_sqrt_on.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_daz_opt_off.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_daz_opt_on.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_finite_only_off.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_finite_only_on.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_1010.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_1011.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_1012.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_803.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_900.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_isa_version_908.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_unsafe_math_off.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_unsafe_math_on.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_wavefrontsize64_off.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/oclc_wavefrontsize64_on.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/ocml.bc
clang/test/Driver/Inputs/rocm_resource_dir/lib/amdgcn/bitcode/opencl.bc
Modified:
clang/lib/Driver/ToolChains/AMDGPU.cpp
clang/test/Driver/hip-device-libs.hip
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp
index 1a2985400ae13..c2882367fe1f3 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
diff erent install layout. Multiple copies of the device libraries
- // exist for each frontend project, and
diff er depending on which build
- // system produced the packages. Standalone OpenCL builds also have a
- //
diff erent 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 <LLVM_DIR>/lib/clang/<ver>/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<const char *, 2> SubDirsList[] = {
- {"amdgcn", "bitcode"},
- {"lib", ""},
- {"lib", "bitcode"},
- };
-
- // Make a path by appending sub-directories to InstallPath.
- auto MakePath = [&](const llvm::ArrayRef<const char *> &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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
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 0000000000000..e69de29bb2d1d
diff --git a/clang/test/Driver/hip-device-libs.hip b/clang/test/Driver/hip-device-libs.hip
index d276f6ea47244..fe58cc9dbd9ac 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"
More information about the cfe-commits
mailing list