Skip to content

Commit b3bb3ca

Browse files
committed
.github - actions
1 parent 204bedc commit b3bb3ca

5 files changed

Lines changed: 117 additions & 67 deletions

File tree

.github/workflows/win-cuda-x64-build.yml

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Windows CUDA x64 Build"
1+
name: "Windows WinML x64 Build"
22
on:
33
workflow_dispatch:
44
push:
@@ -53,24 +53,6 @@ jobs:
5353
with:
5454
dotnet-version: '8.0.x'
5555

56-
- name: Download OnnxRuntime Nightly
57-
shell: pwsh
58-
run: |
59-
$resp = Invoke-RestMethod "${{ env.ORT_NIGHTLY_REST_API }}"
60-
$ORT_NIGHTLY_VERSION = $resp.value[0].versions[0].normalizedVersion
61-
Write-Host "$ORT_NIGHTLY_VERSION"
62-
"ORT_NIGHTLY_VERSION=$ORT_NIGHTLY_VERSION" | Out-File -FilePath $env:GITHUB_ENV -Append
63-
nuget install ${{ env.ORT_PACKAGE_NAME }} -version $ORT_NIGHTLY_VERSION -ExcludeVersion -NonInteractive
64-
65-
- run: Get-ChildItem ${{ env.ORT_PACKAGE_NAME }} -Recurse
66-
continue-on-error: true
67-
68-
- name: Extract OnnxRuntime library and header files
69-
run: |
70-
mkdir ort/lib
71-
move ${{ env.ORT_PACKAGE_NAME }}/buildTransitive/native/include ort/
72-
move ${{ env.ORT_PACKAGE_NAME }}/runtimes/win-x64/native/* ort/lib/
73-
7456
- name: Install Rust Toolchain
7557
run: |
7658
$exePath = "$env:TEMP\rustup-init.exe"
@@ -80,12 +62,12 @@ jobs:
8062
8163
- name: Configure CMake
8264
run: |
83-
cmake --preset windows_x64_cuda_release -T cuda=${{ env.cuda_dir }}\\v${{ env.cuda_version }}
65+
cmake --preset windows_x64_winml_relwithdebinfo -T cuda=${{ env.cuda_dir }}\\v${{ env.cuda_version }} -DWINML_SDK_VERSION=1.8.1078-preview-genai
8466
8567
- name: Build with CMake
8668
run: |
87-
cmake --build --preset windows_x64_cuda_release --parallel
88-
cmake --build --preset windows_x64_cuda_release --target PyPackageBuild
69+
cmake --build --preset windows_x64_winml_relwithdebinfo --parallel
70+
cmake --build --preset windows_x64_winml_relwithdebinfo --target PyPackageBuild
8971
9072
- name: Add CUDA to PATH
9173
run: |
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: "Windows CUDA x64 Build"
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
- rel-*
8+
pull_request:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.sha }}
12+
cancel-in-progress: true
13+
14+
env:
15+
AZCOPY_AUTO_LOGIN_TYPE: MSI
16+
AZCOPY_MSI_CLIENT_ID: 63b63039-6328-442f-954b-5a64d124e5b4
17+
cuda_dir: "${{ github.workspace }}\\cuda_sdk"
18+
cuda_version: "12.2"
19+
CUDA_PATH: ${{ github.workspace }}\\cuda_sdk\\v12.2
20+
binaryDir: 'build/cuda/win-x64'
21+
ORT_NIGHTLY_REST_API: "https://feeds.dev.azure.com/aiinfra/PublicPackages/_apis/packaging/Feeds/ORT-Nightly/packages?packageNameQuery=Microsoft.ML.OnnxRuntime.Gpu.Windows&api-version=6.0-preview.1"
22+
ORT_PACKAGE_NAME: "Microsoft.ML.OnnxRuntime.Gpu.Windows"
23+
24+
jobs:
25+
windows-cuda-x64-build:
26+
runs-on: ["self-hosted", "1ES.Pool=onnxruntime-genai-Win2022-GPU-A10"]
27+
steps:
28+
- name: Checkout OnnxRuntime GenAI repo
29+
uses: actions/checkout@v4
30+
with:
31+
submodules: true
32+
33+
- uses: actions/setup-python@v5
34+
with:
35+
python-version: '3.11.x'
36+
architecture: 'x64'
37+
38+
- name: Setup VCPKG
39+
uses: microsoft/onnxruntime-github-actions/setup-build-tools@v0.0.6
40+
with:
41+
vcpkg-version: '2025.03.19'
42+
vcpkg-hash: '17e96169cd3f266c4716fcdc1bb728e6a64f103941ece463a2834d50694eba4fb48f30135503fd466402afa139abc847ef630733c442595d1c34979f261b0114'
43+
cmake-version: '3.31.6'
44+
cmake-hash: '0f1584e8666cf4a65ec514bd02afe281caabf1d45d2c963f3151c41484f457386aa03273ab25776a670be02725354ce0b46f3a5121857416da37366342a833a0'
45+
add-cmake-to-path: 'true'
46+
disable-terrapin: 'false'
47+
48+
- name: Download cuda
49+
run: |
50+
azcopy.exe cp --recursive "https://lotusscus.blob.core.windows.net/models/cuda_sdk/v${{ env.cuda_version }}" ${{ env.cuda_dir}}
51+
52+
- uses: actions/setup-dotnet@v4
53+
with:
54+
dotnet-version: '8.0.x'
55+
56+
- name: Install Rust Toolchain
57+
run: |
58+
$exePath = "$env:TEMP\rustup-init.exe"
59+
(New-Object Net.WebClient).DownloadFile('https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe', $exePath)
60+
& $exePath -y --default-toolchain=1.86.0
61+
Add-Content $env:GITHUB_PATH "$env:USERPROFILE\.cargo\bin"
62+
63+
- name: Configure CMake
64+
run: |
65+
cmake --preset windows_x64_winml_relwithdebinfo -T cuda=${{ env.cuda_dir }}\\v${{ env.cuda_version }} -DWINML_SDK_VERSION=1.8.1078-preview-genai
66+
67+
- name: Build with CMake
68+
run: |
69+
cmake --build --preset windows_x64_winml_relwithdebinfo --parallel
70+
cmake --build --preset windows_x64_winml_relwithdebinfo --target PyPackageBuild
71+
72+
- name: Add CUDA to PATH
73+
run: |
74+
echo "${{ env.cuda_dir }}\\v${{ env.cuda_version }}\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
75+
76+
- name: Install the Python Wheel and Test Dependencies
77+
run: |
78+
python -m pip install -r test\python\requirements.txt
79+
python -m pip install -r test\python\cuda\torch\requirements.txt
80+
python -m pip install -r test\python\cuda\ort\requirements.txt
81+
python -m pip install (Get-ChildItem ("$env:binaryDir\wheel\*.whl")) --no-deps
82+
83+
- name: Run the Python Tests
84+
run: |
85+
python test/python/test_onnxruntime_genai.py --cwd "test\python" --test_models "test\test_models" --e2e
86+
87+
- name: Verify Build Artifacts
88+
if: always()
89+
continue-on-error: true
90+
run: |2
91+
92+
Get-ChildItem -Path $env:GITHUB_WORKSPACE\$env:binaryDir -Recurse
93+
94+
- name: Build the C# API and Run the C# Tests
95+
run: |
96+
$env:PATH = "${{ env.cuda_dir }}\\v${{ env.cuda_version }}\\bin;" + $env:PATH
97+
cd test\csharp
98+
dotnet test /p:Configuration=release /p:NativeBuildOutputDir="$env:GITHUB_WORKSPACE\$env:binaryDir\Release" /p:OrtLibDir="$env:GITHUB_WORKSPACE\ort\lib"
99+
100+
- name: Prepend CUDA to PATH and Run tests
101+
run: |-
102+
$env:PATH = "${{ env.cuda_dir }}\\v${{ env.cuda_version }}\\bin;" + $env:PATH
103+
echo "Current PATH variable is: $env:PATH"
104+
copy $env:GITHUB_WORKSPACE\ort\lib\* .\$env:binaryDir\Release
105+
& .\$env:binaryDir\Release\unit_tests.exe

.winml/README-WCR-GENAI.md

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,12 @@ https://microsoft.visualstudio.com/ProjectOxford/_wiki/wikis/ProjectOxford.wiki/
55
## NUGET
66

77
1. Find the latest version you want to use.
8-
https://microsoft.visualstudio.com/ProjectOxford/_artifacts/feed/windows-aifabric/NuGet/Microsoft.WindowsAppSDK.ML/overview/1.8.1058-experimental
8+
https://microsoft.visualstudio.com/ProjectOxford/_artifacts/feed/windows-aifabric/NuGet/Microsoft.WindowsAppSDK.ML/overview/1.8.1078-preview
99

10-
2. Update CMakeList.txt with the version.
10+
2. Set the version or update the pipeline.
1111

12-
install_nuget_package(
13-
Microsoft.WindowsAppSDK.ML
14-
1.8.1065-experimental
15-
WINML_ROOT)
16-
17-
3. TODO: Make this a variable and pass it in from the build.
12+
[nuget - ort_winml_version](/.pipelines/nuget-publishing.yml)
13+
[python - ort_winml_version](/.pipelines/pypl-publishing.yml)
1814

1915
## WCR Official Build
2016

@@ -23,39 +19,14 @@ https://microsoft.visualstudio.com/ProjectOxford/_artifacts/feed/windows-aifabri
2319
- [win-genai-nuget-publishing](https://aiinfra.visualstudio.com/ONNX%20Runtime/_build?definitionId=1938)
2420
- [win-genai-python-publishing](https://aiinfra.visualstudio.com/ONNX%20Runtime/_build?definitionId=1964)
2521

26-
### NUGET_PAT_WCR
27-
28-
The WSSI artifact feed is where all the WinML stuff lives. Sadly this is in another org and so we need a way to 'cross' the streams. Today we need to do this with a user PAT, which can only live for 7 days.
29-
30-
Here are the steps to generate your own PAT and update the pipeline variables to unblock a build.
31-
32-
1. Navigate tohttps://dev.azure.com/WSSI/, click on the user menu (top right), and select Personal access key.
33-
![Personal access tokens](.readme-assets/images/PAT-step-1.png)
34-
35-
2. Create a token with Packaging - Read & Write permissions. `NUGET_PAT_WCR` is the recomended name, but is complety arbitrary.
36-
![Create personal access token with Packaging - Read & Write permissions](.readme-assets/images/PAT-step-2.png)
37-
38-
3. Navigate to one of the two pipeines, e.g. https://aiinfra.visualstudio.com/ONNX%20Runtime/_build?definitionId=1964, and select *edit*.
39-
![Navigate to pipeline](.readme-assets/images/NUGET_PAT_WCR-step-1.png)
40-
41-
4. Select *variables*.
42-
![Select variables button](.readme-assets/images/NUGET_PAT_WCR-step-2.png)
43-
44-
5. Select the `NUGET_PAT_WCR` variable
45-
![Select variable NUGET_PAT_WCR](.readme-assets/images/NUGET_PAT_WCR-step-3.png)
46-
47-
5. Update the value with your PAT, OK and save.
48-
![Select variables button](.readme-assets/images/NUGET_PAT_WCR-step-4.png)
49-
50-
Note: Some times it can take 30-45s to update the PAT, so a bit of patience is advised.
51-
5222
## ATTIC
5323

5424
## CMake
5525

5626
```bash
5727

58-
cmake --build --preset windows_x64_cpu_relwithdebinfo --target onnxruntime-genai
59-
cmake --preset windows_x64_cpu_relwithdebinfo
28+
cmake --preset windows_arm64_winml_relwithdebinfo -DWINML_SDK_VERSION=1.8.1078-preview-genai
29+
30+
cmake --build --preset windows_arm64_winml_relwithdebinfo --target onnxruntime-genai
6031

6132
```
Binary file not shown.

nuget.config

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3-
<solution>
4-
<add key="disableSourceControlIntegration" value="true" />
5-
</solution>
6-
<packageRestore>
7-
<!--Allow NuGet to download missing packages -->
8-
<add key="enabled" value="True" />
9-
<!-- Automatically check for missing packages during build in Visual Studio -->
10-
<add key="automatic" value="True" />
11-
</packageRestore>
123
<packageSources>
134
<clear/>
145
<add key="ORT-Nightly" value="https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/ORT-Nightly/nuget/v3/index.json" />
6+
<add key="localpackages" value=".\.winml\localpackages" />
157
</packageSources>
168
</configuration>

0 commit comments

Comments
 (0)