Skip to content

Commit 8ee7677

Browse files
Rbiessyggerganov
authored andcommitted
sycl : Add option to set the SYCL architecture for all targets (llama/10266)
* Add option to set the SYCL architecture for all targets * Convert GGML_SYCL_HIP_TARGET to the more generic GGML_SYCL_ARCH option * Document that setting GGML_SYCL_ARCH can improve the performance
1 parent 45f1f91 commit 8ee7677

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

ggml/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ option(GGML_SYCL "ggml: use SYCL"
164164
option(GGML_SYCL_F16 "ggml: use 16 bit floats for sycl calculations" OFF)
165165
set (GGML_SYCL_TARGET "INTEL" CACHE STRING
166166
"ggml: sycl target device")
167+
set (GGML_SYCL_DEVICE_ARCH "" CACHE STRING
168+
"ggml: sycl device architecture")
167169

168170
# extra artifacts
169171
option(GGML_BUILD_TESTS "ggml: build tests" ${GGML_STANDALONE})

ggml/src/ggml-sycl/CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,14 @@ else()
7272
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl-targets=nvptx64-nvidia-cuda")
7373
target_link_libraries(ggml-sycl PRIVATE sycl pthread m dl onemkl)
7474
elseif (GGML_SYCL_TARGET STREQUAL "AMD")
75-
if (GGML_SYCL_HIP_TARGET STREQUAL "")
76-
message(ERROR "Can't enable SYCL hip backend, GGML_SYCL_HIP_TARGET has not been set.")
75+
if (NOT GGML_SYCL_DEVICE_ARCH)
76+
message(ERROR "Can't enable SYCL hip backend, GGML_SYCL_DEVICE_ARCH has not been set.")
7777
endif()
78-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=${GGML_SYCL_HIP_TARGET}")
78+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsycl-targets=amdgcn-amd-amdhsa")
7979
target_link_libraries(ggml-sycl PRIVATE sycl pthread m dl onemkl)
8080
endif()
81+
82+
if (GGML_SYCL_DEVICE_ARCH)
83+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Xsycl-target-backend --offload-arch=${GGML_SYCL_DEVICE_ARCH}")
84+
endif()
8185
endif()

0 commit comments

Comments
 (0)