Files
searchi/tools/embeddinggemma2/cpu-only-loader.patch
T

32 lines
1.1 KiB
Diff

--- 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, independent of per-DLL CRT environment state.
+ 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
+ // Do not inspect GPU backends or GGML_BACKEND_PATH. The caller supplies
+ // the executable directory, so working-directory discovery is excluded.
+ ggml_backend_load_best("cpu", silent, dir_path);
+}
+
void ggml_backend_load_all_from_path(const char * dir_path) {
#ifdef NDEBUG
bool silent = true;