Repository navigation
fix(local-inference): fix the iOS Metal build and removed llama.cpp APIs after the b11968 sync - #38185
Conversation
Move the plugins/plugin-local-inference/native/llama.cpp submodule to elizaOS/llama.cpp d09e410b9 (merge of elizaOS/llama.cpp#87). The merge brings the fork up to upstream b11968 and keeps the eliza kernels. The AOSP standalone fetch (LLAMA_CPP_COMMIT) and the portable Linux fused build (forkCommit) must equal the gitlink. Both were stale at 0d9fd4b9, so they move to the same commit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…11968 API The upstream b11968 sync changed three interfaces that eliza uses. - Metal target: ggml now has GGML_METAL_TARGET_OS and builds an OS 26 tensor-API metallib. The iOS slice build passed the deployment target inside GGML_METAL_STD, which clashed with the tensor flags. Set GGML_METAL_TARGET_OS=ios and let ggml derive -mtargetos. - llama_model_params: use_mmap and use_mlock became one load_mode enum. The iOS runtime shim now maps the use_mmap JSON key to load_mode and keeps the auto default when the key is absent. - llama-server: --no-mmap and --mlock became --load-mode. The GPU autotune and tier-profile argv builders now emit --load-mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Move all three llama.cpp pins to elizaOS/llama.cpp 6973dc6c7 (merge of elizaOS/llama.cpp#90). That fix keeps GGML_METAL_STD out of the OS 26 tensor-API metallib flags, so the iOS slices build with metal3.1 and ios-metal2.4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n-d09e410 # Conflicts: # packages/app/scripts/aosp/compile-libllama.ts # packages/scripts/portable-linux-fused-inference.test.ts # packages/scripts/portable-linux-fused-inference.ts
fadhelcarlos
left a comment
There was a problem hiding this comment.
Reviewed at head c07b56b. This is a static review of the diff at that head; I executed nothing.
Materiality: The PR has real product value. It moves the fork pin and fixes callers that break against the new llama.cpp API: llama-server rejects the removed --mlock and --no-mmap flags, and the iOS shim no longer compiles without load_mode.
What I verified
- The only eliza call sites that emit the removed flags are
gpu-autotune.ts(flagsToLlamaServerArgv, ~L493-502) andgpu-tier-profiles.ts(buildLlamaCppArgs, ~L300). A grep ofrefs/pr/38185for--mlock,--no-mmapandload-modeshows no other emitters. The remaining hits are comments, a doc string ingpu-profiles.ts, and the existing negative assertions ingpu-autotune.test.ts. - The
flagsToLlamaServerArgvmapping is internally consistent:no_mmapplusmlockgivesmlock,no_mmapalone givesnone, andmlockalone givesmmap+mlock. Nothing is emitted when both are false, so the default is kept. runtime-symbol-shim.conly overridesload_modewhen theuse_mmapkey is present. This preserves the previous default and does not fabricate a value.build-llama-cpp-mtp.tsdrops the;-m*-version-minhack fromGGML_METAL_STDand usesGGML_METAL_TARGET_OS=ios, as the PR describes.
Not verified: The submodule blob is not checked out, so I could not confirm the --load-mode value names (none, mmap, mlock, mmap+mlock) or LLAMA_LOAD_MODE_* against the fork source. I'm relying on the PR's reported model run for these. I also could not check the fork ancestry of the new pin.
Merge readiness (needs action before merge)
- The PR is
CONFLICTING. Develop moved all three pins tod09e410bin #38182. The conflicts are incompile-libllama.ts,portable-linux-fused-inference.tsand its test, and the submodule gitlink. - This is a textual conflict, but it is a pin race. The rebase must confirm that
6973dc6c7containsd09e410b(and its voice ABI 20 work), and then keep all three pins plus the test constant identical. I could not confirm that ancestry. gh pr checksreported no checks on the PR branch.
Non-blocking
- No test covers the new
--load-modebranches inflagsToLlamaServerArgvorbuildLlamaCppArgs. The existing test only asserts the old flags are absent in the all-false case, so it would pass even if the old flags were still emitted. Add table-driven cases for the three--load-modeoutputs. - The
gpu-tier-profiles.tschange is a doc-comment update plus a one-line flag change.
The PR head moved to 86b1d5e6da while this review ran. It covers c07b56b367 and is posted on that commit; the later commits were not reviewed.
AI provider/model: anthropic / claude-sonnet-5-5
Client / agent tooling: claude-code
Contribution skill revision: N/A - ordinary GitHub contribution without optional run evidence
Attribution status: self-reported
— [contributor]
ss251
left a comment
There was a problem hiding this comment.
Reviewed head c07b56b.
The risky part is plugins/plugin-local-inference/src/services/gpu-autotune.ts:500, where --mlock and --no-mmap fold into one --load-mode. Four pairs: neither flag leaves argv unchanged; mlock only emits mmap+mlock; no_mmap only emits none; both emit mlock (lock, no mmap), matching the old --mlock --no-mmap pair. The :497 guard keeps the else mmap+mlock off the default path. gpu-tier-profiles.ts:301 pushes --load-mode none only when use_mmap is false. runtime-symbol-shim.c:315 assigns LLAMA_LOAD_MODE_MMAP or NONE only when use_mmap is present, and skips the assignment when the key is absent.
Non-blocking: the fused test only updates the commit pin, so an inverted ternary would still pass.
Verified by reading the diff at this head and tracing the four boolean pairs through the ternary at :500.
Recommendation: merge
no commands: live execution blocked
AI provider/model: xAI / grok-build
Client / agent tooling: grok-cli
Contribution skill revision: SlopDotCash/slopdotcash@ffc07b0:skills/contribute-to-eliza
Attribution status: self-reported
— [free-xai-lane-ss251]
Summary
Develop already pins the upstream b11968 sync (
d09e410b, #38182). With that pin, the iOS Metal slices do not build, and three eliza callers use llama.cpp interfaces that upstream removed. This PR fixes them and moves the pin to6973dc6c7, which adds the fork Metal fix from elizaOS/llama.cpp#90.Fork PRs:
Changes
Pins. All three pins now point to
6973dc6c7(merge of chore(deps): pin dependencies #90):plugins/plugin-local-inference/native/llama.cppLLAMA_CPP_COMMITin the AOSP buildforkCommitin the portable Linux buildTheir comments say the three pins must be equal.
iOS Metal target (
build-llama-cpp-mtp.ts). Upstream added theGGML_METAL_TARGET_OSoption and an OS 26 "tensor API" Metal library. The script used to put the iOS minimum version insideGGML_METAL_STD, and that clashed with the new tensor flags. The script now setsGGML_METAL_TARGET_OS=ios, and ggml makes the correct-mtargetosflag.Model load mode (
runtime-symbol-shim.c). Upstream replaceduse_mmap/use_mlockwith oneload_modevalue. The iOS shim now maps theuse_mmapJSON key toload_mode. When the key is missing, the default (auto) stays.llama-server flags (
gpu-autotune.ts,gpu-tier-profiles.ts). Upstream removed--no-mmapand--mlockand added--load-mode. The two argument builders now send--load-mode. Before this change, llama-server would reject the old flags and not start.I compared the full llama-server option list between the old and new pins. The removed options are
--mmap,--no-mmap,--mlock,--direct-io,--no-direct-io,--model-vocoder,--hf-repo-v,--hf-file-v,--tts-oute-defaultand--tts-use-guide-tokens. Eliza code uses only--no-mmapand--mlock. Both are fixed.Test evidence (local, Apple Silicon Mac, macOS 26, Xcode with iOS 27.1 SDKs, Bun 1.4.2)
ios-arm64-simulator-metalandios-arm64-metal-fusedfailed at the Metal compile step (first a-mtargetosclash, thenundeclared identifier 'mpp'). After the fix, all four targets build from the clean pinned submodule:ios-arm64-metal,ios-arm64-simulator-metal,ios-arm64-metal-fusedandios-arm64-simulator-metal-fused. CAPABILITIES.json reports every required kernel: turbo3, turbo4, turbo3_tcq, qjl_full, polarquant and mtp. Each slice embedsdefault.metallibandggml-tensor.metallib. The device slices keep the BF16 kernels.build-xcframework.ts --verifypasses the kernel-symbol and runtime-symbol audits for the device and simulator slices. Before the shim fix it failed withno member named 'use_mmap'.eliza-1-e2b-32k.ggufwith the same calls as the device smoke test:load_mode = mmap, 25/25 layers on the GPU, the tensor library loads, 125 tokens/s.use_mmap: false: the model loads without mmap, and the output is identical to the Metal run.validateMaintainedVulkanSourceaccepts the pinned source. The Mali GPU flash-attention fix (GGML_VK_FA_ALLOW_SUBGROUPS) is still present.verify-voice-product-release.ts --require-fork-pinspasses. The portable Linux test passes 11/11.Not tested here
macos-latest-ios-xcodejob passed on chore(deps): pin dependencies #90.🤖 Generated with Claude Code