Skip to content

Commit 9dd18ca

Browse files
authored
[SYCL] Link SYCL device libraries by default. (#2400)
As not all backends have supported spv file online link, we decided to disable fallback spv libraries online link at this time. Instead, all wrapper and fallback .o files will be linked offline. When all backends support spv online link, we will switch to online link for jit compilation transparently. Signed-off-by: gejin <[email protected]>
1 parent fe714e0 commit 9dd18ca

27 files changed

+583
-516
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3561,6 +3561,15 @@ def fsycl_dead_args_optimization : Flag<["-"], "fsycl-dead-args-optimization">,
35613561
def fno_sycl_dead_args_optimization : Flag<["-"], "fno-sycl-dead-args-optimization">,
35623562
Group<sycl_Group>, Flags<[NoArgumentUnused, CoreOption]>, HelpText<"Disables "
35633563
"elimination of DPC++ dead kernel arguments">;
3564+
def fsycl_device_lib_EQ : CommaJoined<["-"], "fsycl-device-lib=">, Group<sycl_Group>, Flags<[DriverOption, CoreOption]>,
3565+
Values<"libc, libm-fp32, libm-fp64, all">, HelpText<"Control inclusion of "
3566+
"device libraries into device binary linkage. Valid arguments "
3567+
"are libc, libm-fp32, libm-fp64, all">;
3568+
def fno_sycl_device_lib_EQ : CommaJoined<["-"], "fno-sycl-device-lib=">, Group<sycl_Group>, Flags<[DriverOption, CoreOption]>,
3569+
Values<"libc, libm-fp32, libm-fp64, all">, HelpText<"Control exclusion of "
3570+
"device libraries from device binary linkage. Valid arguments "
3571+
"are libc, libm-fp32, libm-fp64, all">;
3572+
35643573
//===----------------------------------------------------------------------===//
35653574
// CC1 Options
35663575
//===----------------------------------------------------------------------===//

clang/lib/Driver/Driver.cpp

Lines changed: 117 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
8-
98
#include "clang/Driver/Driver.h"
109
#include "InputInfo.h"
1110
#include "ToolChains/AIX.h"
@@ -2720,6 +2719,16 @@ static SmallVector<const char *, 16> getLinkerArgs(Compilation &C,
27202719
return LibArgs;
27212720
}
27222721

2722+
static bool IsSYCLDeviceLibObj(std::string ObjFilePath, bool isMSVCEnv) {
2723+
StringRef ObjFileName = llvm::sys::path::filename(ObjFilePath);
2724+
StringRef ObjSuffix = isMSVCEnv ? ".obj" : ".o";
2725+
bool Ret =
2726+
(ObjFileName.startswith("libsycl-") && ObjFileName.endswith(ObjSuffix))
2727+
? true
2728+
: false;
2729+
return Ret;
2730+
}
2731+
27232732
// Goes through all of the arguments, including inputs expected for the
27242733
// linker directly, to determine if we need to perform additional work for
27252734
// static offload libraries.
@@ -3798,7 +3807,13 @@ class OffloadingActionBuilder final {
37983807
if (IA->getType() == types::TY_Object) {
37993808
if (!isObjectFile(FileName))
38003809
return ABRT_Inactive;
3801-
if (Args.hasArg(options::OPT_fintelfpga))
3810+
// For SYCL device libraries, don't need to add them to
3811+
// FPGAObjectInputs as there is no FPGA dep files inside.
3812+
3813+
if (Args.hasArg(options::OPT_fintelfpga) &&
3814+
!IsSYCLDeviceLibObj(FileName, C.getDefaultToolChain()
3815+
.getTriple()
3816+
.isWindowsMSVCEnvironment()))
38023817
FPGAObjectInputs.push_back(IA);
38033818
}
38043819
// When creating FPGA device fat objects, all host objects are
@@ -3862,6 +3877,92 @@ class OffloadingActionBuilder final {
38623877
SYCLDeviceActions.clear();
38633878
}
38643879

3880+
void addSYCLDeviceLibs(const ToolChain *TC, ActionList &DeviceLinkObjects,
3881+
bool isSpirvAOT, bool isMSVCEnv) {
3882+
enum SYCLDeviceLibType {
3883+
sycl_devicelib_wrapper,
3884+
sycl_devicelib_fallback
3885+
};
3886+
struct DeviceLibOptInfo {
3887+
StringRef devicelib_name;
3888+
StringRef devicelib_option;
3889+
};
3890+
3891+
bool NoDeviceLibs = false;
3892+
// Currently, libc, libm-fp32 will be linked in by default. In order
3893+
// to use libm-fp64, -fsycl-device-lib=libm-fp64/all should be used.
3894+
llvm::StringMap<bool> devicelib_link_info = {
3895+
{"libc", true}, {"libm-fp32", true}, {"libm-fp64", false}};
3896+
if (Arg *A = Args.getLastArg(options::OPT_fsycl_device_lib_EQ,
3897+
options::OPT_fno_sycl_device_lib_EQ)) {
3898+
if (A->getValues().size() == 0)
3899+
C.getDriver().Diag(diag::warn_drv_empty_joined_argument)
3900+
<< A->getAsString(Args);
3901+
else {
3902+
if (A->getOption().matches(options::OPT_fno_sycl_device_lib_EQ))
3903+
NoDeviceLibs = true;
3904+
3905+
for (StringRef Val : A->getValues()) {
3906+
if (Val == "all") {
3907+
for (auto &K : devicelib_link_info.keys())
3908+
devicelib_link_info[K] = true && !NoDeviceLibs;
3909+
break;
3910+
}
3911+
auto LinkInfoIter = devicelib_link_info.find(Val);
3912+
if (LinkInfoIter == devicelib_link_info.end()) {
3913+
C.getDriver().Diag(diag::err_drv_unsupported_option_argument)
3914+
<< A->getOption().getName() << Val;
3915+
}
3916+
devicelib_link_info[Val] = true && !NoDeviceLibs;
3917+
}
3918+
}
3919+
}
3920+
3921+
SmallString<128> LibLoc(TC->getDriver().Dir);
3922+
llvm::sys::path::append(LibLoc, "/../lib");
3923+
StringRef LibSuffix = isMSVCEnv ? ".obj" : ".o";
3924+
SmallVector<DeviceLibOptInfo, 5> sycl_device_wrapper_libs = {
3925+
{"libsycl-crt", "libc"},
3926+
{"libsycl-complex", "libm-fp32"},
3927+
{"libsycl-complex-fp64", "libm-fp64"},
3928+
{"libsycl-cmath", "libm-fp32"},
3929+
{"libsycl-cmath-fp64", "libm-fp64"}};
3930+
// For AOT compilation, we need to link sycl_device_fallback_libs as
3931+
// default too.
3932+
SmallVector<DeviceLibOptInfo, 5> sycl_device_fallback_libs = {
3933+
{"libsycl-fallback-cassert", "libc"},
3934+
{"libsycl-fallback-complex", "libm-fp32"},
3935+
{"libsycl-fallback-complex-fp64", "libm-fp64"},
3936+
{"libsycl-fallback-cmath", "libm-fp32"},
3937+
{"libsycl-fallback-cmath-fp64", "libm-fp64"}};
3938+
auto addInputs = [&](SYCLDeviceLibType t) {
3939+
auto sycl_libs = (t == sycl_devicelib_wrapper)
3940+
? sycl_device_wrapper_libs
3941+
: sycl_device_fallback_libs;
3942+
for (const DeviceLibOptInfo &Lib : sycl_libs) {
3943+
if (!devicelib_link_info[Lib.devicelib_option])
3944+
continue;
3945+
SmallString<128> LibName(LibLoc);
3946+
llvm::sys::path::append(LibName, Lib.devicelib_name);
3947+
llvm::sys::path::replace_extension(LibName, LibSuffix);
3948+
if (llvm::sys::fs::exists(LibName)) {
3949+
Arg *InputArg = MakeInputArg(Args, C.getDriver().getOpts(),
3950+
Args.MakeArgString(LibName));
3951+
auto *SYCLDeviceLibsInputAction =
3952+
C.MakeAction<InputAction>(*InputArg, types::TY_Object);
3953+
auto *SYCLDeviceLibsUnbundleAction =
3954+
C.MakeAction<OffloadUnbundlingJobAction>(
3955+
SYCLDeviceLibsInputAction);
3956+
addDeviceDepences(SYCLDeviceLibsUnbundleAction);
3957+
DeviceLinkObjects.push_back(SYCLDeviceLibsUnbundleAction);
3958+
}
3959+
}
3960+
};
3961+
addInputs(sycl_devicelib_wrapper);
3962+
if (isSpirvAOT)
3963+
addInputs(sycl_devicelib_fallback);
3964+
}
3965+
38653966
void appendLinkDependences(OffloadAction::DeviceDependences &DA) override {
38663967
assert(ToolChains.size() == DeviceLinkerInputs.size() &&
38673968
"Toolchains and linker inputs sizes do not match.");
@@ -3941,13 +4042,27 @@ class OffloadingActionBuilder final {
39414042
}
39424043
ActionList DeviceLibObjects;
39434044
ActionList LinkObjects;
4045+
auto TT = SYCLTripleList[I];
4046+
auto isNVPTX = (*TC)->getTriple().isNVPTX();
4047+
bool isSpirvAOT = TT.getSubArch() == llvm::Triple::SPIRSubArch_fpga ||
4048+
TT.getSubArch() == llvm::Triple::SPIRSubArch_gen ||
4049+
TT.getSubArch() == llvm::Triple::SPIRSubArch_x86_64;
39444050
for (const auto &Input : LI) {
39454051
// FPGA aoco does not go through the link, everything else does.
39464052
if (Input->getType() == types::TY_FPGA_AOCO)
39474053
DeviceLibObjects.push_back(Input);
39484054
else
39494055
LinkObjects.push_back(Input);
39504056
}
4057+
// FIXME: Link all wrapper and fallback device libraries as default,
4058+
// When spv online link is supported by all backends, the fallback
4059+
// device libraries are only needed when current toolchain is using
4060+
// AOT compilation.
4061+
if (!isNVPTX) {
4062+
addSYCLDeviceLibs(
4063+
*TC, LinkObjects, true,
4064+
C.getDefaultToolChain().getTriple().isWindowsMSVCEnvironment());
4065+
}
39514066
// The linkage actions subgraph leading to the offload wrapper.
39524067
// [cond] Means incoming/outgoing dependence is created only when cond
39534068
// is true. A function of:
@@ -4002,7 +4117,6 @@ class OffloadingActionBuilder final {
40024117
Action *DeviceLinkAction =
40034118
C.MakeAction<LinkJobAction>(LinkObjects, types::TY_LLVM_BC);
40044119
// setup some flags upfront
4005-
auto isNVPTX = (*TC)->getTriple().isNVPTX();
40064120

40074121
if (isNVPTX && DeviceCodeSplit) {
40084122
// TODO Temporary limitation, need to support code splitting for PTX
@@ -4014,10 +4128,6 @@ class OffloadingActionBuilder final {
40144128
D.Diag(diag::err_drv_unsupported_opt_for_target)
40154129
<< OptName << (*TC)->getTriple().str();
40164130
}
4017-
auto TT = SYCLTripleList[I];
4018-
bool isSpirvAOT = TT.getSubArch() == llvm::Triple::SPIRSubArch_fpga ||
4019-
TT.getSubArch() == llvm::Triple::SPIRSubArch_gen ||
4020-
TT.getSubArch() == llvm::Triple::SPIRSubArch_x86_64;
40214131
// reflects whether current target is ahead-of-time and can't support
40224132
// runtime setting of specialization constants
40234133
bool isAOT = isNVPTX || isSpirvAOT;
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
///
2+
/// Perform several driver tests for SYCL device libraries on Windows
3+
///
4+
// REQUIRES: clang-driver, windows
5+
6+
/// ###########################################################################
7+
8+
/// test behavior of device library default link
9+
// RUN: %clangxx -fsycl %s -### 2>&1 \
10+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
11+
// RUN: %clangxx -fsycl %s -fsycl-device-lib=libc -### 2>&1 \
12+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
13+
// RUN: %clangxx -fsycl %s -fsycl-device-lib=libm-fp32 -### 2>&1 \
14+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
15+
// RUN: %clangxx -fsycl %s -fsycl-device-lib=libc,libm-fp32 -### 2>&1 \
16+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
17+
// RUN: %clangxx -fsycl %s -fno-sycl-device-lib=libm-fp64 -### 2>&1 \
18+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
19+
// SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-msvc.o" "-outputs={{.*}}libsycl-msvc-{{.*}}.o" "-unbundle"
20+
// SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-complex.o" "-outputs={{.*}}libsycl-complex-{{.*}}.o" "-unbundle"
21+
// SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-cmath.o" "-outputs={{.*}}libsycl-cmath-{{.*}}.o" "-unbundle"
22+
// SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-fallback-cassert.o" "-outputs={{.*}}libsycl-fallback-cassert-{{.*}}.o" "-unbundle"
23+
// SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-fallback-complex.o" "-outputs={{.*}}libsycl-fallback-complex-{{.*}}.o" "-unbundle"
24+
// SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-fallback-cmath.o" "-outputs={{.*}}libsycl-fallback-cmath-{{.*}}.o" "-unbundle"
25+
26+
/// ###########################################################################
27+
/// test behavior of device library link with libm-fp64
28+
// RUN: %clangxx -fsycl %s -fsycl-device-lib=libm-fp64 -### 2>&1 \
29+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64
30+
// RUN: %clangxx -fsycl %s -fsycl-device-lib=libc,libm-fp64 -### 2>&1 \
31+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64
32+
// RUN: %clangxx -fsycl %s -fsycl-device-lib=all -### 2>&1 \
33+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64
34+
// RUN: %clangxx -fsycl %s -fsycl-device-lib=libc,libm-fp32,libm-fp64 -### 2>&1 \
35+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64
36+
// RUN: %clangxx -fsycl %s -fsycl-device-lib=libc,all -### 2>&1 \
37+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64
38+
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-msvc.o" "-outputs={{.*}}libsycl-msvc-{{.*}}.o" "-unbundle"
39+
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-complex.o" "-outputs={{.*}}libsycl-complex-{{.*}}.o" "-unbundle"
40+
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-complex-fp64.o" "-outputs={{.*}}libsycl-complex-fp64-{{.*}}.o" "-unbundle"
41+
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-cmath.o" "-outputs={{.*}}libsycl-cmath-{{.*}}.o" "-unbundle"
42+
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-cmath-fp64.o" "-outputs={{.*}}libsycl-cmath-fp64-{{.*}}.o" "-unbundle"
43+
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-fallback-cassert.o" "-outputs={{.*}}libsycl-fallback-cassert-{{.*}}.o" "-unbundle"
44+
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-fallback-complex.o" "-outputs={{.*}}libsycl-fallback-complex-{{.*}}.o" "-unbundle"
45+
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-fallback-complex-fp64.o" "-outputs={{.*}}libsycl-fallback-complex-fp64-{{.*}}.o" "-unbundle"
46+
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-fallback-cmath.o" "-outputs={{.*}}libsycl-fallback-cmath-{{.*}}.o" "-unbundle"
47+
// SYCL_DEVICE_LIB_UNBUNDLE_WITH_FP64-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-fallback-cmath-fp64.o" "-outputs={{.*}}libsycl-fallback-cmath-fp64-{{.*}}.o" "-unbundle"
48+
49+
/// ###########################################################################
50+
51+
/// test behavior of -fno-sycl-device-lib=libc
52+
// RUN: %clangxx -fsycl %s -fno-sycl-device-lib=libc -### 2>&1 \
53+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBC
54+
// SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBC: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-complex.o" "-outputs={{.*}}libsycl-complex-{{.*}}.o" "-unbundle"
55+
// SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBC-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-cmath.o" "-outputs={{.*}}libsycl-cmath-{{.*}}.o" "-unbundle"
56+
// SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBC-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-fallback-complex.o" "-outputs={{.*}}libsycl-fallback-complex-{{.*}}.o" "-unbundle"
57+
// SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBC-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-fallback-cmath.o" "-outputs={{.*}}libsycl-fallback-cmath-{{.*}}.o" "-unbundle"
58+
59+
/// ###########################################################################
60+
61+
/// test behavior of -fno-sycl-device-lib=libm-fp32
62+
// RUN: %clangxx -fsycl %s -fno-sycl-device-lib=libm-fp32 -### 2>&1 \
63+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBM_FP32
64+
// SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBM_FP32: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-msvc.o" "-outputs={{.*}}libsycl-msvc-{{.*}}.o" "-unbundle"
65+
// SYCL_DEVICE_LIB_UNBUNDLE_NO_LIBM_FP32-NEXT: clang-offload-bundler{{.*}} "-type=o" "-targets=sycl-spir64-unknown-unknown-sycldevice" "-inputs={{.*}}libsycl-fallback-cassert.o" "-outputs={{.*}}libsycl-fallback-cassert-{{.*}}.o" "-unbundle"
66+
67+
/// ###########################################################################
68+
69+
/// test behavior of disabling all device libraries
70+
// RUN: %clangxx -fsycl %s -fno-sycl-device-lib=libc,libm-fp32 -### 2>&1 \
71+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_NO_DEVICE_LIB
72+
// RUN: %clangxx -fsycl %s -fno-sycl-device-lib=all -### 2>&1 \
73+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_NO_DEVICE_LIB
74+
// RUN: %clangxx -fsycl %s -fno-sycl-device-lib=libc,all -### 2>&1 \
75+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_NO_DEVICE_LIB
76+
// RUN: %clangxx -fsycl %s -fno-sycl-device-lib=libm-fp32,all -### 2>&1 \
77+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_NO_DEVICE_LIB
78+
// RUN: %clangxx -fsycl %s -fno-sycl-device-lib=libm-fp64,all -### 2>&1 \
79+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_NO_DEVICE_LIB
80+
// RUN: %clangxx -fsycl %s -fno-sycl-device-lib=libc,all,libm-fp64,libm-fp32 -### 2>&1 \
81+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_NO_DEVICE_LIB
82+
// SYCL_DEVICE_LIB_UNBUNDLE_NO_DEVICE_LIB: {{.*}}clang{{.*}} "-cc1" "-triple" "spir64-unknown-unknown-sycldevice"
83+
// SYCL_DEVICE_LIB_UNBUNDLE_NO_DEVICE_LIB-NEXT: {{.*}}llvm-link{{.*}} {{.*}} "--suppress-warnings"
84+
85+
/// ###########################################################################
86+
87+
/// test invalid value for -f[no-]sycl-device-lib
88+
// RUN: %clangxx -fsycl %s -fsycl-device-lib=libc,dummy -### 2>&1 \
89+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_INVALID_VALUE
90+
// RUN: %clangxx -fsycl %s -fno-sycl-device-lib=dummy,libm-fp32 -### 2>&1 \
91+
// RUN: | FileCheck %s -check-prefix=SYCL_NO_DEVICE_LIB_INVALID_VALUE
92+
// SYCL_DEVICE_LIB_INVALID_VALUE: error: unsupported argument 'dummy' to option 'fsycl-device-lib='
93+
// SYCL_NO_DEVICE_LIB_INVALID_VALUE: error: unsupported argument 'dummy' to option 'fno-sycl-device-lib='

0 commit comments

Comments
 (0)