Commit 1b70350c9 for llama.cpp

commit 1b70350c92563449576bcbbf552994b1d1ed847d
Author: Adrien Gallouët <angt@huggingface.co>
Date:   Tue Oct 13 20:22:19 2026 +0200

    ggml : simplify backend search path error handling (#28367)

    Signed-off-by: Adrien Gallouët <angt@huggingface.co>

diff --git a/ggml/src/ggml-backend-reg.cpp b/ggml/src/ggml-backend-reg.cpp
index 1c18b82cd..4e9681c9f 100644
--- a/ggml/src/ggml-backend-reg.cpp
+++ b/ggml/src/ggml-backend-reg.cpp
@@ -493,7 +493,7 @@ static ggml_backend_reg_t ggml_backend_load_best(const char * name, bool silent,
         std::error_code cwd_ec;
         const fs::path cwd = fs::current_path(cwd_ec);
         if (cwd_ec) {
-            GGML_LOG_DEBUG("%s: current_path() failure, error-message: %s\n", __func__, cwd_ec.message().c_str());
+            GGML_LOG_DEBUG("%s: failed to get current directory: %s\n", __func__, cwd_ec.message().c_str());
         } else {
             search_paths.push_back(cwd);
         }
@@ -506,20 +506,9 @@ static ggml_backend_reg_t ggml_backend_load_best(const char * name, bool silent,
     std::error_code ec;

     for (const auto & search_path : search_paths) {
-        if (!fs::exists(search_path, ec)) {
-            if (ec) {
-                GGML_LOG_DEBUG("%s: posix_stat(%s) failure, error-message: %s\n", __func__, path_str(search_path).c_str(), ec.message().c_str());
-            } else {
-                GGML_LOG_DEBUG("%s: search path %s does not exist\n", __func__, path_str(search_path).c_str());
-            }
-            continue;
-        }
         std::error_code dir_ec;
-        fs::directory_iterator dir_it(search_path, fs::directory_options::skip_permission_denied, dir_ec);
-        if (dir_ec) {
-            GGML_LOG_DEBUG("%s: failed to enumerate %s: %s\n", __func__, path_str(search_path).c_str(), dir_ec.message().c_str());
-            continue;
-        }
+        fs::directory_iterator dir_it(search_path, dir_ec);
+
         for (const fs::directory_iterator end; dir_it != end; dir_it.increment(dir_ec)) {
             const auto & entry = *dir_it;
             if (entry.is_regular_file(ec)) {
@@ -550,6 +539,10 @@ static ggml_backend_reg_t ggml_backend_load_best(const char * name, bool silent,
                 }
             }
         }
+
+        if (dir_ec) {
+            GGML_LOG_DEBUG("%s: failed to enumerate %s: %s\n", __func__, path_str(search_path).c_str(), dir_ec.message().c_str());
+        }
     }

     if (best_score == 0) {