Files
Paul Adenot a45275fb79 Bug 2068580 - Vendor the Metal backend at the pinned llama.cpp revision. r=ai-platform-reviewers,valentinp
The Metal files were taken from an older llama.cpp than the revision moz.yaml
pins, which is why they had to be in "keep" rather than revendored.

This vendors the backend at 74ade527 instead, matching llama.cpp. At that rev,
it is split into a few files. The embedding of the shader source is unchanged: the
.metal file still has the __embed_ggml-common.h__ and ggml-metal-impl.h
placeholders generate_metal_embed.py substitutes. etc.

ggml-metal-device.m and ggml-metal-device.cpp would compile to the same object
name, so run_parser.py renames the former to ggml-metal-device-m.m, like it
already does for ggml.c and ggml-cpu.c.

Two patches are needed on top: <memory> for std::unique_ptr in ggml-metal.cpp,
and a guard around -[MTLSharedEvent waitUntilSignaledValue:timeoutMS:], which
is macOS 12 while we deploy to 10.15 (11.0 on aarch64).

`mach vendor --patch-mode check` now reproduces the tree.

Differential Revision: https://phabricator.services.mozilla.com/D322929
2026-09-10 13:58:18 +00:00

37 lines
875 B
Diff

diff --git a/ggml/src/gguf.cpp b/ggml/src/gguf.cpp
index c4b9b54290ea..ffbfccec4a60 100644
--- a/ggml/src/gguf.cpp
+++ b/ggml/src/gguf.cpp
@@ -14,6 +14,7 @@
#include <stdexcept>
#include <string>
#include <vector>
+#include <cerrno>
#include "moz-overrides.h"
diff --git a/src/llama-model-loader.cpp b/src/llama-model-loader.cpp
index e3e93b135e96..d75719583881 100644
--- a/src/llama-model-loader.cpp
+++ b/src/llama-model-loader.cpp
@@ -11,6 +11,7 @@
#include <cstdint>
#include <cstring>
#include <regex>
+#include <mutex>
#include "moz-overrides.h"
diff --git a/ggml/src/ggml-metal/ggml-metal.cpp b/ggml/src/ggml-metal/ggml-metal.cpp
--- a/ggml/src/ggml-metal/ggml-metal.cpp
+++ b/ggml/src/ggml-metal/ggml-metal.cpp
@@ -7,6 +7,7 @@
#include "ggml-metal-context.h"
#include "ggml-metal-ops.h"
+#include <memory>
#include <mutex>
#include <string>