@@ -467,15 +467,18 @@ if (GGML_SYCL)
467
467
message (FATAL_ERROR "Invalid backend chosen, supported options are INTEL or NVIDIA" )
468
468
endif ()
469
469
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." )
472
479
endif ()
473
- #todo: AOT
474
-
475
- find_package (IntelSYCL REQUIRED)
476
- find_package (MKL REQUIRED)
477
-
478
480
message (STATUS "SYCL found" )
481
+ #todo: AOT
479
482
480
483
list (APPEND GGML_CDEF_PUBLIC GGML_USE_SYCL)
481
484
@@ -487,11 +490,9 @@ if (GGML_SYCL)
487
490
add_compile_definitions (GGML_SYCL_FORCE_MMQ)
488
491
endif ()
489
492
490
- add_compile_options (-I./) #include DPCT
493
+ set ( CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -Wno-narrowing -fsycl" )
491
494
492
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing" )
493
495
if (GGML_SYCL_TARGET STREQUAL "NVIDIA" )
494
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl-targets=nvptx64-nvidia-cuda" )
495
496
add_compile_definitions (GGML_SYCL_WARP_SIZE=32)
496
497
else ()
497
498
add_compile_definitions (GGML_SYCL_WARP_SIZE=16)
@@ -504,15 +505,15 @@ if (GGML_SYCL)
504
505
list (APPEND GGML_SOURCES_SYCL "ggml-sycl.cpp" )
505
506
506
507
if (WIN32 )
508
+ find_package (IntelSYCL REQUIRED)
509
+ find_package (MKL REQUIRED)
507
510
set (GGML_EXTRA_LIBS ${GGML_EXTRA_LIBS} IntelSYCL::SYCL_CXX MKL::MKL MKL::MKL_SYCL)
508
511
else ()
509
- add_compile_options (-I/${SYCL_INCLUDE_DIR} )
510
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl -L${MKLROOT} /lib" )
511
-
512
512
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)
514
514
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)
516
517
endif ()
517
518
endif ()
518
519
endif ()
0 commit comments