metal: enable Metal 4.0 tensor API on M5+/A19+ (#27461)

* metal : request Metal 4.0 language version for the tensor API

* metal : load the tensor API kernels from a separate metallib

* tests : add external-metallib tensor API regression test

* metal : fix metallib build order for the tensor API kernels
This commit is contained in:
James Francis
2026-09-01 12:02:42 +03:00
committed by GitHub
parent 234a6ebaa0
commit d5d993a093
3 changed files with 124 additions and 34 deletions
+8
View File
@@ -299,6 +299,14 @@ if (NOT LLAMA_SANITIZE_ADDRESS AND NOT GGML_SCHED_NO_REALLOC)
endif()
llama_build_and_test(test-backend-ops.cpp)
# the tensor API kernels come from a separate metallib - check they produce correct results
# ref: https://github.com/ggml-org/llama.cpp/issues/27473
if (GGML_METAL AND NOT GGML_METAL_EMBED_LIBRARY)
llama_test(test-backend-ops NAME test-backend-ops-metallib-tensor
ARGS test -b MTL0 -o MUL_MAT -p type_a=q6_K)
set_tests_properties(test-backend-ops-metallib-tensor PROPERTIES ENVIRONMENT GGML_METAL_TENSOR_ENABLE=1)
endif()
llama_build_and_test(test-model-load-cancel.cpp LABEL "model")
llama_build_and_test(test-autorelease.cpp LABEL "model")
llama_build_and_test(test-backend-sampler.cpp LABEL "model")