Skip to content

Commit 928a6f8

Browse files
author
Awni Hannun
committed
fix release builds
1 parent eba6a9d commit 928a6f8

8 files changed

Lines changed: 81 additions & 108 deletions

File tree

.github/actions/build-cuda-release/action.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,9 @@ runs:
1212
- name: Build package
1313
shell: bash
1414
env:
15-
MLX_BUILD_STAGE: 2
1615
CMAKE_ARGS: -DMLX_BUILD_CUDA=ON -DCMAKE_CUDA_COMPILER=${{ inputs.nvcc-location }}
1716
run: |
1817
pip install auditwheel build patchelf setuptools
1918
python setup.py clean --all
20-
python -m build -w
21-
22-
if [ -f "python/scripts/repair_cuda.sh" ]; then
23-
bash python/scripts/repair_cuda.sh
24-
fi
19+
MLX_BUILD_STAGE=2 python -m build -w
20+
bash python/scripts/repair_cuda.sh

.github/actions/build-cuda/action.yml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,10 @@ name: 'Build and Test with CUDA'
22
description: 'Build and test MLX with CUDA'
33

44
inputs:
5-
build-type:
6-
description: 'Build type (debug, release)'
7-
required: false
8-
default: 'debug'
9-
run-tests:
10-
description: 'Whether to run tests'
11-
required: false
12-
default: 'true'
135
nvcc-location:
146
description: 'Location of nvcc compiler'
157
required: true
168
default: '/usr/local/cuda-12.9/bin/nvcc'
17-
# this value is dependent on the CUDA tools installed in the setup-linux workflow
189

1910
runs:
2011
using: "composite"
@@ -27,15 +18,13 @@ runs:
2718
run: pip install -e ".[dev]" -v
2819

2920
- name: Run Python tests - CPU
30-
if: inputs.run-tests == 'true'
3121
shell: bash
3222
env:
3323
LOW_MEMORY: 1
3424
DEVICE: cpu
3525
run: python -m unittest discover python/tests -v
3626

3727
- name: Run Python tests - GPU
38-
if: inputs.run-tests == 'true'
3928
shell: bash
4029
env:
4130
LOW_MEMORY: 1
@@ -53,12 +42,5 @@ runs:
5342
cmake --build build -j $(nproc)
5443
5544
- name: Run CPP tests
56-
if: ${{ inputs.build-type == 'debug' && inputs.run-tests == 'true' }}
5745
shell: bash
5846
run: ./build/tests/tests -sfe="*fft_tests.cpp,*linalg_tests.cpp"
59-
60-
- name: Build Python package
61-
if: inputs.build-type == 'release'
62-
uses: ./.github/actions/build-cuda-release
63-
with:
64-
nvcc-location: ${{ inputs.nvcc-location }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: 'Build Linux wheel'
2+
description: 'Build Linux wheel'
3+
4+
inputs:
5+
build-backend:
6+
description: 'Build the backend mlx-cpu package'
7+
required: false
8+
default: 'false'
9+
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: Generate package stubs
14+
shell: bash
15+
run: |
16+
pip install -e ".[dev]" -v
17+
uv pip install typing_extensions
18+
uv run --no-project setup.py generate_stubs
19+
- name: Build Python package
20+
shell: bash
21+
run: |
22+
pip install auditwheel patchelf build
23+
python setup.py clean --all
24+
MLX_BUILD_STAGE=1 python -m build -w
25+
bash python/scripts/repair_linux.sh
26+
- name: Build backend package
27+
if: inputs.build-backend == 'true'
28+
shell: bash
29+
run: |
30+
python setup.py clean --all
31+
MLX_BUILD_STAGE=2 python -m build -w
32+
auditwheel repair dist/mlx_cpu*.whl --plat manylinux_2_35_x86_64
Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,14 @@
11
name: 'Build and Test on Linux'
22
description: 'Build and test MLX on Linux'
33

4-
inputs:
5-
build-type:
6-
description: 'Build type'
7-
required: false
8-
default: 'debug'
9-
type: choice
10-
options:
11-
- debug
12-
- release
13-
run-tests:
14-
description: 'Whether to run tests'
15-
required: false
16-
default: 'true'
17-
type: boolean
18-
194
runs:
205
using: "composite"
216
steps:
22-
- name: Set DEBUG
23-
shell: sh
24-
if: inputs.build-type == 'debug'
25-
run: echo "DEBUG=1" >> $GITHUB_ENV
26-
277
- name: Install Python package
288
shell: sh
299
env:
3010
CMAKE_ARGS: "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON"
11+
DEBUG: 1
3112
run: pip install -e ".[dev]" -v
3213

3314
- name: Generate package stubs
@@ -37,7 +18,6 @@ runs:
3718
python setup.py generate_stubs
3819
3920
- name: Run Python tests
40-
if: inputs.run-tests == 'true'
4121
shell: bash
4222
run: |
4323
python -m unittest discover python/tests -v
@@ -50,29 +30,12 @@ runs:
5030
fi
5131
5232
- name: Build CPP only
53-
if: inputs.build-type == 'debug'
5433
shell: bash
5534
run: |
5635
mkdir -p build && cd build
5736
cmake .. -DMLX_BUILD_METAL=OFF -DCMAKE_BUILD_TYPE=DEBUG
5837
make -j $(nproc)
5938
6039
- name: Run CPP tests
61-
if: ${{ inputs.build-type == 'debug' && inputs.run-tests == 'true' }}
6240
shell: sh
6341
run: ./build/tests/tests
64-
65-
- name: Build Python package
66-
if: inputs.build-type == 'release'
67-
shell: bash
68-
run: |
69-
pip install auditwheel patchelf build
70-
python setup.py clean --all
71-
MLX_BUILD_STAGE=1 python -m build -w
72-
if [ -f "python/scripts/repair_linux.sh" ]; then
73-
bash python/scripts/repair_linux.sh
74-
fi
75-
76-
python setup.py clean --all
77-
MLX_BUILD_STAGE=2 python -m build -w
78-
auditwheel repair dist/mlx_cpu*.whl --plat manylinux_2_35_x86_64

.github/actions/build-macos-release/action.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,27 @@ inputs:
66
description: 'macOS build target'
77
required: false
88
default: '15.0'
9+
build-backend:
10+
description: 'Build the backend mlx-metal package'
11+
required: false
12+
default: 'false'
913

1014
runs:
1115
using: "composite"
1216
steps:
13-
- name: Build Python package(s)
17+
- name: Build Python package
1418
shell: bash
1519
env:
1620
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
1721
run: |
1822
uv pip install build
1923
uv run --no-project setup.py clean --all
2024
MLX_BUILD_STAGE=1 uv run -m build -w
25+
- name: Build backend package
26+
if: inputs.build-backend == 'true'
27+
shell: bash
28+
env:
29+
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
30+
run: |
2131
uv run --no-project setup.py clean --all
2232
MLX_BUILD_STAGE=2 uv run -m build -w
Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,14 @@
11
name: 'Build and Test on macOS'
22
description: 'Build and test MLX on macOS'
33

4-
inputs:
5-
build-type:
6-
description: 'Build type (debug, release)'
7-
required: false
8-
default: 'debug'
9-
type: choice
10-
options:
11-
- debug
12-
- release
13-
run-tests:
14-
description: 'Whether to run tests'
15-
required: false
16-
default: 'true'
17-
184
runs:
195
using: "composite"
206
steps:
217
- name: Install dependencies
228
shell: sh
239
env:
2410
DEBUG: 1
25-
DEV_RELEASE: 1
11+
CMAKE_ARGS: "-DCMAKE_COMPILE_WARNING_AS_ERROR=ON"
2612
run: |
2713
uv pip install --upgrade pip
2814
uv pip install cmake setuptools nanobind==2.4.0
@@ -35,13 +21,11 @@ runs:
3521
uv run --no-project setup.py generate_stubs
3622
3723
- name: Install tests dependencies
38-
if: inputs.run-tests == 'true'
3924
shell: sh
4025
run: |
4126
uv pip install numpy torch tensorflow unittest-xml-reporting
4227
4328
- name: Run Python tests
44-
if: inputs.run-tests == 'true'
4529
shell: bash
4630
env:
4731
LOW_MEMORY: 1
@@ -53,7 +37,6 @@ runs:
5337
if $(grep "\[WARN\]" stderr.log); then echo "Distributed ring test failed"; exit 1; fi
5438
5539
- name: Build example extension
56-
if: inputs.run-tests == 'true'
5740
shell: bash
5841
run: |
5942
cd examples/extensions
@@ -62,7 +45,6 @@ runs:
6245
uv run --no-project test.py
6346
6447
- name: Build CPP only
65-
if: inputs.run-tests == 'true'
6648
shell: bash
6749
run: |
6850
mkdir -p build
@@ -71,7 +53,6 @@ runs:
7153
make -j $(sysctl -n hw.ncpu)
7254
7355
- name: Run CPP tests
74-
if: inputs.run-tests == 'true'
7556
shell: bash
7657
env:
7758
DEVICE: gpu
@@ -80,7 +61,6 @@ runs:
8061
run: ./build/tests/tests
8162

8263
- name: Build small binary with JIT
83-
if: inputs.run-tests == 'true'
8464
shell: bash
8565
run: |
8666
mkdir -p build
@@ -94,7 +74,6 @@ runs:
9474
make -j $(sysctl -n hw.ncpu)
9575
9676
- name: Run Python tests with JIT
97-
if: inputs.run-tests == 'true'
9877
shell: bash
9978
env:
10079
LOW_MEMORY: 1
@@ -107,14 +86,3 @@ runs:
10786
uv run -m xmlrunner discover \
10887
-v python/tests \
10988
-o test-results/gpu_jit
110-
111-
- name: Build macOS 14 package
112-
if: inputs.build-type == 'release'
113-
uses: ./.github/actions/build-macos-release
114-
with:
115-
macos-target: 14.0
116-
- name: Build macOS 15 package
117-
if: inputs.build-type == 'release'
118-
uses: ./.github/actions/build-macos-release
119-
with:
120-
macos-target: 15.0

.github/workflows/nightly.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v5
2020
- uses: ./.github/actions/setup-linux
21-
- uses: ./.github/actions/build-linux
21+
- uses: ./.github/actions/build-linux-release
2222
with:
23-
build-type: release
24-
run-tests: false
23+
build-backend: ${{ matrix.python-version == "3.10" }}
2524
- name: Upload mlx artifacts
2625
uses: actions/upload-artifact@v5
2726
with:
@@ -54,8 +53,6 @@ jobs:
5453
strategy:
5554
matrix:
5655
python-version: ["3.10", "3.13"]
57-
env:
58-
MACOSX_DEPLOYMENT_TARGET: "15.0"
5956
runs-on: [self-hosted, macos]
6057
steps:
6158
- uses: actions/checkout@v5
@@ -64,6 +61,15 @@ jobs:
6461
python-version: ${{ matrix.python-version }}
6562
- uses: ./.github/actions/build-macos
6663

64+
- name: Build macOS 15 package
65+
uses: ./.github/actions/build-macos-release
66+
with:
67+
macos-target: 15.0
68+
- name: Build macOS 14 package
69+
uses: ./.github/actions/build-macos-release
70+
with:
71+
macos-target: 14.0
72+
6773
build_cuda_with_tests:
6874
if: github.repository == 'ml-explore/mlx'
6975
runs-on: gpu-t4-4-core

.github/workflows/release.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ jobs:
5353
- uses: ./.github/actions/setup-linux
5454
with:
5555
python-version: ${{ matrix.python_version }}
56-
- uses: ./.github/actions/build-linux
56+
- uses: ./.github/actions/build-linux-release
5757
with:
58-
build-type: release
59-
run-tests: false
58+
build-backend: ${{ matrix.python-version == "3.10" }}
6059
- name: Upload MLX artifacts
6160
uses: actions/upload-artifact@v5
6261
with:
@@ -82,10 +81,27 @@ jobs:
8281
- uses: ./.github/actions/setup-macos
8382
with:
8483
python-version: ${{ matrix.python-version }}
85-
- uses: ./.github/actions/build-macos
86-
with:
87-
build-type: release
88-
run-tests: false
84+
- name: Install dependencies
85+
shell: sh
86+
run: |
87+
uv pip install --upgrade pip
88+
uv pip install cmake setuptools nanobind==2.4.0
89+
uv pip install -e . -v
90+
- name: Generate package stubs
91+
shell: bash
92+
run: |
93+
uv pip install typing_extensions
94+
uv run --no-project setup.py generate_stubs
95+
- name: Build macOS 14 package
96+
uses: ./.github/actions/build-macos-release
97+
with:
98+
macos-target: 14.0
99+
build-backend: ${{ matrix.python-version == "3.10" }}
100+
- name: Build macOS 15 package
101+
uses: ./.github/actions/build-macos-release
102+
with:
103+
macos-target: 15.0
104+
build-backend: ${{ matrix.python-version == "3.10" }}
89105
- name: Upload MLX artifacts
90106
uses: actions/upload-artifact@v5
91107
with:

0 commit comments

Comments
 (0)