opencl: rename backend opencl2 -> opencl

This commit is contained in:
Li He 2024-12-10 22:17:24 -08:00 committed by Max Krasnyansky
parent e9a97381f2
commit 34f2fc15ea
15 changed files with 9 additions and 22 deletions

View file

@ -298,13 +298,6 @@ else ()
ggml_add_cpu_backend_variant_impl("")
endif()
if (GGML_OPENCL)
set(GGML_OPENCL2 ON)
add_compile_definitions(GGML_USE_OPENCL)
else ()
set(GGML_OPENCL2 OFF)
endif ()
ggml_add_backend(BLAS)
ggml_add_backend(CANN)
ggml_add_backend(CUDA)
@ -315,7 +308,7 @@ ggml_add_backend(MUSA)
ggml_add_backend(RPC)
ggml_add_backend(SYCL)
ggml_add_backend(Vulkan)
ggml_add_backend(OpenCL2)
ggml_add_backend(OpenCL)
foreach (target ggml-base ggml)
target_include_directories(${target} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include> $<INSTALL_INTERFACE:include>)

View file

@ -46,8 +46,8 @@
#include "ggml-vulkan.h"
#endif
#ifdef GGML_USE_OPENCL2
#include "ggml-opencl2.h"
#ifdef GGML_USE_OPENCL
#include "ggml-opencl.h"
#endif
#ifdef GGML_USE_BLAS
@ -150,7 +150,7 @@ struct ggml_backend_registry {
#ifdef GGML_USE_VULKAN
register_backend(ggml_backend_vk_reg());
#endif
#ifdef GGML_USE_OPENCL2
#ifdef GGML_USE_OPENCL
register_backend(ggml_backend_opencl2_reg());
#endif
#ifdef GGML_USE_CANN
@ -546,6 +546,7 @@ void ggml_backend_load_all_from_path(const char * dir_path) {
ggml_backend_load_best("rpc", silent, dir_path);
ggml_backend_load_best("sycl", silent, dir_path);
ggml_backend_load_best("vulkan", silent, dir_path);
ggml_backend_load_best("opencl", silent, dir_path);
ggml_backend_load_best("musa", silent, dir_path);
ggml_backend_load_best("cpu", silent, dir_path);
}

View file

@ -4,21 +4,14 @@ find_package(OpenCL)
if (OpenCL_FOUND)
find_package(Python3 REQUIRED)
set(TARGET_NAME ggml-opencl2)
set(TARGET_NAME ggml-opencl)
ggml_add_backend_library(${TARGET_NAME}
ggml-opencl2.cpp
../../include/ggml-opencl2.h)
ggml-opencl.cpp
../../include/ggml-opencl.h)
target_link_libraries(${TARGET_NAME} PRIVATE ggml-base ${OpenCL_LIBRARIES})
target_include_directories(${TARGET_NAME} PRIVATE . .. ${OpenCL_INCLUDE_DIRS})
# TODO - this is kind of strange. We have been calling this backend OpenCL2,
# so everything (function names, folder name, etc) except macro switches
# has been OpenCL2. Now, the backend frameworke enforces the use of the folder
# name as the backend name and switch. So, GGML_USE_OPENCL2 is used in
# ggml-backend-reg.cpp, but the rest still uses GGML_USE_OPENCL.
add_compile_definitions(GGML_USE_OPENCL)
if (GGML_OPENCL_PROFILING)
message(STATUS "OpenCL profiling enabled (increases CPU overhead)")
add_compile_definitions(GGML_OPENCL_PROFILING)

View file

@ -7,7 +7,7 @@
#pragma GCC diagnostic ignored "-Wgnu-anonymous-struct"
#pragma GCC diagnostic ignored "-Woverlength-strings"
#include "ggml-opencl2.h"
#include "ggml-opencl.h"
#include "ggml-backend.h"
#include "ggml-impl.h"
#include "ggml-backend-impl.h"