Update to MLX 2770a1024 #306
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build | |
| on: push | |
| jobs: | |
| build: | |
| runs-on: >- | |
| ${{ | |
| ((matrix.os == 'linux' && matrix.arch == 'arm64') && | |
| 'ubuntu-24.04-arm' || | |
| ((matrix.os == 'mac' && matrix.arch == 'arm64') && | |
| 'macos-15' || | |
| (fromJson('{"linux":"ubuntu-24.04","mac":"macos-13","win":"windows-2022"}')[matrix.os]))) | |
| }} | |
| continue-on-error: false | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [linux, mac, win] | |
| arch: [arm64, x64] | |
| exclude: | |
| - os: win | |
| arch: arm64 | |
| steps: | |
| - name: Install Linux dependencies | |
| if: matrix.os == 'linux' | |
| run: sudo apt-get install -y ninja-build libblas-dev liblapack-dev liblapacke-dev | |
| - name: Install macOS dependencies | |
| if: matrix.os == 'mac' | |
| run: brew install ninja openblas | |
| - name: Install Windows SDK | |
| if: matrix.os == 'win' | |
| uses: GuillaumeFalourd/setup-windows10-sdk-action@v2 | |
| with: | |
| sdk-version: 22621 | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Install node modules | |
| run: yarn | |
| - name: Use ccache | |
| uses: hendrikmuhs/ccache-action@v1.2 | |
| with: | |
| key: ccache-${{ matrix.os }}-${{ matrix.arch }} | |
| - name: Get number of CPU cores | |
| uses: SimenB/github-actions-cpu-cores@v2 | |
| id: cpu-cores | |
| - name: Build (Posix) | |
| if: matrix.os != 'win' | |
| run: | | |
| yarn build -p ${{ steps.cpu-cores.outputs.count }} \ | |
| -G Ninja \ | |
| --CDCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
| --CDCMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| - name: Build (Windows) | |
| if: matrix.os == 'win' | |
| shell: cmd | |
| run: | | |
| pushd "C:\Program Files (x86)\Microsoft Visual Studio\Installer\" | |
| for /f "delims=" %%x in ('.\vswhere.exe -latest -property InstallationPath') do set VSPATH=%%x | |
| popd | |
| call "%VSPATH%\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.arch }} | |
| yarn build -p ${{ steps.cpu-cores.outputs.count }} ^ | |
| -G Ninja ^ | |
| --CDCMAKE_C_COMPILER_LAUNCHER=ccache ^ | |
| --CDCMAKE_CXX_COMPILER_LAUNCHER=ccache ^ | |
| --CDCMAKE_BUILD_TYPE=Release ^ | |
| --CDCMAKE_C_COMPILER=cl ^ | |
| --CDCMAKE_CXX_COMPILER=cl ^ | |
| --CDCMAKE_RC_COMPILER=rc | |
| - name: Test | |
| if: matrix.os != 'win' | |
| run: yarn test | |
| - name: Prepare .node file | |
| run: cp build/Release/node_mlx.node mlx-${{ matrix.os }}-${{ matrix.arch }}.node | |
| - name: Prepare .metallib file | |
| if: matrix.os == 'mac' && matrix.arch == 'arm64' | |
| run: cp build/deps/mlx/mlx/backend/metal/kernels/mlx.metallib mlx-${{ matrix.os }}-${{ matrix.arch }}.metallib | |
| - name: Upload Binary Files | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mlx-${{ matrix.os }}-${{ matrix.arch }} | |
| path: mlx-${{ matrix.os }}-${{ matrix.arch }}.* | |
| retention-days: 1 | |
| release: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # Needed by action-gh-release. | |
| contents: write | |
| steps: | |
| - name: Download Files | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: Compress files | |
| run: gzip * | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: true | |
| name: node-mlx ${{ github.ref_name }} | |
| body: '## Changelog' | |
| files: '*.gz' |