revert: restore public backend extension integration

This commit is contained in:
leejet committed 2026-11-01 04:09:12 +08:00
1 parent a013932674
commit 75e8157b01
26 files changed
+590 -358

No files matched your search

+12 -20
View File
@@ -9,29 +9,21 @@ if(NOT TARGET ggml)
add_library(ggml ALIAS ggml::ggml)
endif()
get_target_property(sd_ggml_imported ggml IMPORTED)
if(sd_ggml_imported)
set(sd_ggml_private_include "${SD_GGML_SOURCE_DIR}/src")
else()
get_target_property(sd_ggml_private_include ggml SOURCE_DIR)
if(SD_USE_UPSTREAM_GGML)
get_target_property(sd_ggml_imported ggml IMPORTED)
if(sd_ggml_imported)
set(sd_ggml_private_include "${SD_GGML_SOURCE_DIR}/src")
else()
get_target_property(sd_ggml_private_include ggml SOURCE_DIR)
endif()
if(NOT EXISTS "${sd_ggml_private_include}/ggml-impl.h")
message(FATAL_ERROR "Set SD_GGML_SOURCE_DIR to the source tree matching the selected ggml library (ggml-impl.h is required).")
endif()
target_include_directories(${SD_LIB} PRIVATE "${sd_ggml_private_include}")
set_property(TARGET ${SD_LIB} PROPERTY SD_GGML_PRIVATE_INCLUDE_DIR "${sd_ggml_private_include}")
endif()
if(NOT EXISTS "${sd_ggml_private_include}/ggml-impl.h")
message(FATAL_ERROR "Set SD_GGML_SOURCE_DIR to the source tree matching the selected ggml library (ggml-impl.h is required).")
endif()
target_include_directories(${SD_LIB} PRIVATE "${sd_ggml_private_include}")
set_property(TARGET ${SD_LIB} PROPERTY SD_GGML_PRIVATE_INCLUDE_DIR "${sd_ggml_private_include}")
if(SD_USE_UPSTREAM_GGML)
target_compile_definitions(${SD_LIB} PUBLIC SD_USE_UPSTREAM_GGML)
message(WARNING "Using upstream GGML: INT8 tensorwise/convrot is disabled and FP8 weights are converted to F16 at load time. Some operators may be unsupported and performance may be lower than with patched GGML.")
endif()
if(NOT SD_USE_UPSTREAM_GGML AND (SD_CUDA OR SD_HIPBLAS OR SD_MUSA))
set(SD_GGML_CUDA_INCLUDE_DIR "${sd_ggml_private_include}/ggml-cuda")
if(NOT EXISTS "${SD_GGML_CUDA_INCLUDE_DIR}/vendors/cuda.h" OR
NOT EXISTS "${SD_GGML_CUDA_INCLUDE_DIR}/vendors/hip.h" OR
NOT EXISTS "${SD_GGML_CUDA_INCLUDE_DIR}/vendors/musa.h")
message(FATAL_ERROR "Set SD_GGML_SOURCE_DIR to the matching ggml source tree for CUDA/HIP/MUSA vendor headers.")
endif()
target_include_directories(${SD_LIB} PRIVATE "${SD_GGML_CUDA_INCLUDE_DIR}")
endif()