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