From ab8f044dd725bc19182fb0ea446daf3d1b3c32f1 Mon Sep 17 00:00:00 2001 From: "atharva.dubey" Date: Mon, 19 May 2025 22:58:14 +0100 Subject: [PATCH 1/4] add find_package call for OpenCL --- ggml/src/ggml-sycl/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ggml/src/ggml-sycl/CMakeLists.txt b/ggml/src/ggml-sycl/CMakeLists.txt index a2e26124802b2..29585bd8ef2c5 100644 --- a/ggml/src/ggml-sycl/CMakeLists.txt +++ b/ggml/src/ggml-sycl/CMakeLists.txt @@ -51,6 +51,9 @@ target_compile_options(ggml-sycl PRIVATE "-Wno-narrowing") # Link against oneDNN set(GGML_SYCL_DNNL 0) if(GGML_SYCL_DNN) + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + find_package(OpenCL REQUIRED) + endif() find_package(DNNL) if(DNNL_FOUND) if (NOT DEFINED DNNL_GPU_VENDOR) From ae9aa694c011a1becf637b2bb07c49d16aa6adb6 Mon Sep 17 00:00:00 2001 From: "atharva.dubey" Date: Tue, 20 May 2025 10:07:24 +0100 Subject: [PATCH 2/4] add comment explaining the cmake change --- ggml/src/ggml-sycl/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ggml/src/ggml-sycl/CMakeLists.txt b/ggml/src/ggml-sycl/CMakeLists.txt index 29585bd8ef2c5..9ef9652ec7692 100644 --- a/ggml/src/ggml-sycl/CMakeLists.txt +++ b/ggml/src/ggml-sycl/CMakeLists.txt @@ -51,9 +51,19 @@ target_compile_options(ggml-sycl PRIVATE "-Wno-narrowing") # Link against oneDNN set(GGML_SYCL_DNNL 0) if(GGML_SYCL_DNN) + +# The nightly dpcpp compiler recently stopped shipping libOpenCL +# When using a nightly build of oneDNN built with the said nightly compiler, it links against the target OpenCL::OpenCL +# For context,this line in the oneDNN CMake: +# https://github.com/uxlfoundation/oneDNN/blob/743e4273d18bcb0e733723bf9289f14e8366687f/cmake/SYCL.cmake#L127 +# and when using this build of oneDNN in llama, it would expect the target OpenCL::OpenCL to be available. +# Hence the below find_package call is required. At the time of writing, the release compiler +# ships libOpenCL,hence only finding the package when the compiler is clang (nightly). + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") find_package(OpenCL REQUIRED) endif() + find_package(DNNL) if(DNNL_FOUND) if (NOT DEFINED DNNL_GPU_VENDOR) From 13719521ff8690ea1f687b58245ac50e6aa3dd70 Mon Sep 17 00:00:00 2001 From: "atharva.dubey" Date: Tue, 20 May 2025 10:25:46 +0100 Subject: [PATCH 3/4] fix trailing whitespaces error, which got added in comment --- ggml/src/ggml-sycl/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ggml/src/ggml-sycl/CMakeLists.txt b/ggml/src/ggml-sycl/CMakeLists.txt index 9ef9652ec7692..bd06786b9c748 100644 --- a/ggml/src/ggml-sycl/CMakeLists.txt +++ b/ggml/src/ggml-sycl/CMakeLists.txt @@ -53,12 +53,12 @@ set(GGML_SYCL_DNNL 0) if(GGML_SYCL_DNN) # The nightly dpcpp compiler recently stopped shipping libOpenCL -# When using a nightly build of oneDNN built with the said nightly compiler, it links against the target OpenCL::OpenCL -# For context,this line in the oneDNN CMake: +# When using a nightly build of oneDNN built with the said nightly compiler, it links against the target OpenCL::OpenCL +# For context,this line in the oneDNN CMake: # https://github.com/uxlfoundation/oneDNN/blob/743e4273d18bcb0e733723bf9289f14e8366687f/cmake/SYCL.cmake#L127 # and when using this build of oneDNN in llama, it would expect the target OpenCL::OpenCL to be available. # Hence the below find_package call is required. At the time of writing, the release compiler -# ships libOpenCL,hence only finding the package when the compiler is clang (nightly). +# ships libOpenCL,hence only finding the package when the compiler is clang (nightly). if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") find_package(OpenCL REQUIRED) From 39e96b2a352a1dd415d391199f7af16e8a0bdce2 Mon Sep 17 00:00:00 2001 From: Atharva Dubey Date: Tue, 20 May 2025 12:17:42 +0100 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Romain Biessy --- ggml/src/ggml-sycl/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ggml/src/ggml-sycl/CMakeLists.txt b/ggml/src/ggml-sycl/CMakeLists.txt index bd06786b9c748..bcb4749e3844a 100644 --- a/ggml/src/ggml-sycl/CMakeLists.txt +++ b/ggml/src/ggml-sycl/CMakeLists.txt @@ -52,13 +52,13 @@ target_compile_options(ggml-sycl PRIVATE "-Wno-narrowing") set(GGML_SYCL_DNNL 0) if(GGML_SYCL_DNN) -# The nightly dpcpp compiler recently stopped shipping libOpenCL +# The nightly dpcpp compiler may not ship libOpenCL # When using a nightly build of oneDNN built with the said nightly compiler, it links against the target OpenCL::OpenCL -# For context,this line in the oneDNN CMake: +# For context, this line in the oneDNN CMake: # https://github.com/uxlfoundation/oneDNN/blob/743e4273d18bcb0e733723bf9289f14e8366687f/cmake/SYCL.cmake#L127 # and when using this build of oneDNN in llama, it would expect the target OpenCL::OpenCL to be available. # Hence the below find_package call is required. At the time of writing, the release compiler -# ships libOpenCL,hence only finding the package when the compiler is clang (nightly). +# ships libOpenCL, hence only finding the package when the compiler is clang (nightly). if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") find_package(OpenCL REQUIRED)