Skip to content

Fix generic im2row NHWC layout to match Python reference #144

Fix generic im2row NHWC layout to match Python reference

Fix generic im2row NHWC layout to match Python reference #144

Workflow file for this run

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
}"