-
Notifications
You must be signed in to change notification settings - Fork 314
Add CI pipeline for WebGPU EP model testing #1956
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 19 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
1e18991
Add CI pipeline for WebGPU EP model testing
qjia7 77caa2a
fix the dll path
qjia7 d23f6a0
fix unknown value session_options
qjia7 3539696
test
qjia7 c301735
replace onnxruntime cpu dlls with webgpu dlls
qjia7 2909dfa
Revert "replace onnxruntime cpu dlls with webgpu dlls"
qjia7 dc31824
use onnxruntime-webgpu==1.24.0.dev20251218001
qjia7 37fad7c
address comments
qjia7 b7e7b36
Merge branch 'main' into webgpu_ci
qjia7 85ea1ba
more
qjia7 a4fc110
fix pipeline errors
qjia7 529a2e3
remove c# related tests
qjia7 ab6142d
Replace onnxruntime CPU DLLs with WebGPU DLLs
qjia7 292dc3c
add webgpu presets
qjia7 5ce37e4
more fix
qjia7 c15de05
skip failed tests
qjia7 f41aacb
Skip Engine test
qjia7 3592b74
skip all engine tests
qjia7 bf24ce2
upgrade onnxruntime-webgpu
qjia7 4b42db5
address comments
qjia7 c8b2896
fix pipeline errors
qjia7 6d5c172
Merge branch 'main' into webgpu_ci
qjia7 2b05a2a
fix CI errors
qjia7 38f7d67
more
qjia7 97d4428
Resolve dependencies for the Foundry package
qjia7 5cd6e02
address comments
qjia7 85d9c0a
upgrade onnxruntime-webgpu python package
qjia7 96f56c4
address comments
qjia7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| name: "Windows WebGPU x64 Build" | ||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main | ||
| - rel-* | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| AZCOPY_AUTO_LOGIN_TYPE: MSI | ||
| AZCOPY_MSI_CLIENT_ID: 63b63039-6328-442f-954b-5a64d124e5b4 | ||
| ORT_NIGHTLY_REST_API: "https://feeds.dev.azure.com/aiinfra/PublicPackages/_apis/packaging/Feeds/ORT-Nightly/packages?packageNameQuery=Microsoft.ML.OnnxRuntime&api-version=6.0-preview.1" | ||
| ORT_PACKAGE_NAME: "Microsoft.ML.OnnxRuntime" | ||
| binaryDir: 'build/webgpu/win-x64' | ||
| TEST_WEBGPU: 'true' | ||
|
|
||
| jobs: | ||
| windows-webgpu-x64-build: | ||
| runs-on: ["self-hosted", "1ES.Pool=onnxruntime-genai-Win2022-GPU-A10"] | ||
| steps: | ||
| - name: Checkout OnnxRuntime GenAI repo | ||
| uses: actions/checkout@v5 | ||
| with: | ||
| submodules: true | ||
|
|
||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: '3.12.x' | ||
| architecture: 'x64' | ||
|
|
||
| - name: Setup VCPKG | ||
| uses: microsoft/onnxruntime-github-actions/setup-build-tools@v0.0.8 | ||
| with: | ||
| vcpkg-version: '2025.03.19' | ||
| vcpkg-hash: '17e96169cd3f266c4716fcdc1bb728e6a64f103941ece463a2834d50694eba4fb48f30135503fd466402afa139abc847ef630733c442595d1c34979f261b0114' | ||
| cmake-version: '3.31.6' | ||
| cmake-hash: '0f1584e8666cf4a65ec514bd02afe281caabf1d45d2c963f3151c41484f457386aa03273ab25776a670be02725354ce0b46f3a5121857416da37366342a833a0' | ||
| add-cmake-to-path: 'true' | ||
| disable-terrapin: 'false' | ||
|
|
||
| - uses: actions/setup-dotnet@v5 | ||
| with: | ||
| dotnet-version: '8.0.x' | ||
|
|
||
| - name: Download OnnxRuntime Nightly (CPU package for headers and lib) | ||
| shell: pwsh | ||
| run: | | ||
| $resp = Invoke-RestMethod "${{ env.ORT_NIGHTLY_REST_API }}" | ||
| $ORT_NIGHTLY_VERSION = $resp.value[0].versions[0].normalizedVersion | ||
| Write-Host "OnnxRuntime version: $ORT_NIGHTLY_VERSION" | ||
| "ORT_NIGHTLY_VERSION=$ORT_NIGHTLY_VERSION" | Out-File -FilePath $env:GITHUB_ENV -Append | ||
| nuget install ${{ env.ORT_PACKAGE_NAME }} -version $ORT_NIGHTLY_VERSION -x -NonInteractive | ||
|
|
||
| - run: Get-ChildItem ${{ env.ORT_PACKAGE_NAME }} -Recurse | ||
| continue-on-error: true | ||
|
|
||
| - name: Extract OnnxRuntime library and header files | ||
| run: | | ||
| mkdir ort/lib | ||
| move ${{ env.ORT_PACKAGE_NAME }}/build/native/include ort/ | ||
| move ${{ env.ORT_PACKAGE_NAME }}/runtimes/win-x64/native/* ort/lib/ | ||
|
|
||
| - name: Install Rust Toolchain | ||
| run: | | ||
| $exePath = "$env:TEMP\rustup-init.exe" | ||
| (New-Object Net.WebClient).DownloadFile('https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe', $exePath) | ||
| & $exePath -y --default-toolchain=1.86.0 | ||
| Add-Content $env:GITHUB_PATH "$env:USERPROFILE\.cargo\bin" | ||
|
|
||
| - name: Configure CMake | ||
| run: | | ||
| cmake --preset windows_x64_webgpu_release -DTEST_PHI2=True | ||
|
|
||
| - name: Install Python dependencies to get WebGPU OnnxRuntime | ||
| run: | | ||
| python -m pip install -r test\python\requirements.txt | ||
|
qjia7 marked this conversation as resolved.
Outdated
|
||
| python -m pip install -r test\python\webgpu\torch\requirements.txt | ||
| python -m pip install -r test\python\webgpu\ort\requirements.txt | ||
|
|
||
| - name: Replace onnxruntime CPU DLLs with WebGPU DLLs | ||
| shell: pwsh | ||
| run: | | ||
| Write-Host "Replacing onnxruntime CPU DLLs with WebGPU DLLs before building..." | ||
|
|
||
| # Find onnxruntime-webgpu package location (installed via pip) | ||
| $ortWebGpuLocation = python -c "import onnxruntime; import os; print(os.path.dirname(onnxruntime.__file__))" | ||
| Write-Host "onnxruntime-webgpu package location: $ortWebGpuLocation" | ||
|
|
||
| # Find the capi directory where WebGPU DLLs are located | ||
| $webgpuCapiDir = Join-Path $ortWebGpuLocation "capi" | ||
| if (-not (Test-Path $webgpuCapiDir)) { | ||
| Write-Error "Could not find onnxruntime capi directory at: $webgpuCapiDir" | ||
| exit 1 | ||
| } | ||
|
|
||
| # Copy WebGPU DLLs to ort/lib (for building genai with WebGPU support) | ||
| Write-Host "`nCopying WebGPU DLLs to ort/lib..." | ||
| $dllsToCopy = @("onnxruntime.dll", "dxil.dll", "dxcompiler.dll") | ||
| foreach ($dll in $dllsToCopy) { | ||
| $sourcePath = Join-Path $webgpuCapiDir $dll | ||
| if (Test-Path $sourcePath) { | ||
| Copy-Item -Path $sourcePath -Destination "$env:GITHUB_WORKSPACE\ort\lib\$dll" -Force | ||
| Write-Host " Copied: $dll" | ||
| } else { | ||
| Write-Host " Warning: $dll not found at $sourcePath" | ||
| } | ||
| } | ||
|
|
||
| Write-Host "`nWebGPU DLLs successfully replaced in ort/lib/" | ||
| Get-ChildItem "$env:GITHUB_WORKSPACE\ort\lib\*.dll" | ForEach-Object { | ||
| Write-Host " - $($_.Name) ($([math]::Round($_.Length / 1MB, 2)) MB)" | ||
| } | ||
|
|
||
| - name: Build with CMake | ||
| run: | | ||
| cmake --build --preset windows_x64_webgpu_release --parallel | ||
| cmake --build --preset windows_x64_webgpu_release --target PyPackageBuild | ||
|
|
||
| - name: Install the Python Wheel | ||
| run: | | ||
| python -m pip install (Get-ChildItem ("$env:binaryDir\wheel\*.whl")) --no-deps | ||
|
|
||
| - name: Build the Java API and Run the Java Tests | ||
| run: | | ||
| python build.py --config=Release --build_dir $env:binaryDir --build_java --parallel | ||
|
|
||
| - name: Run the Python Tests | ||
| run: | | ||
| python test/python/test_onnxruntime_genai.py --cwd "test\python" --test_models "test\test_models" --e2e | ||
|
|
||
| - name: Verify Build Artifacts | ||
| if: always() | ||
| continue-on-error: true | ||
| run: | | ||
| Get-ChildItem -Path $env:GITHUB_WORKSPACE\$env:binaryDir -Recurse | ||
|
|
||
| - name: Run C++ Unit Tests | ||
| run: |- | ||
| copy $env:GITHUB_WORKSPACE\ort\lib\* .\$env:binaryDir\Release | ||
| & .\$env:binaryDir\Release\unit_tests.exe | ||
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| onnxruntime-webgpu==1.24.1.dev20260203002 |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| --index-url https://download.pytorch.org/whl/cpu | ||
| torch==2.7.1+cpu |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.