Skip to content

metal : use residency set for other platforms #11648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

jhen0409
Copy link
Collaborator

@jhen0409 jhen0409 commented Feb 4, 2025

Enable for iOS/tvOS 18.0+ and visionOS 2.0+. (ref)

I tested it on iPhone 15 Pro with llama-swiftui example (with #11645) without any issues. Also, llama.rn have been started use it and not noticed any issues so far.

@jhen0409 jhen0409 requested a review from ggerganov February 4, 2025 07:33
@github-actions github-actions bot added ggml changes relating to the ggml tensor library for machine learning Apple Metal https://en.wikipedia.org/wiki/Metal_(API) labels Feb 4, 2025
@ggerganov ggerganov merged commit 534c46b into ggml-org:master Feb 4, 2025
46 checks passed
@jhen0409 jhen0409 deleted the mtl-rset-platforms branch February 5, 2025 02:30
@charles-dyfis-net
Copy link
Contributor

charles-dyfis-net commented Feb 5, 2025

This change appears to have broken the nix build on Darwin. After it, but not before it:

[24/209] Building C object ggml/src/ggml-metal/CMakeFiles/ggml-metal.dir/ggml-metal.m.o
FAILED: ggml/src/ggml-metal/CMakeFiles/ggml-metal.dir/ggml-metal.m.o
/nix/store/v39c0h6xv6hvki2k1bsyp5n090q8y2bp-clang-wrapper-16.0.6/bin/clang -DGGML_BACKEND_BUILD -DGGML_BACKEND_SHARED -DGGML_METAL_EMBED_LIBRARY -DGGML_SCHED_MAX_COPIES=4 -DGGML_SHARED -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE=600 -Dggml_metal_EXPORTS -I/tmp/nix-build-llama-cpp-metalkit-0.0.0.drv-0/source/ggml/src/ggml-metal/.. -I/tmp/nix-build-llama-cpp-metalkit-0.0.0.drv-0/source/ggml/src/../include -F/nix/store/amdympl4rz7kj93j82cva60v8007n4nv-apple-sdk-11.3/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks -D__ARM_FEATURE_DOTPROD=1 -O3 -DNDEBUG -std=gnu11 -isysroot /nix/store/amdympl4rz7kj93j82cva60v8007n4nv-apple-sdk-11.3/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -fPIC -Wshadow -Wstrict-prototypes -Wpointer-arith -Wmissing-prototypes -Werror=implicit-int -Werror=implicit-function-declaration -Wall -Wextra -Wpedantic -Wcast-qual -Wno-unused-function -Wunreachable-code-break -Wunreachable-code-return -Wdouble-promotion -MD -MT ggml/src/ggml-metal/CMakeFiles/ggml-metal.dir/ggml-metal.m.o -MF ggml/src/ggml-metal/CMakeFiles/ggml-metal.dir/ggml-metal.m.o.d -o ggml/src/ggml-metal/CMakeFiles/ggml-metal.dir/ggml-metal.m.o -c /tmp/nix-build-llama-cpp-metalkit-0.0.0.drv-0/source/ggml/src/ggml-metal/ggml-metal.m
/tmp/nix-build-llama-cpp-metalkit-0.0.0.drv-0/source/ggml/src/ggml-metal/ggml-metal.m:26:5: error: 'TARGET_OS_VISION' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
    TARGET_OS_VISION && __VISION_OS_VERSION_MAX_ALLOWED >= 200000
    ^
/tmp/nix-build-llama-cpp-metalkit-0.0.0.drv-0/source/ggml/src/ggml-metal/ggml-metal.m:518:20: warning: variable 'bundle' set but not used [-Wunused-but-set-variable]
        NSBundle * bundle = nil;
                   ^
1 warning and 1 error generated.

@ggerganov
Copy link
Member

ggerganov commented Feb 6, 2025

Since you have a repro, could you propose a fix - should be a simple change I think.

Edit: nvm, just saw #11690

tinglou pushed a commit to tinglou/llama.cpp that referenced this pull request Feb 13, 2025
orca-zhang pushed a commit to orca-zhang/llama.cpp that referenced this pull request Feb 26, 2025
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Feb 26, 2025
mglambda pushed a commit to mglambda/llama.cpp that referenced this pull request Mar 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Apple Metal https://en.wikipedia.org/wiki/Metal_(API) ggml changes relating to the ggml tensor library for machine learning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants