Skip to content

Commit 60c5f6f

Browse files
committed
make: use SYCLCXX as linker for libceed.so when SYCL is enabled
When CC=gcc (as on Aurora), SYCL_FLAG is empty so the libceed.so link step was using g++ without -fsycl. g++ does not merge SYCL fat binary device sections from .sycl.cpp objects, leaving libceed.so with only host-side SYCL stubs. At runtime, the SYCL backend threw "No kernel named ..." for every kernel, including CeedVectorNorm_Sycl. Fix: when SYCL_LIB_DIR is detected, switch the libceed.so linker to $(SYCLCXX) (icpx) and add -fsycl/-fno-sycl-id-queries-fit-in-int to CEED_LDFLAGS so icpx merges the device images into the shared library. Also fix PKG_LIBS: use $(filter -fsycl ...,$(SYCLFLAGS)) instead of $(SYCL_FLAG) so the .pc file carries -fsycl regardless of CC vendor.
1 parent e85e3fb commit 60c5f6f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ ifneq ($(SYCL_DIR),)
597597
SYCL_LIB_DIR := $(patsubst %/,%,$(dir $(firstword $(SYCL_LIB_DIR))))
598598
endif
599599
ifneq ($(SYCL_LIB_DIR),)
600-
PKG_LIBS += $(SYCL_FLAG) -lze_loader
600+
PKG_LIBS += $(filter -fsycl -fno-sycl-id-queries-fit-in-int,$(SYCLFLAGS)) -lze_loader
601601
LIBCEED_CONTAINS_CXX = 1
602602
libceed.sycl += $(sycl-core.cpp) $(sycl-ref.cpp) $(sycl-shared.cpp) $(sycl-gen.cpp)
603603
BACKENDS_MAKE += $(SYCL_BACKENDS)
@@ -658,7 +658,12 @@ endif
658658

659659
pkgconfig-libs-private = $(PKG_LIBS)
660660
ifeq ($(LIBCEED_CONTAINS_CXX),1)
661-
$(libceeds) : LINK = $(CXX)
661+
ifneq ($(SYCL_LIB_DIR),)
662+
$(libceeds) : LINK = $(SYCLCXX)
663+
$(libceeds) : CEED_LDFLAGS += $(filter -fsycl -fno-sycl-id-queries-fit-in-int,$(SYCLFLAGS))
664+
else
665+
$(libceeds) : LINK = $(CXX)
666+
endif
662667
ifeq ($(STATIC),1)
663668
$(examples) $(tests) : CEED_LDLIBS += $(LIBCXX)
664669
pkgconfig-libs-private += $(LIBCXX)

0 commit comments

Comments
 (0)