mirror of
https://github.com/ikawrakow/ik_llama.cpp.git
synced 2026-07-21 02:05:35 +00:00
Be able to force synchronization when copying graph ginputs
This commit is contained in:
@@ -108,6 +108,7 @@ endif()
|
||||
# ggml core
|
||||
set(GGML_SCHED_MAX_COPIES "1" CACHE STRING "ggml: max input copies for pipeline parallelism")
|
||||
set(GGML_MAX_CONTEXTS "" CACHE STRING "ggml: max model contexts (override only; defaults to 64 in the code)")
|
||||
set(GGML_FORCE_SYNC "" CACHE STRING "ggml-backend: control device copy synchronization")
|
||||
|
||||
# 3rd party libs / backends
|
||||
option(GGML_ACCELERATE "ggml: enable Accelerate framework" ON)
|
||||
|
||||
@@ -1462,6 +1462,9 @@ add_library(ggml
|
||||
if (EMSCRIPTEN)
|
||||
set_target_properties(ggml PROPERTIES COMPILE_FLAGS "-msimd128")
|
||||
endif()
|
||||
if (GGML_FORCE_SYNC)
|
||||
set_source_files_properties(ggml-backend.cpp PROPERTIES COMPILE_FLAGS -DGGML_FORCE_SYNC)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(ggml PUBLIC ${GGML_CDEF_PUBLIC})
|
||||
target_compile_definitions(ggml PRIVATE $<$<CONFIG:Release>:NDEBUG>)
|
||||
|
||||
@@ -1974,7 +1974,11 @@ static bool ggml_backend_sched_alloc_splits(ggml_backend_sched_t sched) {
|
||||
static void ggml_backend_sched_copy_inputs(ggml_backend_sched_t sched, ggml_backend_sched_split * split, std::array<bool, GGML_SCHED_MAX_BACKENDS> & needs_sync,
|
||||
std::vector<int32_t> & ids, std::vector<uint32_t> & unique_ids, ggml_tensor * last_ids_tensor) {
|
||||
if (split->n_inputs < 1) return;
|
||||
#ifdef GGML_FORCE_SYNC
|
||||
constexpr bool k_set_sync = true;
|
||||
#else
|
||||
constexpr bool k_set_sync = false;
|
||||
#endif
|
||||
int split_backend_id = split->backend_id;
|
||||
ggml_backend_t split_backend = sched->backends[split_backend_id];
|
||||
ggml_backend_t last_input_backend = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user