Skip to content

Commit b653b1e

Browse files
committed
cmake : try to fix sycl 2
1 parent ae9475d commit b653b1e

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

ggml/src/CMakeLists.txt

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,8 @@ if (GGML_SYCL)
516516
endif()
517517

518518
check_cxx_compiler_flag("-fsycl" SUPPORTS_SYCL)
519-
if ( DEFINED ENV{ONEAPI_ROOT})
519+
520+
if (DEFINED ENV{ONEAPI_ROOT})
520521
message(STATUS "Using oneAPI Release SYCL compiler (icpx).")
521522
elseif(SUPPORTS_SYCL)
522523
message(WARNING "Using open-source SYCL compiler (clang++). Didn't detect ENV {ONEAPI_ROOT}.
@@ -538,7 +539,8 @@ if (GGML_SYCL)
538539
add_compile_definitions(GGML_SYCL_FORCE_MMQ)
539540
endif()
540541

541-
list(APPEND CMAKE_CXX_FLAGS -Wno-narrowing)
542+
add_link_options (-fsycl)
543+
add_compile_options(-fsycl -Wno-narrowing)
542544

543545
if (GGML_SYCL_TARGET STREQUAL "NVIDIA")
544546
add_compile_definitions(GGML_SYCL_WARP_SIZE=32)
@@ -554,26 +556,29 @@ if (GGML_SYCL)
554556

555557
find_package(DNNL)
556558
message("-- DNNL found:" ${DNNL_FOUND})
559+
557560
if (GGML_SYCL_TARGET STREQUAL "INTEL")
558561
add_compile_definitions(GGML_SYCL_DNNL=${DNNL_FOUND})
559562
else()
560563
add_compile_definitions(GGML_SYCL_DNNL=0)
561564
endif()
565+
566+
if (${DNNL_FOUND} AND GGML_SYCL_TARGET STREQUAL "INTEL")
567+
list(APPEND GGML_EXTRA_LIBS DNNL::dnnl)
568+
endif()
569+
562570
if (WIN32)
563571
find_package(IntelSYCL REQUIRED)
564572
find_package(MKL REQUIRED)
565573
list(APPEND GGML_EXTRA_LIBS IntelSYCL::SYCL_CXX MKL::MKL MKL::MKL_SYCL)
566574
else()
567575
if (GGML_SYCL_TARGET STREQUAL "INTEL")
568-
list(APPEND GGML_EXTRA_LIBS -fsycl OpenCL mkl_core pthread m dl mkl_sycl_blas mkl_intel_ilp64 mkl_tbb_thread)
576+
list(APPEND GGML_EXTRA_LIBS OpenCL mkl_core pthread m dl mkl_sycl_blas mkl_intel_ilp64 mkl_tbb_thread)
569577
elseif (GGML_SYCL_TARGET STREQUAL "NVIDIA")
570-
list(APPEND CMAKE_CXX_FLAGS -fsycl-targets=nvptx64-nvidia-cuda)
571-
list(APPEND GGML_EXTRA_LIBS -fsycl pthread m dl onemkl)
578+
add_compile_options(-fsycl-targets=nvptx64-nvidia-cuda)
579+
list(APPEND GGML_EXTRA_LIBS pthread m dl onemkl)
572580
endif()
573581
endif()
574-
if (${DNNL_FOUND} AND GGML_SYCL_TARGET STREQUAL "INTEL")
575-
list(APPEND GGML_EXTRA_LIBS -fsycl DNNL::dnnl)
576-
endif()
577582
endif()
578583

579584
if (GGML_RPC)

0 commit comments

Comments
 (0)