--- a/ggml/include/ggml-backend.h +++ b/ggml/include/ggml-backend.h @@ -260,6 +260,8 @@ // Load all known backends from dynamic libraries GGML_API void ggml_backend_load_all(void); GGML_API void ggml_backend_load_all_from_path(const char * dir_path); + // Searchi: explicit CPU-only startup must never load or probe GPU modules. + GGML_API void ggml_backend_load_cpu_only_from_path(const char * dir_path); // // Backend scheduler --- a/ggml/src/ggml-backend-reg.cpp +++ b/ggml/src/ggml-backend-reg.cpp @@ -575,6 +575,17 @@ ggml_backend_load_all_from_path(nullptr); } +void ggml_backend_load_cpu_only_from_path(const char * dir_path) { +#ifdef NDEBUG + const bool silent = true; +#else + const bool silent = false; +#endif + // Only CPU variants in the owned executable directory. No GPU registry + // probes, working-directory discovery or GGML_BACKEND_PATH injection. + ggml_backend_load_best("cpu", silent, dir_path); +} + void ggml_backend_load_all_from_path(const char * dir_path) { #ifdef NDEBUG bool silent = true;