Skip to content

Commit 60d80a3

Browse files
authored
fix release builds (#2746)
1 parent eba6a9d commit 60d80a3

File tree

9 files changed

+85
-115
lines changed

9 files changed

+85
-115
lines changed

.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 & 19 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,23 +18,20 @@ 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
4231
DEVICE: gpu
4332
run: python -m tests discover python/tests -v
4433

4534
- name: Build CPP only
46-
if: inputs.build-type == 'debug'
4735
shell: bash
4836
run: |
4937
cmake . -B build \
@@ -53,12 +41,5 @@ runs:
5341
cmake --build build -j $(nproc)
5442
5543
- name: Run CPP tests
56-
if: ${{ inputs.build-type == 'debug' && inputs.run-tests == 'true' }}
5744
shell: bash
5845
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: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
type: boolean
8+
required: false
9+
default: false
10+
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: Generate package stubs
15+
shell: bash
16+
run: |
17+
pip install -e ".[dev]" -v
18+
pip install typing_extensions
19+
python setup.py generate_stubs
20+
- name: Build Python package
21+
shell: bash
22+
run: |
23+
pip install auditwheel patchelf build
24+
python setup.py clean --all
25+
MLX_BUILD_STAGE=1 python -m build -w
26+
bash python/scripts/repair_linux.sh
27+
- name: Build backend package
28+
if: ${{ inputs.build-backend }}
29+
shell: bash
30+
run: |
31+
python setup.py clean --all
32+
MLX_BUILD_STAGE=2 python -m build -w
33+
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: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,28 @@ 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+
type: boolean
12+
required: false
13+
default: false
914

1015
runs:
1116
using: "composite"
1217
steps:
13-
- name: Build Python package(s)
18+
- name: Build Python package
1419
shell: bash
1520
env:
1621
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
1722
run: |
1823
uv pip install build
1924
uv run --no-project setup.py clean --all
2025
MLX_BUILD_STAGE=1 uv run -m build -w
26+
- name: Build backend package
27+
if: ${{ inputs.build-backend }}
28+
shell: bash
29+
env:
30+
MACOSX_DEPLOYMENT_TARGET: ${{ inputs.macos-target }}
31+
run: |
2132
uv run --no-project setup.py clean --all
2233
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/actions/setup-macos/action.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ name: 'Setup macOS Environment'
22
description: 'Install dependencies for macOS builds'
33

44
inputs:
5-
install-mpi:
6-
description: 'Whether to install MPI'
7-
required: false
8-
default: 'true'
9-
type: boolean
105
python-version:
116
description: 'Python version to use'
127
required: false
@@ -17,7 +12,6 @@ runs:
1712
steps:
1813
- name: Install Homebrew packages
1914
shell: sh
20-
if: inputs.install-mpi == 'true'
2115
run: /opt/homebrew/bin/brew install openmpi
2216

2317
- name: Verify MetalToolchain installed

.github/workflows/nightly.yml

Lines changed: 13 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,17 @@ 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+
build-backend: ${{ matrix.python-version == '3.10' }}
69+
- name: Build macOS 14 package
70+
uses: ./.github/actions/build-macos-release
71+
with:
72+
macos-target: 14.0
73+
build-backend: ${{ matrix.python-version == '3.10' }}
74+
6775
build_cuda_with_tests:
6876
if: github.repository == 'ml-explore/mlx'
6977
runs-on: gpu-t4-4-core

0 commit comments

Comments
 (0)