@@ -467,15 +467,18 @@ if (GGML_SYCL)
467467 message (FATAL_ERROR "Invalid backend chosen, supported options are INTEL or NVIDIA" )
468468 endif ()
469469
470- if ( NOT DEFINED ENV{ONEAPI_ROOT})
471- message (FATAL_ERROR "Not detect ENV {ONEAPI_ROOT}, please install oneAPI & source it, like: source /opt/intel/oneapi/setvars.sh" )
470+ check_cxx_compiler_flag("-fsycl" SUPPORTS_SYCL)
471+ if ( DEFINED ENV{ONEAPI_ROOT})
472+ message (STATUS "Using oneAPI Release SYCL compiler (icpx)." )
473+ elseif (SUPPORTS_SYCL)
474+ message (WARNING "Using open-source SYCL compiler (clang++). Didn't detect ENV {ONEAPI_ROOT}.
475+ If you expected the oneAPI Release compiler, please install oneAPI & source it, like:
476+ source /opt/intel/oneapi/setvars.sh" )
477+ else ()
478+ message (FATAL_ERROR, "C++ compiler lacks SYCL support." )
472479 endif ()
473- #todo: AOT
474-
475- find_package (IntelSYCL REQUIRED)
476- find_package (MKL REQUIRED)
477-
478480 message (STATUS "SYCL found" )
481+ #todo: AOT
479482
480483 list (APPEND GGML_CDEF_PUBLIC GGML_USE_SYCL)
481484
@@ -487,11 +490,9 @@ if (GGML_SYCL)
487490 add_compile_definitions (GGML_SYCL_FORCE_MMQ)
488491 endif ()
489492
490- add_compile_options (-I./) #include DPCT
493+ set ( CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wno-narrowing -fsycl" )
491494
492- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing" )
493495 if (GGML_SYCL_TARGET STREQUAL "NVIDIA" )
494- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl-targets=nvptx64-nvidia-cuda" )
495496 add_compile_definitions (GGML_SYCL_WARP_SIZE=32)
496497 else ()
497498 add_compile_definitions (GGML_SYCL_WARP_SIZE=16)
@@ -504,15 +505,15 @@ if (GGML_SYCL)
504505 list (APPEND GGML_SOURCES_SYCL "ggml-sycl.cpp" )
505506
506507 if (WIN32 )
508+ find_package (IntelSYCL REQUIRED)
509+ find_package (MKL REQUIRED)
507510 set (GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} IntelSYCL::SYCL_CXX MKL::MKL MKL::MKL_SYCL)
508511 else ()
509- add_compile_options (-I/${SYCL_INCLUDE_DIR} )
510- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl -L${MKLROOT} /lib" )
511-
512512 if (GGML_SYCL_TARGET STREQUAL "INTEL" )
513- set (GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} -fsycl OpenCL mkl_core pthread m dl mkl_sycl_blas mkl_intel_ilp64 mkl_tbb_thread)
513+ set (GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} OpenCL mkl_core pthread m dl mkl_sycl_blas mkl_intel_ilp64 mkl_tbb_thread)
514514 elseif (GGML_SYCL_TARGET STREQUAL "NVIDIA" )
515- set (GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} -fsycl pthread m dl onemkl)
515+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl-targets=nvptx64-nvidia-cuda" )
516+ set (GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} pthread m dl onemkl)
516517 endif ()
517518 endif ()
518519endif ()
0 commit comments