Add support for building torch from source #277
Workflow file for this run
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: 'Ascend NPU Test Suite' | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| paths: | |
| - '.github/workflows/ascend_npu_test.yml' | |
| - '.github/workflows/_ascend_npu_build_torch.yml' | |
| - '.github/workflows/_ascend_npu_build_torch_npu.yml' | |
| - '.github/workflows/_ascend_npu_ut.yml' | |
| - '.github/workflows/_ascend_npu_benchmark.yml' | |
| - '.github/actions/**' | |
| - '.ci/**' | |
| - 'ascend_npu/**' | |
| - 'src/**' | |
| - '!**/*.md' | |
| pull_request: | |
| branches: | |
| - 'main' | |
| paths: | |
| - '.github/workflows/ascend_npu_test.yml' | |
| - '.github/workflows/_ascend_npu_build_torch.yml' | |
| - '.github/workflows/_ascend_npu_build_torch_npu.yml' | |
| - '.github/workflows/_ascend_npu_ut.yml' | |
| - '.github/workflows/_ascend_npu_benchmark.yml' | |
| - '.github/actions/**' | |
| - '.ci/**' | |
| - 'ascend_npu/**' | |
| - 'src/**' | |
| - '!**/*.md' | |
| release: | |
| types: | |
| - 'published' | |
| schedule: | |
| - cron: '0 12 * * *' | |
| repository_dispatch: | |
| types: [pytorch-pr-event-redispatch] | |
| workflow_dispatch: | |
| inputs: | |
| runner: | |
| required: true | |
| type: choice | |
| options: | |
| - self-hosted | |
| - npu-arm64 | |
| default: 'self-hosted' | |
| description: 'The runner selected to run on' | |
| image: | |
| required: true | |
| type: choice | |
| options: | |
| - ascendai/cann:7.1-openeuler2203sp2 | |
| - ascendai/cann:8.0.rc2.alpha003-910b-ubuntu22.04-py3.9 | |
| - ascendai/cann:8.0.rc3.alpha002-910b-ubuntu22.04-py3.9 | |
| - ascendai/cann:latest | |
| default: 'ascendai/cann:latest' | |
| description: 'The docker image which will be loaded' | |
| device: | |
| required: true | |
| type: choice | |
| options: | |
| - /dev/davinci1 | |
| - /dev/davinci2 | |
| - /dev/davinci3 | |
| - /dev/davinci4 | |
| - /dev/davinci5 | |
| - /dev/davinci6 | |
| - /dev/davinci7 | |
| - /dev/davinci8 | |
| default: '/dev/davinci5' | |
| description: 'The device selected to run on' | |
| # Only cancel the previous runs when triggered by a pull_request event or a repository_dispatch event | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' || github.event_name == 'repository_dispatch' }} | |
| jobs: | |
| prepare: | |
| name: Prepare | |
| runs-on: ubuntu-latest | |
| outputs: | |
| runner: ${{ steps.set-env.outputs.runner }} | |
| image: ${{ steps.set-env.outputs.image }} | |
| device: ${{ steps.set-env.outputs.device }} | |
| ref: ${{ steps.list-ref.outputs.ref }} | |
| steps: | |
| - name: Set environment params | |
| id: set-env | |
| run: | | |
| echo "runner=${{ github.event.inputs.runner || 'self-hosted' }}" >> $GITHUB_OUTPUT | |
| echo "device=${{ github.event.inputs.device || '/dev/davinci5' }}" >> $GITHUB_OUTPUT | |
| echo "image=${{ github.event.inputs.image || 'ascendai/cann:latest' }}" >> $GITHUB_OUTPUT | |
| # TODO(shink): List ghstack PR's ref | |
| - name: List ref to the PyTorch branch | |
| id: list-ref | |
| if: ${{ github.event_name == 'repository_dispatch' }} | |
| run: | | |
| echo "ref=refs/pull/${{ github.event.client_payload.pull_request.number }}/merge" >> $GITHUB_OUTPUT | |
| build-torch: | |
| name: Build torch | |
| needs: | |
| - prepare | |
| if: ${{ needs.prepare.outputs.ref }} | |
| uses: ./.github/workflows/_ascend_npu_build_torch.yml | |
| with: | |
| runner: ${{ needs.prepare.outputs.runner }} | |
| image: ${{ needs.prepare.outputs.image }} | |
| ref: ${{ needs.prepare.outputs.ref }} | |
| build: | |
| name: Build torch_npu | |
| needs: | |
| - prepare | |
| - build-torch | |
| if: ${{ always() }} | |
| uses: ./.github/workflows/_ascend_npu_build_torch_npu.yml | |
| with: | |
| runner: ${{ needs.prepare.outputs.runner }} | |
| image: ${{ needs.prepare.outputs.image }} | |
| torch-artifact: ${{ needs.build-torch.outputs.torch-artifact }} | |
| test: | |
| name: Test torch_npu | |
| needs: | |
| - prepare | |
| - build-torch | |
| - build | |
| uses: ./.github/workflows/_ascend_npu_ut.yml | |
| with: | |
| runner: ${{ needs.prepare.outputs.runner }} | |
| image: ${{ needs.prepare.outputs.image }} | |
| device: ${{ needs.prepare.outputs.device }} | |
| torch-artifact: ${{ needs.build-torch.outputs.torch-artifact }} | |
| torch-npu-artifact: ${{ needs.build.outputs.torch-npu-artifact }} | |
| benchmark: | |
| name: Run benchmarks | |
| needs: | |
| - prepare | |
| - build-torch | |
| - build | |
| - test | |
| uses: ./.github/workflows/_ascend_npu_benchmark.yml | |
| with: | |
| runner: ${{ needs.prepare.outputs.runner }} | |
| image: ${{ needs.prepare.outputs.image }} | |
| device: ${{ needs.prepare.outputs.device }} | |
| torch-artifact: ${{ needs.build-torch.outputs.torch-artifact }} | |
| torch-npu-artifact: ${{ needs.build.outputs.torch-npu-artifact }} | |
| secrets: | |
| pr-token: ${{ secrets.COSDT_BOT_TOKEN }} |