Skip to content

Commit 8e434f6

Browse files
committed
Add fno-sycl-device-lib-online-link
Signed-off-by: jinge90 <[email protected]>
1 parent c7cfb23 commit 8e434f6

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4855,8 +4855,11 @@ def fno_sycl_device_lib_EQ : CommaJoined<["-"], "fno-sycl-device-lib=">, Group<s
48554855
"device libraries from device binary linkage. Valid arguments "
48564856
"are libc, libm-fp32, libm-fp64, all">;
48574857
def fsycl_device_lib_online_link : Flag<["-"], "fsycl-device-lib-online-link">,
4858-
Group<sycl_Group>, Flags<[NoXarchOption, CoreOption]>, HelpText<"Use online "
4859-
"link mode for SYCL device libraries.">;
4858+
Group<sycl_Group>, Flags<[NoArgumentUnused, CoreOption]>, HelpText<"Enables "
4859+
"sycl device library online link">;
4860+
def fno_sycl_device_lib_online_link : Flag<["-"], "fno-sycl-device-lib-online-link">,
4861+
Group<sycl_Group>, Flags<[NoArgumentUnused, CoreOption]>, HelpText<"Disables "
4862+
"sycl device library online link">;
48604863
def fsycl_fp32_prec_sqrt : Flag<["-"], "fsycl-fp32-prec-sqrt">, Group<sycl_Group>, Flags<[CC1Option]>,
48614864
HelpText<"SYCL only. Specify that single precision floating-point sqrt is correctly rounded.">,
48624865
MarshallingInfoFlag<CodeGenOpts<"SYCLFp32PrecSqrt">>;

clang/lib/Driver/Driver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4958,9 +4958,9 @@ class OffloadingActionBuilder final {
49584958
// device libraries are only needed when current toolchain is using
49594959
// AOT compilation.
49604960
if (isSPIR) {
4961-
49624961
bool UseOnlineLink =
4963-
Args.hasArg(options::OPT_fsycl_device_lib_online_link);
4962+
Args.hasFlag(options::OPT_fsycl_device_lib_online_link,
4963+
options::OPT_fno_sycl_device_lib_online_link, false);
49644964
bool UseOfflineLink = isSpirvAOT || !UseOnlineLink;
49654965
SYCLDeviceLibLinked = addSYCLDeviceLibs(
49664966
TC, FullLinkObjects, UseOfflineLink,

clang/test/Driver/sycl-device-lib-win.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66

77
/// ###########################################################################
88

9-
/// test behavior of device library default link
9+
/// test behavior of device library default link and fno-sycl-device-lib-online-link
1010
// RUN: %clangxx -fsycl %s --sysroot=%S/Inputs/SYCL-windows -### 2>&1 \
1111
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
12+
// RUN: %clangxx -fsycl -fno-sycl-device-lib-online-link %s --sysroot=%S/Inputs/SYCL-windows -### 2>&1 \
13+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
1214
// RUN: %clangxx -fsycl %s -fsycl-device-lib=libc --sysroot=%S/Inputs/SYCL-windows -### 2>&1 \
1315
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
16+
// RUN: %clangxx -fsycl -fno-sycl-device-lib-online-link %s -fsycl-device-lib=libc --sysroot=%S/Inputs/SYCL-windows -### 2>&1 \
17+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
1418
// RUN: %clangxx -fsycl %s -fsycl-device-lib=libm-fp32 --sysroot=%S/Inputs/SYCL-windows -### 2>&1 \
1519
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
1620
// RUN: %clangxx -fsycl %s -fsycl-device-lib=libc,libm-fp32 --sysroot=%S/Inputs/SYCL-windows -### 2>&1 \

clang/test/Driver/sycl-device-lib.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66

77
/// ###########################################################################
88

9-
/// test behavior of device library default link
9+
/// test behavior of device library default link and fno-sycl-device-lib-online-link
1010
// RUN: %clangxx -fsycl %s --sysroot=%S/Inputs/SYCL -### 2>&1 \
1111
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
12+
// RUN: %clangxx -fsycl -fno-sycl-device-lib-online-link %s --sysroot=%S/Inputs/SYCL -### 2>&1 \
13+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
1214
// RUN: %clangxx -fsycl %s -fsycl-device-lib=libc --sysroot=%S/Inputs/SYCL -### 2>&1 \
1315
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
16+
// RUN: %clangxx -fsycl -fno-sycl-device-lib-online-link %s -fsycl-device-lib=libc --sysroot=%S/Inputs/SYCL -### 2>&1 \
17+
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
1418
// RUN: %clangxx -fsycl %s -fsycl-device-lib=libm-fp32 --sysroot=%S/Inputs/SYCL -### 2>&1 \
1519
// RUN: | FileCheck %s -check-prefix=SYCL_DEVICE_LIB_UNBUNDLE_DEFAULT
1620
// RUN: %clangxx -fsycl %s -fsycl-device-lib=libc,libm-fp32 --sysroot=%S/Inputs/SYCL -### 2>&1 \

0 commit comments

Comments
 (0)