Skip to content

Commit 935d426

Browse files
Add ort_build_version and ort_build_source parameters to nuget and python packaging pipelines, remove ROCm support (#2049)
- [x] Add `ort_build_version` and `ort_build_source` pipeline parameters plumbed through nuget/python packaging pipelines - [x] Fix empty string defaults — changed `ort_build_version` default to `'default'` sentinel value - [x] Add `ort_build_source` parameter (`NuGet`/`Ort-Nightly`) with NuGet as default - [x] Implement ORT NuGet download + extraction in shared Windows/Linux/macOS packaging steps - [x] Remove ROCm from packaging pipelines, cmake, build scripts, Python packaging, presets, and source code - [x] Fix macOS osx Python packaging job incorrectly nested under ROCm conditional → now gated on `enable_macos_cpu` - [x] Remove remaining rocm include and dispatch table entry from `src/models/session_options.cpp` - [x] Harden ORT download: add `--fail --retry 5 --retry-all-errors` to curl (Linux/macOS), `-ErrorAction Stop` and stale dir cleanup to PowerShell (Windows) <!-- START COPILOT CODING AGENT TIPS --> --- 💬 Send tasks to Copilot coding agent from [Slack](https://gh.io/cca-slack-docs) and [Teams](https://gh.io/cca-teams-docs) to turn conversations into code. Copilot posts an update in your thread when it's finished. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com>
1 parent 8a31d02 commit 935d426

26 files changed

+316
-232
lines changed

.pipelines/nuget-publishing.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,19 @@ parameters:
103103
- dev
104104
- stable
105105

106+
- name: ort_build_version
107+
displayName: 'OnnxRuntime nightly version for build-time compilation (e.g., 1.25.0-dev-20260125-1205-727db0d3dc). Leave as ''default'' to use the default version in ortlib.cmake.'
108+
type: string
109+
default: 'default'
110+
111+
- name: ort_build_source
112+
displayName: 'Package source for build-time ORT download. NuGet uses nuget.org, Ort-Nightly uses the ADO nightly feed.'
113+
type: string
114+
default: 'NuGet'
115+
values:
116+
- 'NuGet'
117+
- 'Ort-Nightly'
118+
106119
- name: custom_ort_package_versioned_name
107120
displayName: 'Versioned name of ort nuget package. Must follow Microsoft.ML.OnnxRuntime.*.version.nupkg. Keep None to disable building'
108121
type: string
@@ -153,6 +166,8 @@ extends:
153166
build_config: ${{ parameters.build_config }}
154167
enable_winml: ${{ parameters.enable_winml }}
155168
ort_winml_version: ${{ parameters.ort_winml_version }}
169+
ort_build_version: ${{ parameters.ort_build_version }}
170+
ort_build_source: ${{ parameters.ort_build_source }}
156171

157172
- template: stages/nuget-packaging-stage.yml
158173
parameters:

.pipelines/pypl-publishing.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ parameters:
3434
type: boolean
3535
default: true
3636

37-
- name: enable_linux_rocm
38-
displayName: 'Whether Linux ROCm package is built.'
39-
type: boolean
40-
default: false
41-
4237
- name: enable_macos_cpu
4338
displayName: 'Whether MacOS CPU package is built.'
4439
type: boolean
@@ -67,6 +62,19 @@ parameters:
6762
- 'relwithdebinfo'
6863
- 'debug'
6964

65+
- name: ort_build_version
66+
displayName: 'OnnxRuntime nightly version for build-time compilation (e.g., 1.25.0-dev-20260125-1205-727db0d3dc). Leave as ''default'' to use the default version in ortlib.cmake.'
67+
type: string
68+
default: 'default'
69+
70+
- name: ort_build_source
71+
displayName: 'Package source for build-time ORT download. NuGet uses nuget.org, Ort-Nightly uses the ADO nightly feed.'
72+
type: string
73+
default: 'NuGet'
74+
values:
75+
- 'NuGet'
76+
- 'Ort-Nightly'
77+
7078
resources:
7179
repositories:
7280
- repository: 1esPipelines
@@ -98,7 +106,6 @@ extends:
98106
parameters:
99107
enable_linux_cpu: ${{ parameters.enable_linux_cpu }}
100108
enable_linux_cuda: ${{ parameters.enable_linux_cuda }}
101-
enable_linux_rocm: ${{ parameters.enable_linux_rocm }}
102109
enable_win_cpu: ${{ parameters.enable_win_cpu }}
103110
enable_win_cuda: ${{ parameters.enable_win_cuda }}
104111
enable_win_dml: ${{ parameters.enable_win_dml }}
@@ -111,6 +118,8 @@ extends:
111118
ort_version: ${{ parameters.ort_winml_version }}
112119
${{ else }}:
113120
ort_version: '' # Not used for non winml builds.
121+
ort_build_version: ${{ parameters.ort_build_version }}
122+
ort_build_source: ${{ parameters.ort_build_source }}
114123

115124
- ${{ if eq(parameters.enable_post_packaging_validation, true) }}:
116125
- template: stages/py-validation-stage.yml

.pipelines/stages/capi-packaging-stage.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ parameters:
3333
default: 'release'
3434
- name: ort_winml_version
3535
type: string
36+
- name: ort_build_version
37+
type: string
38+
default: 'default'
39+
- name: ort_build_source
40+
type: string
41+
default: 'NuGet'
3642

3743
stages:
3844
- stage: capi_packaging
@@ -68,6 +74,8 @@ stages:
6874
os: 'win'
6975
build_config: ${{ parameters.build_config }}
7076
enable_winml: ${{ parameters.enable_winml }}
77+
ort_build_version: ${{ parameters.ort_build_version }}
78+
ort_build_source: ${{ parameters.ort_build_source }}
7179

7280
- ${{ if and(eq(parameters.enable_win_arm64, true), eq(parameters.enable_win_cpu, true)) }}:
7381
- template: jobs/capi-packaging-job.yml
@@ -78,6 +86,8 @@ stages:
7886
os: 'win'
7987
build_config: ${{ parameters.build_config }}
8088
enable_winml: ${{ parameters.enable_winml }}
89+
ort_build_version: ${{ parameters.ort_build_version }}
90+
ort_build_source: ${{ parameters.ort_build_source }}
8191

8292
- ${{ if and(eq(parameters.enable_win_cpu, true), eq(parameters.enable_win_dml, true)) }}:
8393
- template: jobs/capi-packaging-job.yml
@@ -88,6 +98,8 @@ stages:
8898
os: 'win'
8999
build_config: ${{ parameters.build_config }}
90100
enable_winml: ${{ parameters.enable_winml }}
101+
ort_build_version: ${{ parameters.ort_build_version }}
102+
ort_build_source: ${{ parameters.ort_build_source }}
91103

92104
- ${{ if and(eq(parameters.enable_win_arm64, true), eq(parameters.enable_win_dml, true)) }}:
93105
- template: jobs/capi-packaging-job.yml
@@ -98,6 +110,8 @@ stages:
98110
os: 'win'
99111
build_config: ${{ parameters.build_config }}
100112
enable_winml: ${{ parameters.enable_winml }}
113+
ort_build_version: ${{ parameters.ort_build_version }}
114+
ort_build_source: ${{ parameters.ort_build_source }}
101115

102116
- ${{ if eq(parameters.enable_win_cuda, true) }}:
103117
- template: jobs/capi-packaging-job.yml
@@ -109,6 +123,8 @@ stages:
109123
os: 'win'
110124
build_config: ${{ parameters.build_config }}
111125
enable_winml: ${{ parameters.enable_winml }}
126+
ort_build_version: ${{ parameters.ort_build_version }}
127+
ort_build_source: ${{ parameters.ort_build_source }}
112128

113129
- ${{ if eq(parameters.enable_linux_cpu, true) }}:
114130
- template: jobs/capi-packaging-job.yml
@@ -119,6 +135,8 @@ stages:
119135
os: 'linux'
120136
build_config: ${{ parameters.build_config }}
121137
enable_winml: ${{ parameters.enable_winml }}
138+
ort_build_version: ${{ parameters.ort_build_version }}
139+
ort_build_source: ${{ parameters.ort_build_source }}
122140

123141
- ${{ if eq(parameters.enable_linux_cuda, true) }}:
124142
- template: jobs/capi-packaging-job.yml
@@ -130,6 +148,8 @@ stages:
130148
os: 'linux'
131149
build_config: ${{ parameters.build_config }}
132150
enable_winml: ${{ parameters.enable_winml }}
151+
ort_build_version: ${{ parameters.ort_build_version }}
152+
ort_build_source: ${{ parameters.ort_build_source }}
133153

134154
- ${{ if eq(parameters.enable_macos_cpu, true) }}:
135155
- template: jobs/capi-packaging-job.yml
@@ -140,6 +160,8 @@ stages:
140160
os: 'osx'
141161
build_config: ${{ parameters.build_config }}
142162
enable_winml: ${{ parameters.enable_winml }}
163+
ort_build_version: ${{ parameters.ort_build_version }}
164+
ort_build_source: ${{ parameters.ort_build_source }}
143165

144166
- ${{ if eq(parameters.enable_android, true) }}:
145167
- template: jobs/android-java-api-aar.yml

.pipelines/stages/jobs/capi-packaging-job.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ parameters:
2020
default: 'release'
2121
- name: enable_winml
2222
type: boolean
23+
- name: ort_build_version
24+
type: string
25+
default: 'default'
26+
- name: ort_build_source
27+
type: string
28+
default: 'NuGet'
2329

2430
jobs:
2531
- job: capi_${{ parameters.os }}_${{ parameters.ep }}_${{ parameters.arch }}_packaging
@@ -74,6 +80,8 @@ jobs:
7480
value: ${{ parameters.os }}
7581
- name: feed_name
7682
value: '7982ae20-ed19-4a35-a362-a96ac99897b7'
83+
- name: ORT_HOME_CMAKE_ARG
84+
value: ''
7785

7886
workspace:
7987
clean: all
@@ -102,6 +110,8 @@ jobs:
102110
arch: ${{ parameters.arch }}
103111
ep: ${{ parameters.ep }}
104112
build_config: ${{ parameters.build_config }}
113+
ort_build_version: ${{ parameters.ort_build_version }}
114+
ort_build_source: ${{ parameters.ort_build_source }}
105115

106116
- ${{ if eq(parameters.os, 'win') }}:
107117
- template: steps/capi-win-step.yml
@@ -111,6 +121,8 @@ jobs:
111121
ep: ${{ parameters.ep }}
112122
build_config: ${{ parameters.build_config }}
113123
enable_winml: ${{ parameters.enable_winml }}
124+
ort_build_version: ${{ parameters.ort_build_version }}
125+
ort_build_source: ${{ parameters.ort_build_source }}
114126

115127
- ${{ if eq(parameters.os, 'osx') }}:
116128
- template: steps/capi-macos-step.yml
@@ -119,6 +131,8 @@ jobs:
119131
arch: ${{ parameters.arch }}
120132
ep: ${{ parameters.ep }}
121133
build_config: ${{ parameters.build_config }}
134+
ort_build_version: ${{ parameters.ort_build_version }}
135+
ort_build_source: ${{ parameters.ort_build_source }}
122136

123137
- ${{ if eq(parameters.os, 'ios') }}:
124138
- template: steps/capi-appleframework-step.yml

.pipelines/stages/jobs/py-packaging-job.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ parameters:
3131
- name: ort_version
3232
type: string
3333

34+
- name: ort_build_version
35+
type: string
36+
default: 'default'
37+
- name: ort_build_source
38+
type: string
39+
default: 'NuGet'
40+
3441
jobs:
3542
- job: python_${{ parameters.os }}_${{ parameters.ep }}${{ parameters.cuda_display_version }}_${{ parameters.arch }}_packaging
3643
${{ if eq(parameters.os, 'linux') }}:
@@ -120,6 +127,8 @@ jobs:
120127

121128
- name: feed_name
122129
value: '7982ae20-ed19-4a35-a362-a96ac99897b7'
130+
- name: ORT_HOME_CMAKE_ARG
131+
value: ''
123132

124133
steps:
125134
- script: |
@@ -166,6 +175,8 @@ jobs:
166175
arch: ${{ parameters.arch }}
167176
ep: ${{ parameters.ep }}
168177
build_config: ${{ parameters.build_config }}
178+
ort_build_version: ${{ parameters.ort_build_version }}
179+
ort_build_source: ${{ parameters.ort_build_source }}
169180

170181
# Windows job needs to set the python version and install the required packages
171182
- ${{ if eq(parameters.os, 'win') }}:
@@ -176,6 +187,8 @@ jobs:
176187
ep: ${{ parameters.ep }}
177188
build_config: ${{ parameters.build_config }}
178189
enable_winml: ${{ parameters.enable_winml }}
190+
ort_build_version: ${{ parameters.ort_build_version }}
191+
ort_build_source: ${{ parameters.ort_build_source }}
179192

180193
- ${{ if eq(parameters.os, 'osx') }}:
181194
- template: steps/capi-macos-step.yml
@@ -184,6 +197,8 @@ jobs:
184197
arch: ${{ parameters.arch }}
185198
ep: ${{ parameters.ep }}
186199
build_config: ${{ parameters.build_config }}
200+
ort_build_version: ${{ parameters.ort_build_version }}
201+
ort_build_source: ${{ parameters.ort_build_source }}
187202

188203
- template: steps/compliant-and-cleanup-step.yml
189204

.pipelines/stages/jobs/steps/capi-linux-step.yml

Lines changed: 73 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ parameters:
1010
- name: build_config
1111
type: string
1212
default: 'release'
13+
- name: ort_build_version
14+
type: string
15+
default: 'default'
16+
- name: ort_build_source
17+
type: string
18+
default: 'NuGet'
1319

1420
steps:
1521

@@ -82,6 +88,71 @@ steps:
8288
displayName: 'Set CMake Extra Args'
8389
workingDirectory: '$(Build.Repository.LocalPath)'
8490

91+
- ${{ if ne(parameters.ort_build_version, 'default') }}:
92+
- bash: |
93+
set -e -x
94+
ep="$(ep)"
95+
arch="$(arch)"
96+
97+
# Determine package name
98+
case "$ep" in
99+
"cuda") package_name="Microsoft.ML.OnnxRuntime.Gpu.Linux" ;;
100+
*) package_name="Microsoft.ML.OnnxRuntime" ;;
101+
esac
102+
103+
org_name="aiinfra"
104+
feed_project="2692857e-05ef-43b4-ba9c-ccf1c22c437c"
105+
feed_id="7982ae20-ed19-4a35-a362-a96ac99897b7"
106+
version="${{ parameters.ort_build_version }}"
107+
108+
source="${{ parameters.ort_build_source }}"
109+
if [ "$source" = "Ort-Nightly" ]; then
110+
url="https://pkgs.dev.azure.com/${org_name}/${feed_project}/_apis/packaging/feeds/${feed_id}/nuget/packages/${package_name}/versions/${version}/content?api-version=6.0-preview.1"
111+
else
112+
url="https://www.nuget.org/api/v2/package/${package_name}/${version}"
113+
fi
114+
115+
echo "Downloading $package_name version $version"
116+
download_path="$(Agent.TempDirectory)/ort_build_pkg.zip"
117+
curl --fail --retry 5 --retry-all-errors -L -o "$download_path" "$url"
118+
119+
if [ ! -s "$download_path" ]; then
120+
echo "Error: Downloaded ORT package is missing or empty at $download_path"
121+
exit 1
122+
fi
123+
124+
extract_path="$(Agent.TempDirectory)/ort_build_extracted"
125+
mkdir -p "$extract_path"
126+
unzip -o "$download_path" -d "$extract_path"
127+
128+
ort_home="$(Build.Repository.LocalPath)/ort_build"
129+
mkdir -p "$ort_home/include"
130+
mkdir -p "$ort_home/lib"
131+
132+
# Copy headers
133+
# CUDA packages store headers in buildTransitive/native/include, while other
134+
# ORT packages (CPU) use build/native/include per NuGet package layout.
135+
if [ "$ep" = "cuda" ]; then
136+
cp -r "$extract_path/buildTransitive/native/include/"* "$ort_home/include/"
137+
else
138+
cp -r "$extract_path/build/native/include/"* "$ort_home/include/"
139+
fi
140+
141+
# Copy libraries
142+
platform="linux-x64"
143+
if [ "$arch" = "arm64" ]; then
144+
platform="linux-arm64"
145+
fi
146+
cp -r "$extract_path/runtimes/$platform/native/"* "$ort_home/lib/"
147+
148+
echo "ORT_HOME: $ort_home"
149+
ls -la "$ort_home/include/"
150+
ls -la "$ort_home/lib/"
151+
# Inside Docker, the path is /ort_genai_src/ort_build
152+
echo "##vso[task.setvariable variable=ORT_HOME_CMAKE_ARG]-DORT_HOME=/ort_genai_src/ort_build"
153+
displayName: 'Download ORT build package ${{ parameters.ort_build_version }}'
154+
workingDirectory: '$(Build.Repository.LocalPath)'
155+
85156
- ${{ if eq(parameters.target, 'onnxruntime-genai') }}:
86157
- script: |
87158
set -e -x
@@ -91,7 +162,7 @@ steps:
91162
-w /ort_genai_src/ ortgenai$(ep)build$(arch) \
92163
bash -c " \
93164
/usr/bin/cmake --preset linux_gcc_$(ep)_$(build_config) \
94-
-DENABLE_TESTS=OFF -DENABLE_PYTHON=OFF $(CMAKE_EXTRA_ARGS) && \
165+
-DENABLE_TESTS=OFF -DENABLE_PYTHON=OFF $(CMAKE_EXTRA_ARGS) $(ORT_HOME_CMAKE_ARG) && \
95166
/usr/bin/cmake --build --preset linux_gcc_$(ep)_$(build_config) \
96167
--target onnxruntime-genai"
97168
displayName: 'Build GenAi'
@@ -136,7 +207,7 @@ steps:
136207
-DENABLE_TESTS=OFF \
137208
-DMANYLINUX=ON \
138209
-DPYTHON_EXECUTABLE=/opt/python/cp$(PyNoDotVer)-cp$(PyNoDotVer)/bin/python$(PyDotVer) \
139-
$(CMAKE_EXTRA_ARGS) && \
210+
$(CMAKE_EXTRA_ARGS) $(ORT_HOME_CMAKE_ARG) && \
140211
/usr/bin/cmake --build --preset linux_gcc_$(ep)_$(build_config) \
141212
--target python"
142213
displayName: 'Build Python $(PyNoDotVer)'

0 commit comments

Comments
 (0)