Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
403bdc9
MLX delegate
metascroy Jan 20, 2026
1602189
backends/apple/mlx/patches/mlx_json.patch
metascroy Jan 27, 2026
6372e7f
Exclude auto-generated files from git
metascroy Jan 27, 2026
54981f7
up
metascroy Jan 27, 2026
f832757
more testing
metascroy Jan 28, 2026
d158e52
up
metascroy Jan 28, 2026
913f129
up
metascroy Jan 29, 2026
8de6b93
up
metascroy Jan 29, 2026
137892c
parakeet
metascroy Jan 30, 2026
bb3dd35
up
metascroy Jan 30, 2026
365158d
up
metascroy Jan 30, 2026
6328a18
up
metascroy Jan 31, 2026
43a12d0
up
metascroy Jan 31, 2026
c05e817
up
metascroy Feb 2, 2026
9c2d69d
up
metascroy Feb 2, 2026
af77271
up
metascroy Feb 3, 2026
f38da64
up
metascroy Feb 4, 2026
b3b19f8
up
metascroy Feb 4, 2026
1aba148
up
metascroy Feb 9, 2026
4b00f09
up
metascroy Feb 9, 2026
91fe916
up
metascroy Feb 9, 2026
875f2b8
up
metascroy Feb 9, 2026
c6434ba
up
metascroy Feb 10, 2026
3275210
up
metascroy Feb 10, 2026
3dafa30
up
metascroy Feb 10, 2026
452057b
up
metascroy Feb 11, 2026
139368e
up
metascroy Feb 11, 2026
31cc2cc
up
metascroy Feb 17, 2026
0600fd1
up
metascroy Feb 18, 2026
bc629dc
up
metascroy Feb 18, 2026
87cbc91
up
metascroy Feb 19, 2026
f170071
up
metascroy Feb 19, 2026
c2dbc23
up
metascroy Feb 19, 2026
28c7ff1
up
metascroy Feb 19, 2026
5a82acf
up
metascroy Feb 19, 2026
ee913ee
up
metascroy Feb 19, 2026
f0df178
up
metascroy Feb 19, 2026
1d865d4
up
metascroy Feb 19, 2026
9e00f94
up
metascroy Feb 19, 2026
86726d0
up
metascroy Feb 19, 2026
5327424
up
metascroy Feb 19, 2026
a8db934
up
metascroy Feb 19, 2026
0720468
up
metascroy Feb 19, 2026
4c2448f
up
metascroy Feb 19, 2026
e1c0f6d
up
metascroy Feb 19, 2026
37a674f
up
metascroy Feb 20, 2026
0b9a664
up
metascroy Feb 20, 2026
f0c02a9
up
metascroy Feb 20, 2026
709bf9f
up
metascroy Feb 20, 2026
8e2f9c8
up
metascroy Feb 20, 2026
a3ceab3
up
metascroy Feb 20, 2026
56c3196
up
metascroy Feb 20, 2026
f17a4a7
up
metascroy Feb 21, 2026
ed4d45c
up
metascroy Feb 21, 2026
76adc1d
up
metascroy Feb 21, 2026
c7c22c9
up
metascroy Feb 24, 2026
da81245
up
metascroy Feb 24, 2026
72560af
up
metascroy Feb 24, 2026
7591f32
up
metascroy Feb 24, 2026
3b0473e
up
metascroy Feb 24, 2026
2541ca5
up
metascroy Feb 24, 2026
8609f0e
up
metascroy Feb 24, 2026
3ed8760
up
metascroy Feb 24, 2026
303a1ce
up
metascroy Feb 24, 2026
feab5bb
up
metascroy Feb 24, 2026
fb43eb4
Fix intermittent bus errors in portable pocketfft op
metascroy Feb 11, 2026
ab15e4f
Create pocketfft_aligned_alloc.patch
metascroy Feb 11, 2026
ffeeafc
up
metascroy Feb 25, 2026
240b241
up
metascroy Feb 25, 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
402 changes: 402 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 @@ -652,6 +652,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 @@ -949,6 +954,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 @@ -1033,6 +1042,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"
},
"condition": {
"type": "inList",
Expand Down Expand Up @@ -285,6 +285,43 @@
"EXECUTORCH_BUILD_PRESET_FILE": "${sourceDir}/tools/cmake/preset/arm_baremetal.cmake",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/examples/arm/ethos-u-setup/arm-none-eabi-gcc.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 @@ -353,6 +390,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 @@ -453,6 +508,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"
}
]
}
]
}
26 changes: 23 additions & 3 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: Multimodal voice + text model (CPU, CUDA, Metal, MLX)
# - voxtral_realtime: Realtime speech-to-text model (CPU)
# - 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,13 +91,14 @@
#
# ==============================================================================

.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-cpu llava-cpu gemma3-cuda gemma3-cpu clean help
.PHONY: voxtral-cuda voxtral-cpu voxtral-metal voxtral-mlx voxtral_realtime-cpu voxtral_realtime-metal 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-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 (macOS only)"
@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 " whisper-cuda - Build Whisper runner with CUDA backend"
Expand All @@ -108,6 +109,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 (macOS only)"
@echo " sortformer-cpu - Build Sortformer runner with CPU backend"
@echo " silero-vad-cpu - Build Silero VAD runner with CPU backend"
@echo " llama-cpu - Build Llama runner with CPU backend"
Expand Down Expand Up @@ -143,6 +145,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 @@ -215,6 +226,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
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