Skip to content

Commit 4d18e25

Browse files
authored
Add Linux CI pipeline for WebGPU (microsoft#25219)
### Description Currently only build is enabled. Testing step is failing because of error like this: ``` 1: /onnxruntime_src/onnxruntime/core/providers/webgpu/webgpu_context.cc:87 onnxruntime::webgpu::WebGpuContext::Initialize(const onnxruntime::webgpu::WebGpuBufferCacheConfig&, int, bool)::<lambda()>::<lambda(wgpu::RequestAdapterStatus, wgpu::Adapter, wgpu::StringView, wgpu::Adapter*)> status == wgpu::RequestAdapterStatus::Success was false. Failed to get a WebGPU adapter: No supported adapters 1: ```
1 parent cf61c92 commit 4d18e25

File tree

2 files changed

+122
-0
lines changed

2 files changed

+122
-0
lines changed

.github/workflows/linux_webgpu.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Linux WebGPU CI
2+
3+
on:
4+
push:
5+
branches: [main, 'rel-*']
6+
pull_request:
7+
branches: [main, 'rel-*']
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
contents: read
16+
packages: write
17+
attestations: write
18+
id-token: write
19+
20+
jobs:
21+
build-linux-webgpu-x64-release:
22+
name: Build Linux WebGPU x64 Release
23+
# This job runs on a CPU node using the reusable build workflow
24+
uses: ./.github/workflows/reusable_linux_build.yml
25+
with:
26+
pool_name: "onnxruntime-github-Ubuntu2204-AMD-CPU" # Build pool
27+
build_config: Release
28+
architecture: x64
29+
dockerfile_path: tools/ci_build/github/linux/docker/Dockerfile.manylinux2_28_webgpu
30+
docker_image_repo: onnxruntimecpubuildpythonx64
31+
extra_build_flags: '--use_binskim_compliant_compile_flags --build_wheel --use_webgpu --build_java --cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=ON'
32+
python_path_prefix: 'PATH=/opt/python/cp310-cp310/bin:$PATH'
33+
run_tests: false
34+
upload_build_output: true
35+
execution_providers: 'webgpu'
36+
secrets:
37+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Pass token for reusable workflow needs (e.g., docker build action)
38+
39+
# TODO: the following test step is currently failing. Need to fix and re-enable it
40+
41+
# test-linux-webgpu-x64-release:
42+
# name: Test Linux WebGPU x64 Release
43+
# needs: build-linux-webgpu-x64-release
44+
# runs-on:
45+
# - self-hosted
46+
# - "1ES.Pool=Onnxruntime-github-Linux-GPU-A100-WUS3"
47+
# permissions:
48+
# contents: read
49+
# packages: read
50+
# steps:
51+
# - name: Checkout code
52+
# uses: actions/checkout@v4
53+
54+
# - uses: microsoft/onnxruntime-github-actions/[email protected]
55+
# id: build_docker_image_step
56+
# with:
57+
# dockerfile: ${{ github.workspace }}/tools/ci_build/github/linux/docker/Dockerfile.manylinux2_28_webgpu
58+
# image-name: ghcr.io/microsoft/onnxruntime/onnxruntimecpubuildcix64
59+
# push: true
60+
# azure-container-registry-name: onnxruntimebuildcache
61+
# env:
62+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Pass token to action
63+
64+
# # --- Download Build Artifact to Runner Temp Directory ---
65+
# - name: Download Build Artifact
66+
# uses: actions/download-artifact@v4
67+
# with:
68+
# name: build-output-x64-Release # Must match the upload name
69+
# path: ${{ runner.temp }}/Release # Download contents into temp dir structure
70+
71+
# # --- Restore Permissions in the Temp Directory ---
72+
# - name: Restore Executable Permissions
73+
# if: success() # Only run if download succeeded
74+
# working-directory: ${{ runner.temp }}/Release
75+
# shell: bash
76+
# run: |
77+
# if [ -f perms.txt ]; then
78+
# echo "Restoring executable permissions in ${{ runner.temp }}/Release ..."
79+
# while IFS= read -r file; do
80+
# # Check relative path existence within the current directory
81+
# if [ -f "$file" ]; then
82+
# chmod +x "$file"
83+
# else
84+
# echo "Warning: File '$file' listed in perms.txt not found."
85+
# fi
86+
# done < perms.txt
87+
# echo "Permissions restored."
88+
# else
89+
# echo "Warning: perms.txt not found in artifact."
90+
# fi
91+
92+
# - name: Test ONNX Runtime
93+
# id: test_step
94+
# uses: microsoft/onnxruntime-github-actions/[email protected]
95+
# with:
96+
# docker_image: ${{ steps.build_docker_image_step.outputs.full-image-name }}
97+
# build_config: Release
98+
# mode: 'test' # Set mode to test
99+
# execution_providers: 'webgpu'
100+
# extra_build_flags: '--use_binskim_compliant_compile_flags --cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=ON'
101+
# python_path_prefix: 'PATH=/opt/python/cp310-cp310/bin:$PATH'
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cpu_x64_ubi8_gcc14:20250124.1
2+
3+
ENV JAVA_HOME=/usr/lib/jvm/msopenjdk-17
4+
5+
#Install Vulkan and RPM Fusion for NVIDIA drivers (UBI8/RHEL8)
6+
RUN dnf install -y \
7+
https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm \
8+
https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm && \
9+
dnf install -y xorg-x11-drv-nvidia akmod-nvidia vulkan vulkan-tools mesa-vulkan-drivers
10+
11+
# TODO: Currently this Dockerfile works only for building WebGPU. Need to make it also support running WebGPU tests.
12+
13+
ADD scripts /tmp/scripts
14+
RUN cd /tmp/scripts && /tmp/scripts/manylinux/install_centos.sh
15+
RUN cd /tmp/scripts && /tmp/scripts/manylinux/install_deps.sh && rm -rf /tmp/scripts
16+
17+
ARG BUILD_UID=1001
18+
ARG BUILD_USER=onnxruntimedev
19+
RUN adduser --uid $BUILD_UID $BUILD_USER
20+
WORKDIR /home/$BUILD_USER
21+
USER $BUILD_USER

0 commit comments

Comments
 (0)