|
| 1 | +name: pull_mps |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }} |
| 12 | + cancel-in-progress: true |
| 13 | + |
| 14 | +jobs: |
| 15 | + gather-models-mps: |
| 16 | + runs-on: macos-executorch |
| 17 | + outputs: |
| 18 | + models: ${{ steps.gather-models-mps.outputs.models }} |
| 19 | + mps_models: ${{ steps.gather-models-mps.outputs.mps_models }} |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + submodules: 'recursive' |
| 24 | + - name: Extract the list of models to test |
| 25 | + id: gather-models-mps |
| 26 | + run: | |
| 27 | + set -eux |
| 28 | +
|
| 29 | + # Conda setup |
| 30 | + if conda info --envs | grep -w -q "env-${{ runner.name }}"; then echo "env-${{ runner.name }} already exists"; else conda create -y -n "env-${{ runner.name }}" python=3.10; fi |
| 31 | + CONDA_ENV="~/miniconda3/envs/env-${{ runner.name }}" |
| 32 | + if [[ -n "$CONDA_ENV" ]]; then |
| 33 | + # Use binaries under conda environment |
| 34 | + export PATH="$CONDA_ENV/bin":$PATH |
| 35 | + fi |
| 36 | +
|
| 37 | + conda init zsh |
| 38 | + conda init |
| 39 | + source ~/miniconda3/bin/activate |
| 40 | + conda deactivate |
| 41 | + conda activate "$CONDA_ENV" |
| 42 | + conda install -y cmake |
| 43 | +
|
| 44 | + source .ci/scripts/utils.sh |
| 45 | + # This is a simple Python script but as it tries to import executorch.examples.models, |
| 46 | + # it requires a whole bunch of ExecuTorch dependencies on the Docker image |
| 47 | + PYTHON_EXECUTABLE=python3 bash install_requirements.sh |
| 48 | + # Discover all the tests from test_mps.py |
| 49 | + python -m unittest backends.apple.mps.test.test_mps -k test_mps_backend_mm -q &>/dev/null |
| 50 | +
|
| 51 | + PYTHONPATH="${PWD}" python -m backends.apple.mps.ci.scripts.gather_test_models_mps |
| 52 | +# test-mps-models: |
| 53 | +# name: test-mps-models |
| 54 | +# runs-on: macos-executorch |
| 55 | +# needs: gather-models-mps |
| 56 | +# strategy: |
| 57 | +# matrix: ${{ fromJSON(needs.gather-models-mps.outputs.models) }} |
| 58 | +# fail-fast: false |
| 59 | +# steps: |
| 60 | +# - uses: actions/checkout@v4 |
| 61 | +# with: |
| 62 | +# submodules: 'recursive' |
| 63 | +# - name: Run test ${{ matrix.test }} |
| 64 | +# if: always() |
| 65 | +# run: | |
| 66 | +# set -eux |
| 67 | + |
| 68 | +# # Conda setup |
| 69 | +# if conda info --envs | grep -w -q "env-${{ runner.name }}"; then echo "env-${{ runner.name }} already exists"; else conda create -y -n "env-${{ runner.name }}" python=3.10; fi |
| 70 | +# CONDA_ENV="~/miniconda3/envs/env-${{ runner.name }}" |
| 71 | +# PYTHON_PATH="$CONDA_ENV/bin/python3" |
| 72 | +# if [[ -n "$CONDA_ENV" ]]; then |
| 73 | +# # Use binaries under conda environment |
| 74 | +# export PATH="$CONDA_ENV/bin":$PATH |
| 75 | +# fi |
| 76 | + |
| 77 | +# conda init zsh |
| 78 | +# conda init |
| 79 | +# source ~/miniconda3/bin/activate |
| 80 | +# conda deactivate |
| 81 | +# conda activate "$CONDA_ENV" |
| 82 | + |
| 83 | +# # Print out some information about the test environment |
| 84 | +# which conda |
| 85 | +# conda --version |
| 86 | +# which python3 |
| 87 | +# python3 --version |
| 88 | +# which python |
| 89 | +# python --version |
| 90 | + |
| 91 | +# source .ci/scripts/utils.sh |
| 92 | +# conda install -y cmake |
| 93 | + |
| 94 | +# WORKSPACE=$(pwd) |
| 95 | +# pushd "${WORKSPACE}" |
| 96 | +# MODEL_NAME=${{ matrix.model }} |
| 97 | +# BUILD_TOOL=${{ matrix.build-tool }} |
| 98 | + |
| 99 | +# # Setup MacOS dependencies as there is no Docker support on MacOS atm |
| 100 | +# PYTHON_EXECUTABLE=python3 bash install_requirements.sh --pybind mps |
| 101 | +# # Build and test ExecuTorch |
| 102 | +# PYTHON_EXECUTABLE=python3 bash backends/apple/mps/ci/scripts/test-mps.sh "${MODEL_NAME}" "${BUILD_TOOL}" false |
| 103 | +# popd |
| 104 | + test-mps: |
| 105 | + name: test-mps |
| 106 | + runs-on: macos-executorch |
| 107 | + needs: gather-models-mps |
| 108 | + strategy: |
| 109 | + matrix: ${{ fromJSON(needs.gather-models-mps.outputs.mps_models) }} |
| 110 | + fail-fast: false |
| 111 | + steps: |
| 112 | + - uses: actions/checkout@v4 |
| 113 | + with: |
| 114 | + submodules: 'recursive' |
| 115 | + - name: Run test ${{ matrix.test }} |
| 116 | + if: always() |
| 117 | + run: | |
| 118 | + set -eux |
| 119 | +
|
| 120 | + # Conda setup |
| 121 | + if conda info --envs | grep -w -q "env-${{ runner.name }}"; then echo "env-${{ runner.name }} already exists"; else conda create -y -n "env-${{ runner.name }}" python=3.10; fi |
| 122 | + CONDA_ENV="~/miniconda3/envs/env-${{ runner.name }}" |
| 123 | + PYTHON_PATH="$CONDA_ENV/bin/python3" |
| 124 | + if [[ -n "$CONDA_ENV" ]]; then |
| 125 | + # Use binaries under conda environment |
| 126 | + export PATH="$CONDA_ENV/bin":$PATH |
| 127 | + fi |
| 128 | +
|
| 129 | + conda init zsh |
| 130 | + conda init |
| 131 | + source ~/miniconda3/bin/activate |
| 132 | + conda deactivate |
| 133 | + conda activate "$CONDA_ENV" |
| 134 | +
|
| 135 | + # Print out some information about the test environment |
| 136 | + which conda |
| 137 | + conda --version |
| 138 | + which python3 |
| 139 | + python3 --version |
| 140 | + which python |
| 141 | + python --version |
| 142 | +
|
| 143 | + source .ci/scripts/utils.sh |
| 144 | + conda install -y cmake |
| 145 | + PYTHON_EXECUTABLE=python3 bash install_requirements.sh --pybind mps |
| 146 | +
|
| 147 | + MODEL_NAME=${{ matrix.model }} |
| 148 | + BUILD_TOOL=${{ matrix.build-tool }} |
| 149 | + # Setup MacOS dependencies as there is no Docker support on MacOS atm |
| 150 | + PYTHON_EXECUTABLE=python3 bash backends/apple/mps/install_requirements.sh |
| 151 | + # Build and test ExecuTorch |
| 152 | + python3 -m unittest "${MODEL_NAME}" |
0 commit comments