Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
54f1cdc
MLX delegate
metascroy Jan 20, 2026
bff9194
backends/apple/mlx/patches/mlx_json.patch
metascroy Jan 27, 2026
ed278de
Exclude auto-generated files from git
metascroy Jan 27, 2026
585f932
up
metascroy Jan 27, 2026
1930a32
more testing
metascroy Jan 28, 2026
439c1ba
up
metascroy Jan 28, 2026
693b429
up
metascroy Jan 29, 2026
916319b
up
metascroy Jan 29, 2026
d12c425
parakeet
metascroy Jan 30, 2026
edebdd5
up
metascroy Jan 30, 2026
ccc7b4c
up
metascroy Jan 30, 2026
85d3d72
up
metascroy Jan 31, 2026
35004e2
up
metascroy Jan 31, 2026
0d6a942
up
metascroy Feb 2, 2026
48dcc40
up
metascroy Feb 2, 2026
651650a
up
metascroy Feb 3, 2026
e8a7a84
up
metascroy Feb 4, 2026
f3b4222
up
metascroy Feb 4, 2026
dbcd77e
up
metascroy Feb 9, 2026
1fe3de7
up
metascroy Feb 9, 2026
4b61f45
up
metascroy Feb 9, 2026
2a21e63
up
metascroy Feb 9, 2026
c9464af
up
metascroy Feb 10, 2026
dc559b3
up
metascroy Feb 10, 2026
dd41103
up
metascroy Feb 10, 2026
d337869
up
metascroy Feb 11, 2026
e3c1ae1
up
metascroy Feb 11, 2026
3e5c576
up
metascroy Feb 17, 2026
cfdb782
up
metascroy Feb 18, 2026
b146183
up
metascroy Feb 18, 2026
b243d01
up
metascroy Feb 19, 2026
501562c
up
metascroy Feb 19, 2026
051a70d
up
metascroy Feb 19, 2026
31bfcca
up
metascroy Feb 19, 2026
8610c14
up
metascroy Feb 19, 2026
b980b1f
up
metascroy Feb 19, 2026
5a4c6fd
up
metascroy Feb 19, 2026
02026a5
up
metascroy Feb 19, 2026
14ae274
up
metascroy Feb 19, 2026
1959561
up
metascroy Feb 19, 2026
924d3fb
up
metascroy Feb 19, 2026
7aba5ea
up
metascroy Feb 19, 2026
fc100ca
up
metascroy Feb 19, 2026
67943f0
up
metascroy Feb 19, 2026
0449e9f
up
metascroy Feb 19, 2026
c3e027f
up
metascroy Feb 20, 2026
c34fa3e
up
metascroy Feb 20, 2026
6b197de
up
metascroy Feb 20, 2026
dafea34
up
metascroy Feb 20, 2026
c7fe8a2
up
metascroy Feb 20, 2026
d0c549c
up
metascroy Feb 20, 2026
5fa0ac4
up
metascroy Feb 20, 2026
016bd3b
up
metascroy Feb 21, 2026
91de6ce
up
metascroy Feb 21, 2026
363a94d
up
metascroy Feb 21, 2026
3f79756
up
metascroy Feb 24, 2026
56fc84c
up
metascroy Feb 24, 2026
d8a730a
up
metascroy Feb 24, 2026
f1af627
up
metascroy Feb 24, 2026
0a24dc7
up
metascroy Feb 24, 2026
47071d0
up
metascroy Feb 24, 2026
ed26297
up
metascroy Feb 24, 2026
73884c5
up
metascroy Feb 24, 2026
c396c15
up
metascroy Feb 24, 2026
4c4e288
up
metascroy Feb 24, 2026
3794446
Fix intermittent bus errors in portable pocketfft op
metascroy Feb 11, 2026
5838cc7
Create pocketfft_aligned_alloc.patch
metascroy Feb 11, 2026
fe27338
up
metascroy Feb 25, 2026
9d010bb
up
metascroy Feb 25, 2026
60079a2
rebase
metascroy Feb 27, 2026
0874ec7
up
metascroy Feb 27, 2026
f66885d
up
metascroy Feb 27, 2026
f08f1dd
up
metascroy Feb 28, 2026
dc25245
up
metascroy Feb 28, 2026
0c76afa
up
metascroy Feb 28, 2026
f8f571f
up
metascroy Mar 1, 2026
1842ad3
up
metascroy Mar 2, 2026
10ff69f
up
metascroy Mar 2, 2026
339d1f0
up
metascroy Mar 2, 2026
2f45116
up
metascroy Mar 2, 2026
d50e8d6
up
metascroy Mar 2, 2026
2c73c84
Merge branch 'main' into mlx-delegate
metascroy Mar 2, 2026
868d955
up
metascroy Mar 2, 2026
c247996
up
metascroy Mar 2, 2026
89f202d
up
metascroy Mar 2, 2026
cc0a110
up
metascroy Mar 2, 2026
508498a
up
metascroy Mar 2, 2026
ede3a6e
up
metascroy Mar 2, 2026
fab5620
up
metascroy Mar 2, 2026
d181635
up
metascroy Mar 2, 2026
d4ba78f
up
metascroy Mar 3, 2026
d8ee9d2
up
metascroy Mar 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
471 changes: 471 additions & 0 deletions .github/workflows/mlx.yml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,7 @@ xcuserdata/
*.dll
*.pyd


# Agents
.claude/*.local.*
extension/pybindings/mlx.metallib
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,7 @@
[submodule "third-party/json"]
path = third-party/json
url = https://github.com/nlohmann/json.git
[submodule "backends/mlx/third-party/mlx"]
path = backends/mlx/third-party/mlx
url = https://github.com/ml-explore/mlx.git
shallow = true
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,11 @@ if(EXECUTORCH_BUILD_MPS)
list(APPEND _executorch_backends mpsdelegate)
endif()

if(EXECUTORCH_BUILD_MLX)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/mlx)
list(APPEND _executorch_backends mlxdelegate)
endif()

if(EXECUTORCH_BUILD_NEURON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/backends/mediatek)
list(APPEND _executorch_backends neuron_backend)
Expand Down Expand Up @@ -956,6 +961,10 @@ if(EXECUTORCH_BUILD_PYBIND)
list(APPEND _dep_libs mpsdelegate)
endif()

if(EXECUTORCH_BUILD_MLX)
list(APPEND _dep_libs mlxdelegate)
endif()

if(EXECUTORCH_BUILD_OPENVINO)
list(APPEND _dep_libs openvino_backend)
endif()
Expand Down Expand Up @@ -1044,6 +1053,12 @@ if(EXECUTORCH_BUILD_PYBIND)
EXPORT ExecuTorchTargets
LIBRARY DESTINATION executorch/extension/pybindings
)

# Copy MLX metallib next to _portable_lib.so for editable installs. MLX uses
# dladdr() to find the directory containing the library with MLX code, then
# looks for mlx.metallib in that directory. When MLX is statically linked into
# _portable_lib.so, we need the metallib colocated with it.
executorch_target_copy_mlx_metallib(portable_lib)
endif()

if(EXECUTORCH_BUILD_WASM)
Expand Down
85 changes: 84 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"inherits": ["common"],
"cacheVariables": {
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/pybind.cmake",
"CMAKE_OSX_DEPLOYMENT_TARGET": "12.0"
"CMAKE_OSX_DEPLOYMENT_TARGET": "14.0"
Comment thread
metascroy marked this conversation as resolved.
},
"condition": {
"type": "inList",
Expand Down Expand Up @@ -294,6 +294,43 @@
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/arm_ethosu_linux.cmake",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/examples/arm/ethos-u-setup/aarch64-linux-musl-toolchain.cmake"
}
},
{
"name": "mlx",
"displayName": "Build MLX delegate",
"inherits": ["common"],
"cacheVariables": {
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/mlx.cmake",
"EXECUTORCH_ENABLE_LOGGING": "ON",
"CMAKE_OSX_DEPLOYMENT_TARGET": "14.0"
},
"condition": {
"lhs": "${hostSystemName}",
"type": "equals",
"rhs": "Darwin"
}
},
{
"name": "mlx-release",
"displayName": "MLX delegate release build",
"inherits": ["mlx"],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/cmake-out",
"ET_MLX_ENABLE_OP_LOGGING": "OFF",
"ET_MIN_LOG_LEVEL": "Error"
}
},
{
"name": "mlx-debug",
"displayName": "MLX delegate debug build with op logging",
"inherits": ["mlx"],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_INSTALL_PREFIX": "${sourceDir}/cmake-out",
"ET_MLX_ENABLE_OP_LOGGING": "ON",
"ET_MIN_LOG_LEVEL": "Debug"
}
}
],
"buildPresets": [
Expand Down Expand Up @@ -362,6 +399,24 @@
"install"
],
"jobs": 0
},
{
"name": "mlx-release-install",
"displayName": "Build and install MLX delegate release artifacts",
"configurePreset": "mlx-release",
"targets": [
"install"
],
"jobs": 0
},
{
"name": "mlx-debug-install",
"displayName": "Build and install MLX delegate debug artifacts",
"configurePreset": "mlx-debug",
"targets": [
"install"
],
"jobs": 0
}
],
"workflowPresets": [
Expand Down Expand Up @@ -462,6 +517,34 @@
"name": "llm-metal-stats-install"
}
]
},
{
"name": "mlx-release",
"displayName": "Configure, build and install ExecuTorch MLX delegate",
"steps": [
{
"type": "configure",
"name": "mlx-release"
},
{
"type": "build",
"name": "mlx-release-install"
}
]
},
{
"name": "mlx-debug",
"displayName": "Configure, build and install ExecuTorch MLX delegate with op logging (Debug)",
"steps": [
{
"type": "configure",
"name": "mlx-debug"
},
{
"type": "build",
"name": "mlx-debug-install"
}
]
}
]
}
38 changes: 34 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
#
# SUPPORTED MODELS:
# -----------------
# - voxtral: Multimodal voice + text model (CPU, CUDA, Metal)
# - voxtral_realtime: Realtime speech-to-text model (CPU)
# - voxtral: Multimodal voice + text model (CPU, CUDA, Metal, MLX)
# - voxtral_realtime: Realtime speech-to-text model (CPU, Metal, MLX)
# - whisper: Speech recognition model (CPU, CUDA, Metal)
# - parakeet: Speech recognition model (CPU, CUDA, Metal)
# - parakeet: Speech recognition model (CPU, CUDA, Metal, MLX)
# - sortformer: Speaker diarization model (CPU)
# - silero_vad: Voice activity detection model (CPU)
# - llama: Text generation model (CPU)
Expand Down Expand Up @@ -91,15 +91,17 @@
#
# ==============================================================================

.PHONY: voxtral-cuda voxtral-cpu voxtral-metal voxtral_realtime-cpu voxtral_realtime-metal whisper-cuda whisper-cuda-debug whisper-cpu whisper-metal parakeet-cuda parakeet-cuda-debug parakeet-cpu parakeet-metal sortformer-cpu silero-vad-cpu llama-cuda llama-cuda-debug llama-cpu llava-cpu gemma3-cuda gemma3-cpu clean help
.PHONY: voxtral-cuda voxtral-cpu voxtral-metal voxtral-mlx voxtral_realtime-cpu voxtral_realtime-metal voxtral_realtime-mlx whisper-cuda whisper-cuda-debug whisper-cpu whisper-metal parakeet-cuda parakeet-cuda-debug parakeet-cpu parakeet-metal parakeet-mlx sortformer-cpu silero-vad-cpu llama-cuda llama-cuda-debug llama-cpu llava-cpu gemma3-cuda gemma3-cpu clean help

help:
@echo "This Makefile adds targets to build runners for various models on various backends. Run using \`make <target>\`. Available targets:"
@echo " voxtral-cuda - Build Voxtral runner with CUDA backend"
@echo " voxtral-cpu - Build Voxtral runner with CPU backend"
@echo " voxtral-metal - Build Voxtral runner with Metal backend (macOS only)"
@echo " voxtral-mlx - Build Voxtral runner with MLX backend"
@echo " voxtral_realtime-cpu - Build Voxtral Realtime runner with CPU backend"
@echo " voxtral_realtime-metal - Build Voxtral Realtime runner with Metal backend (macOS only)"
@echo " voxtral_realtime-mlx - Build Voxtral Realtime runner with MLX backend"
@echo " whisper-cuda - Build Whisper runner with CUDA backend"
@echo " whisper-cuda-debug - Build Whisper runner with CUDA backend (debug mode)"
@echo " whisper-cpu - Build Whisper runner with CPU backend"
Expand All @@ -108,6 +110,7 @@ help:
@echo " parakeet-cuda-debug - Build Parakeet runner with CUDA backend (debug mode)"
@echo " parakeet-cpu - Build Parakeet runner with CPU backend"
@echo " parakeet-metal - Build Parakeet runner with Metal backend (macOS only)"
@echo " parakeet-mlx - Build Parakeet runner with MLX backend"
@echo " sortformer-cpu - Build Sortformer runner with CPU backend"
@echo " silero-vad-cpu - Build Silero VAD runner with CPU backend"
@echo " llama-cuda - Build Llama runner with CUDA backend"
Expand Down Expand Up @@ -145,6 +148,15 @@ voxtral-metal:
@echo "✓ Build complete!"
@echo " Binary: cmake-out/examples/models/voxtral/voxtral_runner"

voxtral-mlx:
@echo "==> Building and installing ExecuTorch with MLX..."
cmake --workflow --preset mlx-release
@echo "==> Building Voxtral runner with MLX..."
cd examples/models/voxtral && cmake --workflow --preset voxtral-mlx
@echo ""
@echo "✓ Build complete!"
@echo " Binary: cmake-out/examples/models/voxtral/voxtral_runner"

whisper-cuda:
@echo "==> Building and installing ExecuTorch with CUDA..."
cmake --workflow --preset llm-release-cuda
Expand Down Expand Up @@ -217,6 +229,15 @@ parakeet-metal:
@echo "✓ Build complete!"
@echo " Binary: cmake-out/examples/models/parakeet/parakeet_runner"

parakeet-mlx:
@echo "==> Building and installing ExecuTorch with MLX..."
cmake --workflow --preset mlx-release
@echo "==> Building Parakeet runner with MLX..."
cd examples/models/parakeet && cmake --workflow --preset parakeet-mlx
@echo ""
@echo "✓ Build complete!"
@echo " Binary: cmake-out/examples/models/parakeet/parakeet_runner"

sortformer-cpu:
@echo "==> Building and installing ExecuTorch..."
cmake --workflow --preset llm-release
Expand Down Expand Up @@ -244,6 +265,15 @@ voxtral_realtime-metal:
@echo "✓ Build complete!"
@echo " Binary: cmake-out/examples/models/voxtral_realtime/voxtral_realtime_runner"

voxtral_realtime-mlx:
@echo "==> Building and installing ExecuTorch with MLX..."
cmake --workflow --preset mlx-release
@echo "==> Building Voxtral Realtime runner with MLX..."
cd examples/models/voxtral_realtime && cmake --workflow --preset voxtral-realtime-mlx
@echo ""
@echo "✓ Build complete!"
@echo " Binary: cmake-out/examples/models/voxtral_realtime/voxtral_realtime_runner"

silero-vad-cpu:
@echo "==> Building and installing ExecuTorch..."
cmake --workflow --preset llm-release
Expand Down
19 changes: 19 additions & 0 deletions backends/mlx/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Auto-generated files from generate.py
# These are regenerated at build time from schema.fbs
# Do not edit manually - edit schema.fbs and run generate.py

# Python generated files
serialization/_generated/
serialization/mlx_graph_schema.py
serialization/_generated_serializers.py
serialization/_generated_parsers.py
_generated_inspector.py

# C++ generated files
runtime/schema_generated.h
runtime/MLXLoader.h
runtime/MLXLoader.cpp

# Python cache
__pycache__/
*.pyc
Loading
Loading