|
| 1 | +name: Test Vulkan Backend (specialized runners) |
| 2 | + |
| 3 | +# Vulkan CI jobs that require special runners (an NVIDIA GPU, or a Windows |
| 4 | +# MSVC toolchain). These are separate from test-backend-vulkan.yml (which runs the |
| 5 | +# default SwiftShader coverage on standard runners) so that they're only run |
| 6 | +# when Vulkan related files change. |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + - release/* |
| 13 | + tags: |
| 14 | + - ciflow/nightly/* |
| 15 | + pull_request: |
| 16 | + paths: |
| 17 | + - .github/workflows/vulkan.yml |
| 18 | + - backends/vulkan/** |
| 19 | + - examples/vulkan/** |
| 20 | + - .ci/scripts/setup-vulkan-linux-deps.sh |
| 21 | + - .ci/scripts/setup-vulkan-windows-deps.ps1 |
| 22 | + - .ci/scripts/setup-windows-msvc-vulkan.ps1 |
| 23 | + workflow_dispatch: |
| 24 | + |
| 25 | +concurrency: |
| 26 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }} |
| 27 | + cancel-in-progress: true |
| 28 | + |
| 29 | +permissions: |
| 30 | + contents: read |
| 31 | + |
| 32 | +jobs: |
| 33 | + changed-files: |
| 34 | + name: Get changed files |
| 35 | + uses: ./.github/workflows/_get-changed-files.yml |
| 36 | + with: |
| 37 | + include-push-diff: true # so push commits can also be path-filtered |
| 38 | + |
| 39 | + run-decision: |
| 40 | + name: CI run decision |
| 41 | + uses: ./.github/workflows/_ci-run-decision.yml |
| 42 | + |
| 43 | + test-vulkan-nvidia: |
| 44 | + needs: [changed-files, run-decision] |
| 45 | + # Path-filtered: skip commits that don't touch Vulkan-relevant paths, except |
| 46 | + # on sampled full runs (see _ci-run-decision.yml). |
| 47 | + if: | |
| 48 | + contains(needs.changed-files.outputs.changed-files, 'backends/vulkan/') || |
| 49 | + contains(needs.changed-files.outputs.changed-files, 'examples/vulkan/') || |
| 50 | + contains(needs.changed-files.outputs.changed-files, '.ci/scripts/setup-vulkan-linux-deps.sh') || |
| 51 | + contains(needs.changed-files.outputs.changed-files, '.github/workflows/vulkan.yml') || |
| 52 | + needs.run-decision.outputs.is-full-run == 'true' |
| 53 | + uses: pytorch/test-infra/.github/workflows/linux_job_v2.yml@main |
| 54 | + permissions: |
| 55 | + id-token: write |
| 56 | + contents: read |
| 57 | + with: |
| 58 | + timeout: 120 |
| 59 | + runner: linux.g5.4xlarge.nvidia.gpu |
| 60 | + gpu-arch-type: cuda |
| 61 | + gpu-arch-version: "12.6" |
| 62 | + use-custom-docker-registry: false |
| 63 | + submodules: recursive |
| 64 | + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} |
| 65 | + script: | |
| 66 | + set -eux |
| 67 | +
|
| 68 | + # Install the Vulkan SDK (glslc) and select a real system ICD. The NVIDIA |
| 69 | + # driver on this runner provides the ICD; install the loader as well. |
| 70 | + # NOTE: first-run check - inspect the vulkaninfo output below to confirm a |
| 71 | + # real NVIDIA device is selected (not llvmpipe/SwiftShader). If no system |
| 72 | + # ICD is present, setup-vulkan-linux-deps.sh falls back to SwiftShader. |
| 73 | + sudo apt-get update && sudo apt-get install -y libvulkan1 vulkan-tools || true |
| 74 | + source .ci/scripts/setup-vulkan-linux-deps.sh real-gpu |
| 75 | + vulkaninfo --summary || true |
| 76 | +
|
| 77 | + # Full from-source install. Unlike the SwiftShader jobs in pull.yml, the |
| 78 | + # CUDA runner image does not pre-install ExecuTorch's dependencies, so |
| 79 | + # setup-linux.sh's "deps already in the image" assumption does not hold. |
| 80 | + # CMAKE_ARGS enables Vulkan in the pybindings so the model --test runs and |
| 81 | + # the pt2e/torchao e2e tests below execute on the GPU (default is OFF). |
| 82 | + CMAKE_ARGS="-DEXECUTORCH_BUILD_VULKAN=ON" PYTHON_EXECUTABLE=python ./install_executorch.sh |
| 83 | +
|
| 84 | + # Model coverage (mirrors test-vulkan-models-linux, on real hardware). |
| 85 | + PYTHON_EXECUTABLE=python bash backends/vulkan/test/scripts/test_model.sh --build |
| 86 | +
|
| 87 | + models="mv2 mv3 edsr resnet18 resnet50 dl3 w2l ic3 ic4" |
| 88 | + for model in $models; do |
| 89 | + python -m examples.vulkan.export --model_name=$model --test |
| 90 | + done |
| 91 | +
|
| 92 | + # For selected vision models, test with dynamic shapes |
| 93 | + models="mv2 resnet18 resnet50 ic3 densenet161" |
| 94 | + for model in $models; do |
| 95 | + python -m examples.vulkan.export --model_name=$model --test -d |
| 96 | + done |
| 97 | +
|
| 98 | + # Operator coverage (mirrors test-vulkan-operators-linux, on real hardware). |
| 99 | + PYTHON_EXECUTABLE=python bash backends/vulkan/test/custom_ops/build_and_run.sh test_add |
| 100 | + ./cmake-out/backends/vulkan/test/custom_ops/test_q8csw_linear |
| 101 | + ./cmake-out/backends/vulkan/test/custom_ops/test_q8csw_conv2d |
| 102 | + ./cmake-out/backends/vulkan/test/custom_ops/test_q4gsw_linear |
| 103 | + ./cmake-out/backends/vulkan/test/custom_ops/test_choose_qparams_per_row |
| 104 | + ./cmake-out/backends/vulkan/test/custom_ops/test_q8ta_qdq |
| 105 | + ./cmake-out/backends/vulkan/test/custom_ops/test_q8ta_clone |
| 106 | + ./cmake-out/backends/vulkan/test/custom_ops/test_q8ta_binary |
| 107 | +
|
| 108 | + PYTHON_EXECUTABLE=python bash backends/vulkan/test/scripts/test_op.sh --build |
| 109 | +
|
| 110 | + # Run e2e testing for selected operators. |
| 111 | + python -m unittest backends/vulkan/test/test_vulkan_delegate.py -k "*pt2e*" |
| 112 | + python -m unittest backends/vulkan/test/test_vulkan_delegate.py -k "*torchao*" |
| 113 | +
|
| 114 | + build-vulkan-windows-msvc: |
| 115 | + needs: [changed-files, run-decision] |
| 116 | + if: | |
| 117 | + contains(needs.changed-files.outputs.changed-files, 'backends/vulkan/') || |
| 118 | + contains(needs.changed-files.outputs.changed-files, '.ci/scripts/setup-vulkan-windows-deps.ps1') || |
| 119 | + contains(needs.changed-files.outputs.changed-files, '.ci/scripts/setup-windows-msvc-vulkan.ps1') || |
| 120 | + contains(needs.changed-files.outputs.changed-files, '.github/workflows/vulkan.yml') || |
| 121 | + needs.run-decision.outputs.is-full-run == 'true' |
| 122 | + name: build-vulkan-windows-msvc |
| 123 | + uses: pytorch/test-infra/.github/workflows/windows_job.yml@main |
| 124 | + with: |
| 125 | + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} |
| 126 | + timeout: 90 |
| 127 | + script: | |
| 128 | + git config --global http.sslBackend openssl |
| 129 | + git submodule update --init backends/vulkan/third-party/Vulkan-Headers backends/vulkan/third-party/volk backends/vulkan/third-party/VulkanMemoryAllocator |
| 130 | + git submodule update --init |
| 131 | + conda init powershell |
| 132 | + powershell -Command "& { |
| 133 | + Set-PSDebug -Trace 1 |
| 134 | + \$ErrorActionPreference = 'Stop' |
| 135 | + \$PSNativeCommandUseErrorActionPreference = \$true |
| 136 | + .ci/scripts/setup-windows-msvc-vulkan.ps1 |
| 137 | + }" |
0 commit comments