Commit 57d0c6217 for llama.cpp
commit 57d0c6217c341b3b9ca942028842fc0ef21220cb
Author: Anthony N <anemitz@gmail.com>
Date: Sun Nov 29 23:03:51 2026 -0700
metal : avoid a second pipeline cache lookup (#32977)
Assisted-by: Claude Opus 5.5
Assisted-by: Codex
diff --git a/ggml/src/ggml-metal/ggml-metal-device.cpp b/ggml/src/ggml-metal/ggml-metal-device.cpp
index c3d4f8ef5..010124873 100644
--- a/ggml/src/ggml-metal/ggml-metal-device.cpp
+++ b/ggml/src/ggml-metal/ggml-metal-device.cpp
@@ -54,11 +54,12 @@ void ggml_metal_pipelines_add(ggml_metal_pipelines_t ppls, const char * name, gg
}
ggml_metal_pipeline_t ggml_metal_pipelines_get(ggml_metal_pipelines_t ppls, const char * name) {
- if (ppls->data.find(name) == ppls->data.end()) {
+ const auto it = ppls->data.find(name);
+ if (it == ppls->data.end()) {
return nullptr;
}
- return ppls->data[name];
+ return it->second;
}
struct ggml_metal_pipeline_with_params ggml_metal_library_get_pipeline_base(ggml_metal_library_t lib, ggml_op op) {