| # ============================================================================== |
| # ExecuTorch Targets Makefile |
| # ============================================================================== |
| # |
| # This Makefile provides convenient targets for building ExecuTorch model runners |
| # with different backend configurations (CPU, CUDA, Metal), as well as other |
| # binary targets. |
| # |
| # WHAT THIS BUILDS: |
| # ----------------- |
| # Each target builds: |
| # 1. ExecuTorch core libraries with the specified backend (CPU, CUDA, or Metal) |
| # 2. The model-specific runner executable in cmake-out/examples/models/<model>/ |
| # |
| # SUPPORTED MODELS: |
| # ----------------- |
| # - voxtral: Multimodal voice + text model (CPU, CUDA, Metal) |
| # - voxtral_realtime: Realtime speech-to-text model (CPU, CUDA, Metal) |
| # - whisper: Speech recognition model (CPU, CUDA, Metal) |
| # - parakeet: Speech recognition model (CPU, CUDA, Metal) |
| # - sortformer: Speaker diarization model (CPU, CUDA) |
| # - silero_vad: Voice activity detection model (CPU) |
| # - llama: Text generation model (CPU) |
| # - llava: Vision + language model (CPU) |
| # - gemma3: Text generation model (CPU, CUDA) |
| # |
| # USAGE: |
| # ------ |
| # make <model>-<backend> # Build a specific model with a backend |
| # make help # Show all available targets |
| # make clean # Remove all build artifacts |
| # |
| # Examples: |
| # make voxtral-cuda # Build Voxtral with CUDA backend |
| # make llama-cpu # Build Llama with CPU backend |
| # make whisper-metal # Build Whisper with Metal backend (macOS) |
| # |
| # HOW TO ADD A NEW MODEL: |
| # ----------------------- |
| # To add a new model (e.g., "mymodel"), follow these steps: |
| # |
| # 1. Create a CMakePresets.json in examples/models/mymodel/: |
| # - Define configurePresets for each backend (base, cpu, cuda, metal) |
| # - Define buildPresets with the target name from CMakeLists.txt |
| # - Define workflowPresets that combine configure + build steps |
| # - See examples/models/voxtral/CMakePresets.json for multi-backend reference |
| # - Or see examples/models/llama/CMakePresets.json for simple single-preset reference |
| # |
| # 2. Add targets to this Makefile: |
| # a) Add to .PHONY declaration: mymodel-cuda mymodel-cpu mymodel-metal |
| # b) Add help text in the help target |
| # c) Add target implementations following this pattern: |
| # |
| # mymodel-cuda: |
| # @echo "==> Building and installing ExecuTorch with CUDA..." |
| # cmake --workflow --preset llm-release-cuda |
| # @echo "==> Building MyModel runner with CUDA..." |
| # cd examples/models/mymodel && cmake --workflow --preset mymodel-cuda |
| # @echo "" |
| # @echo "✓ Build complete!" |
| # @echo " Binary: cmake-out/examples/models/mymodel/mymodel_runner" |
| # |
| # mymodel-cpu: |
| # @echo "==> Building and installing ExecuTorch..." |
| # cmake --workflow --preset llm-release |
| # @echo "==> Building MyModel runner (CPU)..." |
| # cd examples/models/mymodel && cmake --workflow --preset mymodel-cpu |
| # @echo "" |
| # @echo "✓ Build complete!" |
| # @echo " Binary: cmake-out/examples/models/mymodel/mymodel_runner" |
| # |
| # mymodel-metal: |
| # @echo "==> Building and installing ExecuTorch with Metal..." |
| # cmake --workflow --preset llm-release-metal |
| # @echo "==> Building MyModel runner with Metal..." |
| # cd examples/models/mymodel && cmake --workflow --preset mymodel-metal |
| # @echo "" |
| # @echo "✓ Build complete!" |
| # @echo " Binary: cmake-out/examples/models/mymodel/mymodel_runner" |
| # |
| # 3. Test your new targets: |
| # make mymodel-cpu # or mymodel-cuda, mymodel-metal |
| # |
| # NOTES: |
| # ------ |
| # - CUDA backend is only available on Linux systems |
| # - Metal backend is only available on macOS (Darwin) systems |
| # - Some models may not support all backends (check model documentation) |
| # - Binary outputs are located in cmake-out/examples/models/<model>/ |
| # - The preset names in CMakePresets.json must match the names used in Makefile |
| # |
| # ============================================================================== |
| |
| .PHONY: voxtral-cuda voxtral-cpu voxtral-metal voxtral_realtime-cuda 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-vulkan dinov2-cuda dinov2-cuda-debug sortformer-cuda 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_realtime-cuda - Build Voxtral Realtime runner with CUDA 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 " 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" |
| @echo " whisper-metal - Build Whisper runner with Metal backend (macOS only)" |
| @echo " parakeet-cuda - Build Parakeet runner with CUDA backend" |
| @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-vulkan - Build Parakeet runner with Vulkan backend" |
| @echo " dinov2-cuda - Build DINOv2 runner with CUDA backend" |
| @echo " dinov2-cuda-debug - Build DINOv2 runner with CUDA backend (debug mode)" |
| @echo " sortformer-cuda - Build Sortformer runner with CUDA 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" |
| @echo " llama-cuda-debug - Build Llama runner with CUDA backend (debug mode)" |
| @echo " llama-cpu - Build Llama runner with CPU backend" |
| @echo " llava-cpu - Build Llava runner with CPU backend" |
| @echo " gemma3-cuda - Build Gemma3 runner with CUDA backend" |
| @echo " gemma3-cpu - Build Gemma3 runner with CPU backend" |
| @echo " clean - Clean build artifacts" |
| |
| voxtral-cuda: |
| @echo "==> Building and installing ExecuTorch with CUDA..." |
| cmake --workflow --preset llm-release-cuda |
| @echo "==> Building Voxtral runner with CUDA..." |
| cd examples/models/voxtral && cmake --workflow --preset voxtral-cuda |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/voxtral/voxtral_runner" |
| |
| voxtral-cpu: |
| @echo "==> Building and installing ExecuTorch..." |
| cmake --workflow --preset llm-release |
| @echo "==> Building Voxtral runner (CPU)..." |
| cd examples/models/voxtral && cmake --workflow --preset voxtral-cpu |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/voxtral/voxtral_runner" |
| |
| voxtral-metal: |
| @echo "==> Building and installing ExecuTorch with Metal..." |
| cmake --workflow --preset llm-release-metal |
| @echo "==> Building Voxtral runner with Metal..." |
| cd examples/models/voxtral && cmake --workflow --preset voxtral-metal |
| @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 |
| @echo "==> Building Whisper runner with CUDA..." |
| cd examples/models/whisper && cmake --workflow --preset whisper-cuda |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/whisper/whisper_runner" |
| |
| whisper-cuda-debug: |
| @echo "==> Building and installing ExecuTorch with CUDA (debug mode)..." |
| cmake --workflow --preset llm-debug-cuda |
| @echo "==> Building Whisper runner with CUDA (debug mode)..." |
| cd examples/models/whisper && cmake --workflow --preset whisper-cuda-debug |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/whisper/whisper_runner" |
| |
| whisper-cpu: |
| @echo "==> Building and installing ExecuTorch..." |
| cmake --workflow --preset llm-release |
| @echo "==> Building Whisper runner (CPU)..." |
| cd examples/models/whisper && cmake --workflow --preset whisper-cpu |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/whisper/whisper_runner" |
| |
| whisper-metal: |
| @echo "==> Building and installing ExecuTorch with Metal..." |
| cmake --workflow --preset llm-release-metal |
| @echo "==> Building Whisper runner with Metal..." |
| cd examples/models/whisper && cmake --workflow --preset whisper-metal |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/whisper/whisper_runner" |
| |
| parakeet-cuda: |
| @echo "==> Building and installing ExecuTorch with CUDA..." |
| cmake --workflow --preset llm-release-cuda |
| @echo "==> Building Parakeet runner with CUDA..." |
| cd examples/models/parakeet && cmake --workflow --preset parakeet-cuda |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/parakeet/parakeet_runner" |
| |
| parakeet-cuda-debug: |
| @echo "==> Building and installing ExecuTorch with CUDA (debug mode)..." |
| cmake --workflow --preset llm-debug-cuda |
| @echo "==> Building Parakeet runner with CUDA (debug mode)..." |
| cd examples/models/parakeet && cmake --workflow --preset parakeet-cuda-debug |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/parakeet/parakeet_runner" |
| |
| parakeet-cpu: |
| @echo "==> Building and installing ExecuTorch..." |
| cmake --workflow --preset llm-release |
| @echo "==> Building Parakeet runner (CPU)..." |
| cd examples/models/parakeet && cmake --workflow --preset parakeet-cpu |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/parakeet/parakeet_runner" |
| |
| parakeet-metal: |
| @echo "==> Building and installing ExecuTorch with Metal (stats enabled)..." |
| cmake --workflow --preset llm-metal-stats |
| @echo "==> Building Parakeet runner with Metal..." |
| cd examples/models/parakeet && cmake --workflow --preset parakeet-metal |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/parakeet/parakeet_runner" |
| |
| parakeet-vulkan: |
| @echo "==> Building and installing ExecuTorch with Vulkan..." |
| cmake --workflow --preset llm-debug-vulkan |
| @echo "==> Building Parakeet runner with Vulkan..." |
| cd examples/models/parakeet && cmake --workflow --preset parakeet-vulkan |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/parakeet/parakeet_runner" |
| |
| dinov2-cuda: |
| @echo "==> Building and installing ExecuTorch with CUDA..." |
| cmake --workflow --preset llm-release-cuda |
| @echo "==> Building DINOv2 runner with CUDA..." |
| cd examples/models/dinov2 && cmake --workflow --preset dinov2-cuda |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/dinov2/dinov2_runner" |
| |
| dinov2-cuda-debug: |
| @echo "==> Building and installing ExecuTorch with CUDA (debug mode)..." |
| cmake --workflow --preset llm-debug-cuda |
| @echo "==> Building DINOv2 runner with CUDA (debug mode)..." |
| cd examples/models/dinov2 && cmake --workflow --preset dinov2-cuda-debug |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/dinov2/dinov2_runner" |
| |
| sortformer-cuda: |
| @echo "==> Building and installing ExecuTorch with CUDA..." |
| cmake --workflow --preset llm-release-cuda |
| @echo "==> Building Sortformer runner with CUDA..." |
| cd examples/models/sortformer && cmake --workflow --preset sortformer-cuda |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/sortformer/sortformer_runner" |
| |
| sortformer-cpu: |
| @echo "==> Building and installing ExecuTorch..." |
| cmake --workflow --preset llm-release |
| @echo "==> Building Sortformer runner (CPU)..." |
| cd examples/models/sortformer && cmake --workflow --preset sortformer-cpu |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/sortformer/sortformer_runner" |
| |
| voxtral_realtime-cpu: |
| @echo "==> Building and installing ExecuTorch..." |
| cmake --workflow --preset llm-release |
| @echo "==> Building Voxtral Realtime runner (CPU)..." |
| cd examples/models/voxtral_realtime && cmake --workflow --preset voxtral-realtime-cpu |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/voxtral_realtime/voxtral_realtime_runner" |
| |
| voxtral_realtime-metal: |
| @echo "==> Building and installing ExecuTorch with Metal (stats enabled)..." |
| cmake --workflow --preset llm-metal-stats |
| @echo "==> Building Voxtral Realtime runner with Metal..." |
| cd examples/models/voxtral_realtime && cmake --workflow --preset voxtral-realtime-metal |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/voxtral_realtime/voxtral_realtime_runner" |
| |
| voxtral_realtime-cuda: |
| @echo "==> Building and installing ExecuTorch with CUDA..." |
| cmake --workflow --preset llm-release-cuda |
| @echo "==> Building Voxtral Realtime runner with CUDA..." |
| cd examples/models/voxtral_realtime && cmake --workflow --preset voxtral-realtime-cuda |
| @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 |
| @echo "==> Building Silero VAD runner (CPU)..." |
| cmake -DCMAKE_BUILD_TYPE=Release \ |
| -DCMAKE_FIND_ROOT_PATH=$(CURDIR)/cmake-out \ |
| -DCMAKE_PREFIX_PATH=$(CURDIR)/cmake-out \ |
| -S examples/models/silero_vad \ |
| -B cmake-out/examples/models/silero_vad |
| cmake --build cmake-out/examples/models/silero_vad --target silero_vad_runner |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/silero_vad/silero_vad_runner" |
| |
| llama-cpu: |
| @echo "==> Building and installing ExecuTorch..." |
| cmake --workflow --preset llm-release |
| @echo "==> Building Llama runner (CPU)..." |
| cd examples/models/llama && cmake --workflow --preset llama-release |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/llama/llama_main" |
| |
| llama-cuda: |
| @echo "==> Building and installing ExecuTorch with CUDA..." |
| cmake --workflow --preset llm-release-cuda |
| @echo "==> Building Llama runner with CUDA..." |
| cd examples/models/llama && cmake --workflow --preset llama-cuda |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/llama/llama_main" |
| |
| llama-cuda-debug: |
| @echo "==> Building and installing ExecuTorch with CUDA (debug mode)..." |
| cmake --workflow --preset llm-debug-cuda |
| @echo "==> Building Llama runner with CUDA (debug mode)..." |
| cd examples/models/llama && cmake --workflow --preset llama-cuda-debug |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/llama/llama_main" |
| |
| llava-cpu: |
| @echo "==> Building and installing ExecuTorch..." |
| cmake --workflow --preset llm-release |
| @echo "==> Building Llava runner (CPU)..." |
| cd examples/models/llava && cmake --workflow --preset llava |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/llava/llava_main" |
| |
| gemma3-cuda: |
| @echo "==> Building and installing ExecuTorch with CUDA..." |
| cmake --workflow --preset llm-release-cuda |
| @echo "==> Building Gemma3 runner with CUDA..." |
| cd examples/models/gemma3 && cmake --workflow --preset gemma3-cuda |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/gemma3/gemma3_e2e_runner" |
| |
| gemma3-cpu: |
| @echo "==> Building and installing ExecuTorch..." |
| cmake --workflow --preset llm-release |
| @echo "==> Building Gemma3 runner (CPU)..." |
| cd examples/models/gemma3 && cmake --workflow --preset gemma3-cpu |
| @echo "" |
| @echo "✓ Build complete!" |
| @echo " Binary: cmake-out/examples/models/gemma3/gemma3_e2e_runner" |
| |
| clean: |
| rm -rf cmake-out \ |
| extension/llm/tokenizers/build \ |
| extension/llm/tokenizers/pytorch_tokenizers.egg-info |