mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-11 23:14:50 +08:00
10
.github/actions/build-macos-release/action.yml
vendored
10
.github/actions/build-macos-release/action.yml
vendored
@@ -16,21 +16,15 @@ runs:
|
|||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Build Python package
|
- name: Build Python package
|
||||||
shell: bash
|
shell: bash -l {0}
|
||||||
env:
|
|
||||||
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
|
||||||
run: |
|
run: |
|
||||||
conda activate env
|
|
||||||
pip install build
|
pip install build
|
||||||
python setup.py clean --all
|
python setup.py clean --all
|
||||||
MLX_BUILD_STAGE=1 python -m build -w
|
MLX_BUILD_STAGE=1 python -m build -w
|
||||||
|
|
||||||
- name: Build backend package
|
- name: Build backend package
|
||||||
if: ${{ inputs.build-backend }}
|
if: ${{ inputs.build-backend }}
|
||||||
shell: bash
|
shell: bash -l {0}
|
||||||
env:
|
|
||||||
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
|
||||||
run: |
|
run: |
|
||||||
conda activate env
|
|
||||||
python setup.py clean --all
|
python setup.py clean --all
|
||||||
MLX_BUILD_STAGE=2 python -m build -w
|
MLX_BUILD_STAGE=2 python -m build -w
|
||||||
|
|||||||
69
.github/actions/build-macos/action.yml
vendored
69
.github/actions/build-macos/action.yml
vendored
@@ -1,73 +1,51 @@
|
|||||||
name: 'Build and Test on macOS'
|
name: 'Build and Test on macOS'
|
||||||
description: 'Build and test MLX on macOS'
|
description: 'Build and test MLX on macOS'
|
||||||
|
|
||||||
inputs:
|
|
||||||
python-version:
|
|
||||||
description: 'Python version to use'
|
|
||||||
required: false
|
|
||||||
default: '3.10'
|
|
||||||
macos-target:
|
|
||||||
description: 'macOS target to build and test for'
|
|
||||||
required: false
|
|
||||||
default: '14.0'
|
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: Setup uv
|
|
||||||
uses: astral-sh/setup-uv@v6
|
|
||||||
with:
|
|
||||||
python-version: ${{ inputs.python-version }}
|
|
||||||
activate-environment: true
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: sh
|
|
||||||
env:
|
env:
|
||||||
DEBUG: 1
|
DEBUG: 1
|
||||||
CMAKE_ARGS: "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON"
|
CMAKE_ARGS: "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON"
|
||||||
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
shell: bash -l {0}
|
||||||
run: |
|
run: |
|
||||||
uv pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
uv pip install cmake setuptools nanobind==2.4.0
|
pip install cmake setuptools nanobind==2.4.0
|
||||||
uv pip install -e . -v
|
pip install -e . -v
|
||||||
|
|
||||||
- name: Generate package stubs
|
- name: Generate package stubs
|
||||||
shell: bash
|
shell: bash -l {0}
|
||||||
run: |
|
run: |
|
||||||
uv pip install typing_extensions
|
pip install typing_extensions
|
||||||
uv run --no-project setup.py generate_stubs
|
python setup.py generate_stubs
|
||||||
|
|
||||||
- name: Install tests dependencies
|
- name: Install tests dependencies
|
||||||
shell: sh
|
shell: bash -l {0}
|
||||||
run: |
|
run: |
|
||||||
uv pip install numpy torch tensorflow unittest-xml-reporting
|
pip install numpy torch tensorflow unittest-xml-reporting
|
||||||
|
|
||||||
- name: Run Python tests
|
- name: Run Python tests
|
||||||
shell: bash
|
shell: bash -l {0}
|
||||||
env:
|
env:
|
||||||
LOW_MEMORY: 1
|
LOW_MEMORY: 1
|
||||||
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
|
||||||
run: |
|
run: |
|
||||||
DEVICE=cpu uv run -m xmlrunner discover -v python/tests -o test-results/cpu
|
DEVICE=cpu python -m xmlrunner discover -v python/tests -o test-results/cpu
|
||||||
DEVICE=gpu METAL_DEVICE_WRAPPER_TYPE=1 METAL_DEBUG_ERROR_MODE=0 uv run -m xmlrunner discover -v python/tests -o test-results/gpu
|
DEVICE=gpu METAL_DEVICE_WRAPPER_TYPE=1 METAL_DEBUG_ERROR_MODE=0 python -m xmlrunner discover -v python/tests -o test-results/gpu
|
||||||
mpirun --bind-to none -host localhost:8 -np 8 -x DYLD_LIBRARY_PATH=/opt/homebrew/lib/ python python/tests/mpi_test_distributed.py
|
mpirun --bind-to none -host localhost:8 -np 8 -x DYLD_LIBRARY_PATH=/opt/homebrew/lib/ python python/tests/mpi_test_distributed.py
|
||||||
mlx.launch --verbose -n 8 python/tests/ring_test_distributed.py -v 2> >(tee -a stderr.log >&2)
|
mlx.launch --verbose -n 8 python/tests/ring_test_distributed.py -v 2> >(tee -a stderr.log >&2)
|
||||||
if $(grep "\[WARN\]" stderr.log); then echo "Distributed ring test failed"; exit 1; fi
|
if $(grep "\[WARN\]" stderr.log); then echo "Distributed ring test failed"; exit 1; fi
|
||||||
|
|
||||||
- name: Build example extension
|
- name: Build example extension
|
||||||
shell: bash
|
shell: bash -l {0}
|
||||||
env:
|
|
||||||
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
|
||||||
run: |
|
run: |
|
||||||
cd examples/extensions
|
cd examples/extensions
|
||||||
uv pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
uv run --no-project setup.py build_ext --inplace
|
python setup.py build_ext --inplace
|
||||||
uv run --no-project test.py
|
python test.py
|
||||||
|
|
||||||
- name: Build CPP only
|
- name: Build CPP only
|
||||||
shell: bash
|
shell: bash -l {0}
|
||||||
env:
|
|
||||||
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
|
||||||
run: |
|
run: |
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
@@ -75,7 +53,7 @@ runs:
|
|||||||
make -j $(sysctl -n hw.ncpu)
|
make -j $(sysctl -n hw.ncpu)
|
||||||
|
|
||||||
- name: Run CPP tests
|
- name: Run CPP tests
|
||||||
shell: bash
|
shell: bash -l {0}
|
||||||
env:
|
env:
|
||||||
DEVICE: gpu
|
DEVICE: gpu
|
||||||
METAL_DEVICE_WRAPPER_TYPE: 1
|
METAL_DEVICE_WRAPPER_TYPE: 1
|
||||||
@@ -83,9 +61,7 @@ runs:
|
|||||||
run: ./build/tests/tests
|
run: ./build/tests/tests
|
||||||
|
|
||||||
- name: Build small binary with JIT
|
- name: Build small binary with JIT
|
||||||
shell: bash
|
shell: bash -l {0}
|
||||||
env:
|
|
||||||
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
|
||||||
run: |
|
run: |
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
@@ -98,16 +74,15 @@ runs:
|
|||||||
make -j $(sysctl -n hw.ncpu)
|
make -j $(sysctl -n hw.ncpu)
|
||||||
|
|
||||||
- name: Run Python tests with JIT
|
- name: Run Python tests with JIT
|
||||||
shell: bash
|
shell: bash -l {0}
|
||||||
env:
|
env:
|
||||||
LOW_MEMORY: 1
|
LOW_MEMORY: 1
|
||||||
DEVICE: gpu
|
DEVICE: gpu
|
||||||
METAL_DEVICE_WRAPPER_TYPE: 1
|
METAL_DEVICE_WRAPPER_TYPE: 1
|
||||||
METAL_DEBUG_ERROR_MODE: 0
|
METAL_DEBUG_ERROR_MODE: 0
|
||||||
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
|
|
||||||
run: |
|
run: |
|
||||||
CMAKE_ARGS="-DMLX_METAL_JIT=ON" \
|
CMAKE_ARGS="-DMLX_METAL_JIT=ON" \
|
||||||
uv pip install -e . -v
|
pip install -e . -v
|
||||||
uv run -m xmlrunner discover \
|
python -m xmlrunner discover \
|
||||||
-v python/tests \
|
-v python/tests \
|
||||||
-o test-results/gpu_jit
|
-o test-results/gpu_jit
|
||||||
|
|||||||
11
.github/actions/setup-macos/action.yml
vendored
11
.github/actions/setup-macos/action.yml
vendored
@@ -1,6 +1,12 @@
|
|||||||
name: 'Setup macOS Environment'
|
name: 'Setup macOS Environment'
|
||||||
description: 'Install dependencies for macOS builds'
|
description: 'Install dependencies for macOS builds'
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
python-version:
|
||||||
|
description: 'Python version to use'
|
||||||
|
required: false
|
||||||
|
default: '3.10'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
@@ -11,3 +17,8 @@ runs:
|
|||||||
- name: Verify MetalToolchain installed
|
- name: Verify MetalToolchain installed
|
||||||
shell: bash
|
shell: bash
|
||||||
run: xcodebuild -showComponent MetalToolchain
|
run: xcodebuild -showComponent MetalToolchain
|
||||||
|
|
||||||
|
- uses: conda-incubator/setup-miniconda@v3
|
||||||
|
with:
|
||||||
|
miniconda-version: "latest"
|
||||||
|
python-version: ${{ inputs.python-version }}
|
||||||
|
|||||||
1
.github/workflows/nightly.yml
vendored
1
.github/workflows/nightly.yml
vendored
@@ -67,7 +67,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- uses: ./.github/actions/build-macos
|
- uses: ./.github/actions/build-macos
|
||||||
|
|
||||||
- name: Build macOS 15 package
|
- name: Build macOS 15 package
|
||||||
uses: ./.github/actions/build-macos-release
|
uses: ./.github/actions/build-macos-release
|
||||||
with:
|
with:
|
||||||
|
|||||||
8
.github/workflows/pull_request.yml
vendored
8
.github/workflows/pull_request.yml
vendored
@@ -5,6 +5,10 @@ on: pull_request
|
|||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check_lint:
|
check_lint:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
@@ -35,13 +39,13 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
macos-target: ["14.0", "15.0"]
|
macos-target: ["14.0", "15.0"]
|
||||||
runs-on: [self-hosted, macos]
|
runs-on: [self-hosted, macos]
|
||||||
|
env:
|
||||||
|
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos-target }}
|
||||||
needs: check_lint
|
needs: check_lint
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: ./.github/actions/setup-macos
|
- uses: ./.github/actions/setup-macos
|
||||||
- uses: ./.github/actions/build-macos
|
- uses: ./.github/actions/build-macos
|
||||||
with:
|
|
||||||
macos-target: ${{ matrix.macos-target }}
|
|
||||||
|
|
||||||
cuda_build_and_test:
|
cuda_build_and_test:
|
||||||
if: github.repository == 'ml-explore/mlx'
|
if: github.repository == 'ml-explore/mlx'
|
||||||
|
|||||||
19
.github/workflows/release.yml
vendored
19
.github/workflows/release.yml
vendored
@@ -47,12 +47,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
python_version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
||||||
include:
|
arch: ['x86_64', 'aarch64']
|
||||||
- runner: ubuntu-24.04
|
runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-22.04' || 'ubuntu-22.04-arm' }}
|
||||||
arch: x64
|
|
||||||
- runner: ubuntu-24.04-arm64
|
|
||||||
arch: arm64
|
|
||||||
runs-on: ${{ matrix.runner }}
|
|
||||||
env:
|
env:
|
||||||
PYPI_RELEASE: 1
|
PYPI_RELEASE: 1
|
||||||
DEV_RELEASE: ${{ github.event.inputs.dev_release == 'true' && 1 || 0 }}
|
DEV_RELEASE: ${{ github.event.inputs.dev_release == 'true' && 1 || 0 }}
|
||||||
@@ -68,12 +64,14 @@ jobs:
|
|||||||
- name: Upload MLX artifacts
|
- name: Upload MLX artifacts
|
||||||
uses: actions/upload-artifact@v5
|
uses: actions/upload-artifact@v5
|
||||||
with:
|
with:
|
||||||
|
overwrite: true
|
||||||
name: linux-wheels-${{ matrix.python_version }}
|
name: linux-wheels-${{ matrix.python_version }}
|
||||||
path: wheelhouse/mlx-*.whl
|
path: wheelhouse/mlx-*.whl
|
||||||
- name: Upload CPU artifacts
|
- name: Upload CPU artifacts
|
||||||
if: matrix.python_version == '3.10'
|
if: matrix.python_version == '3.10'
|
||||||
uses: actions/upload-artifact@v5
|
uses: actions/upload-artifact@v5
|
||||||
with:
|
with:
|
||||||
|
overwrite: true
|
||||||
name: mlx-cpu
|
name: mlx-cpu
|
||||||
path: wheelhouse/mlx_cpu-*.whl
|
path: wheelhouse/mlx_cpu-*.whl
|
||||||
|
|
||||||
@@ -90,19 +88,17 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: ./.github/actions/setup-macos
|
- uses: ./.github/actions/setup-macos
|
||||||
- uses: conda-incubator/setup-miniconda@v3
|
|
||||||
with:
|
with:
|
||||||
miniconda-version: "latest"
|
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
shell: sh
|
shell: bash -l {0}
|
||||||
run: |
|
run: |
|
||||||
pip install --upgrade pip
|
pip install --upgrade pip
|
||||||
pip install cmake setuptools nanobind==2.4.0
|
pip install cmake setuptools nanobind==2.4.0
|
||||||
pip install -e . -v
|
pip install -e . -v
|
||||||
- name: Generate package stubs
|
- name: Generate package stubs
|
||||||
shell: bash
|
shell: bash -l {0}
|
||||||
run: |
|
run: |
|
||||||
pip install typing_extensions
|
pip install typing_extensions
|
||||||
python setup.py generate_stubs
|
python setup.py generate_stubs
|
||||||
@@ -119,12 +115,14 @@ jobs:
|
|||||||
- name: Upload MLX artifacts
|
- name: Upload MLX artifacts
|
||||||
uses: actions/upload-artifact@v5
|
uses: actions/upload-artifact@v5
|
||||||
with:
|
with:
|
||||||
|
overwrite: true
|
||||||
name: mac-wheels-${{ matrix.python-version }}
|
name: mac-wheels-${{ matrix.python-version }}
|
||||||
path: dist/mlx-*.whl
|
path: dist/mlx-*.whl
|
||||||
- name: Upload Metal artifacts
|
- name: Upload Metal artifacts
|
||||||
if: matrix.python-version == '3.10'
|
if: matrix.python-version == '3.10'
|
||||||
uses: actions/upload-artifact@v5
|
uses: actions/upload-artifact@v5
|
||||||
with:
|
with:
|
||||||
|
overwrite: true
|
||||||
name: mlx-metal
|
name: mlx-metal
|
||||||
path: dist/mlx_metal-*.whl
|
path: dist/mlx_metal-*.whl
|
||||||
|
|
||||||
@@ -146,6 +144,7 @@ jobs:
|
|||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v5
|
uses: actions/upload-artifact@v5
|
||||||
with:
|
with:
|
||||||
|
overwrite: true
|
||||||
name: mlx-cuda
|
name: mlx-cuda
|
||||||
path: wheelhouse/mlx_cuda-*.whl
|
path: wheelhouse/mlx_cuda-*.whl
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user