Repository navigation
Carry llama.cpp#31437: vm_allocate host buffers on iOS (llamadart#2004) - #44
Merged
Merged
Conversation
…tform iOS host buffers came from posix_memalign, whose freed pages libmalloc keeps in the app footprint (llamadart#2004). The iOS artifact check now rejects a _posix_memalign import.
18 tasks
This was referenced Nov 14, 2026
Draft
Track retirement of loader_scratch_vm_allocate.patch (iOS loader scratch stays in the footprint)
#45
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the iOS host-buffer footprint behind llamadart#2004. ggml's CPU and Metal host buffers use
posix_memalign/freeon non-macOS Apple platforms, and libmalloc keeps the freed pages in the app footprint. Backport of llama.cppea24b952c(ggml-org/llama.cpp#31437) as two carried patches; retire when the pinned ggml includes it.ggml_apple_vm_allocate.patch(ggml.c, targetggml-base) andggml_metal_apple_vm_allocate.patch(ggml-metal-device.m, targetggml-metal, Apple only).sd_native_carry_patchtakes an optionalTARGET(defaultstable-diffusion); target sources are matched as absolute paths.tools/validate_artifacts.py: an iOS library must not import_posix_memalign. Unit case intests/test_tools.py.patches/README.mdrow, README mention. No CHANGELOG exists in this repo.macOS is unchanged (already
vm_allocate).Validation
python3 -m unittest discover -s testsvalidate_artifacts.py_vm_allocate/_vm_deallocate, not_posix_memalign; no object in the build imports_posix_memalignvalidate_artifacts.pyCI proof: the
build (ios-arm64),build (ios-arm64-sim)andbuild (ios-x64-sim)jobs each run the new rule (target osios); it fails on the unpatched pin.Device footprint evidence is a separate llamadart-side run. No release or tag in this PR.