Skip to content

Commit eb09e73

Browse files
authored
[SYCL] Adjust Driver and tests for addition of imf-bf16 library. (#7917)
This change adds the lib-imf-bf16 library into the libraries expected to be linked in by the Driver in various scenarios.
1 parent e16b961 commit eb09e73

File tree

5 files changed

+140
-63
lines changed

5 files changed

+140
-63
lines changed

clang/lib/Driver/Driver.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5104,8 +5104,10 @@ class OffloadingActionBuilder final {
51045104

51055105
if (A->getOption().matches(options::OPT_fsycl_targets_EQ)) {
51065106
// spir64 target is actually JIT compilation, so we defer selection of
5107-
// bfloat16 libraries to runtime. For AOT we need libraries.
5108-
needLibs = TC->getTriple().getSubArch() != llvm::Triple::NoSubArch;
5107+
// bfloat16 libraries to runtime. For AOT we need libraries, but skip
5108+
// for Nvidia.
5109+
needLibs = TC->getTriple().getSubArch() != llvm::Triple::NoSubArch &&
5110+
!TC->getTriple().isNVPTX();
51095111
TargetBE = GetTripleIt(A->getValue(0));
51105112
if (TargetBE)
51115113
TargetOpt = A->getValue(0);
@@ -5167,9 +5169,9 @@ class OffloadingActionBuilder final {
51675169
// Currently, all SYCL device libraries will be linked by default. Linkage
51685170
// of "internal" libraries cannot be affected via -fno-sycl-device-lib.
51695171
llvm::StringMap<bool> devicelib_link_info = {
5170-
{"libc", true}, {"libm-fp32", true}, {"libm-fp64", true},
5171-
{"libimf-fp32", true}, {"libimf-fp64", true}, {"libimf-bf16", true},
5172-
{"internal", true}};
5172+
{"libc", true}, {"libm-fp32", true}, {"libm-fp64", true},
5173+
{"libimf-fp32", true}, {"libimf-fp64", true}, {"libimf-bf16", true},
5174+
{"libm-bfloat16", true}, {"internal", true}};
51735175
if (Arg *A = Args.getLastArg(options::OPT_fsycl_device_lib_EQ,
51745176
options::OPT_fno_sycl_device_lib_EQ)) {
51755177
if (A->getValues().size() == 0)

clang/test/Driver/Inputs/SYCL/lib/libsycl-fallback-bfloat16.o

Whitespace-only changes.

clang/test/Driver/Inputs/SYCL/lib/libsycl-native-bfloat16.o

Whitespace-only changes.

0 commit comments

Comments
 (0)