-
Notifications
You must be signed in to change notification settings - Fork 291
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 all 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,107 @@ | ||
| 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/cpu/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 Foundry Package (includes WebGPU support) | ||
| shell: pwsh | ||
| run: | | ||
| # Use Foundry package which includes WebGPU DLLs (dxil.dll, dxcompiler.dll) | ||
| $FOUNDRY_VERSION = "1.25.0-dev-20260210-0905-b214734cba" | ||
| Write-Host "Downloading OnnxRuntime.Foundry version: $FOUNDRY_VERSION" | ||
| nuget install Microsoft.ML.OnnxRuntime.Foundry -version $FOUNDRY_VERSION -Source https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/nuget/v3/index.json -x -NonInteractive -ExcludeVersion -DependencyVersion Ignore | ||
|
|
||
| - run: Get-ChildItem Microsoft.ML.OnnxRuntime.Foundry -Recurse | ||
| continue-on-error: true | ||
|
|
||
| - name: Extract OnnxRuntime library and header files | ||
| run: | | ||
| mkdir ort/lib | ||
| move Microsoft.ML.OnnxRuntime.Foundry/build/native/include ort/ | ||
| move Microsoft.ML.OnnxRuntime.Foundry/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_cpu_release -DTEST_PHI2=True | ||
|
|
||
| - name: Build with CMake | ||
| run: | | ||
| cmake --build --preset windows_x64_cpu_release --parallel | ||
| cmake --build --preset windows_x64_cpu_release --target PyPackageBuild | ||
|
|
||
| - name: Install Python dependencies and Wheel | ||
| run: | | ||
| python -m pip install -r test\python\requirements.txt | ||
| python -m pip install -r test\python\webgpu\torch\requirements.txt | ||
| python -m pip install -r test\python\webgpu\ort\requirements.txt | ||
| 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| onnxruntime-webgpu==1.25.0.dev20260210001 |
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 |
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,54 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <filesystem> | ||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| #ifndef MODEL_PATH | ||
| #define MODEL_PATH "../../test/test_models/" | ||
| #endif | ||
|
|
||
| namespace test_utils { | ||
|
|
||
| // Helper function to get the appropriate PHI2 model path based on available models | ||
| inline const std::string& GetPhi2Path() { | ||
| static std::string phi2_path; | ||
| if (!phi2_path.empty()) { | ||
| return phi2_path; | ||
| } | ||
|
|
||
| std::vector<std::string> candidate_paths = { | ||
| MODEL_PATH "phi-2/int4/cuda", | ||
| MODEL_PATH "phi-2/int4/dml", | ||
| MODEL_PATH "phi-2/int4/webgpu", | ||
| MODEL_PATH "phi-2/int4/cpu"}; | ||
|
|
||
| for (const auto& path : candidate_paths) { | ||
| std::filesystem::path model_path(path); | ||
| if (std::filesystem::exists(model_path / "genai_config.json")) { | ||
| phi2_path = path; | ||
| return phi2_path; | ||
| } | ||
| } | ||
|
qjia7 marked this conversation as resolved.
|
||
|
|
||
| // Fallback to CPU path | ||
| phi2_path = MODEL_PATH "phi-2/int4/cpu"; | ||
| return phi2_path; | ||
| } | ||
|
|
||
| // Helper to detect if we're using WebGPU or DML EP based on the model path | ||
| inline bool IsEngineTestsEnabled() { | ||
| #if TEST_PHI2 | ||
| std::string path = GetPhi2Path(); | ||
| // Skip engine tests for DML and WebGPU (batching not fully tested) | ||
| return path.find("/dml") == std::string::npos && | ||
| path.find("/webgpu") == std::string::npos; | ||
| #else | ||
| return false; | ||
| #endif | ||
| } | ||
|
|
||
| } // namespace test_utils | ||
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.