cmake : try to fix sycl 2

This commit is contained in:
Georgi Gerganov 2024-09-13 14:05:00 +03:00
parent ae9475de40
commit b653b1e922
No known key found for this signature in database
GPG Key ID: 449E073F9DC10735

View File

@ -516,7 +516,8 @@ if (GGML_SYCL)
endif() endif()
check_cxx_compiler_flag("-fsycl" SUPPORTS_SYCL) check_cxx_compiler_flag("-fsycl" SUPPORTS_SYCL)
if ( DEFINED ENV{ONEAPI_ROOT})
if (DEFINED ENV{ONEAPI_ROOT})
message(STATUS "Using oneAPI Release SYCL compiler (icpx).") message(STATUS "Using oneAPI Release SYCL compiler (icpx).")
elseif(SUPPORTS_SYCL) elseif(SUPPORTS_SYCL)
message(WARNING "Using open-source SYCL compiler (clang++). Didn't detect ENV {ONEAPI_ROOT}. message(WARNING "Using open-source SYCL compiler (clang++). Didn't detect ENV {ONEAPI_ROOT}.
@ -538,7 +539,8 @@ if (GGML_SYCL)
add_compile_definitions(GGML_SYCL_FORCE_MMQ) add_compile_definitions(GGML_SYCL_FORCE_MMQ)
endif() endif()
list(APPEND CMAKE_CXX_FLAGS -Wno-narrowing) add_link_options (-fsycl)
add_compile_options(-fsycl -Wno-narrowing)
if (GGML_SYCL_TARGET STREQUAL "NVIDIA") if (GGML_SYCL_TARGET STREQUAL "NVIDIA")
add_compile_definitions(GGML_SYCL_WARP_SIZE=32) add_compile_definitions(GGML_SYCL_WARP_SIZE=32)
@ -554,26 +556,29 @@ if (GGML_SYCL)
find_package(DNNL) find_package(DNNL)
message("-- DNNL found:" ${DNNL_FOUND}) message("-- DNNL found:" ${DNNL_FOUND})
if (GGML_SYCL_TARGET STREQUAL "INTEL") if (GGML_SYCL_TARGET STREQUAL "INTEL")
add_compile_definitions(GGML_SYCL_DNNL=${DNNL_FOUND}) add_compile_definitions(GGML_SYCL_DNNL=${DNNL_FOUND})
else() else()
add_compile_definitions(GGML_SYCL_DNNL=0) add_compile_definitions(GGML_SYCL_DNNL=0)
endif() endif()
if (${DNNL_FOUND} AND GGML_SYCL_TARGET STREQUAL "INTEL")
list(APPEND GGML_EXTRA_LIBS DNNL::dnnl)
endif()
if (WIN32) if (WIN32)
find_package(IntelSYCL REQUIRED) find_package(IntelSYCL REQUIRED)
find_package(MKL REQUIRED) find_package(MKL REQUIRED)
list(APPEND GGML_EXTRA_LIBS IntelSYCL::SYCL_CXX MKL::MKL MKL::MKL_SYCL) list(APPEND GGML_EXTRA_LIBS IntelSYCL::SYCL_CXX MKL::MKL MKL::MKL_SYCL)
else() else()
if (GGML_SYCL_TARGET STREQUAL "INTEL") if (GGML_SYCL_TARGET STREQUAL "INTEL")
list(APPEND GGML_EXTRA_LIBS -fsycl OpenCL mkl_core pthread m dl mkl_sycl_blas mkl_intel_ilp64 mkl_tbb_thread) list(APPEND GGML_EXTRA_LIBS OpenCL mkl_core pthread m dl mkl_sycl_blas mkl_intel_ilp64 mkl_tbb_thread)
elseif (GGML_SYCL_TARGET STREQUAL "NVIDIA") elseif (GGML_SYCL_TARGET STREQUAL "NVIDIA")
list(APPEND CMAKE_CXX_FLAGS -fsycl-targets=nvptx64-nvidia-cuda) add_compile_options(-fsycl-targets=nvptx64-nvidia-cuda)
list(APPEND GGML_EXTRA_LIBS -fsycl pthread m dl onemkl) list(APPEND GGML_EXTRA_LIBS pthread m dl onemkl)
endif() endif()
endif() endif()
if (${DNNL_FOUND} AND GGML_SYCL_TARGET STREQUAL "INTEL")
list(APPEND GGML_EXTRA_LIBS -fsycl DNNL::dnnl)
endif()
endif() endif()
if (GGML_RPC) if (GGML_RPC)