Skip to content

Commit a033ad6

Browse files
authored
Cherry-picks for ORT 1.23.0 (#25620)
This PR cherry-picks some pipeline changes from the main branch to the 1.23.0 release branch. - **[build] disable CodeQL for NPM Packaging Pipeline (#25614)** - **Refactor Java Test Pipeline (#25608)** - **[build] upgrade Node.js for NPM packaging pipeline (#25568)** And a WebGPU change: - **[webgpu] Apply Flash Attention if sliding window exceeds KV cache length (#25594)**
1 parent 0e3e1a5 commit a033ad6

18 files changed

+562
-240
lines changed

onnxruntime/contrib_ops/webgpu/bert/group_query_attention.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,12 @@ Status GroupQueryAttention::ComputeInternal(onnxruntime::webgpu::ComputeContext&
198198
Tensor* present_value = context.Output(2, present_kv_shape);
199199
parameters.past_present_share_buffer_ = present_key != nullptr && present_value != nullptr && past_key != nullptr && past_value != nullptr && past_key->DataRaw() == present_key->DataRaw() && past_value->DataRaw() == present_value->DataRaw();
200200

201+
ORT_ENFORCE(parameters.total_sequence_length_ <= parameters.seqlen_present_kv_cache_, "Total sequence length cannot be greater than the existing KV cache length.");
202+
// Use a sliding window if the total sequence exceeds the window's length.
203+
bool use_sliding_window = (local_window_size_ != -1 && local_window_size_ < parameters.total_sequence_length_);
201204
if (!do_rotary_ &&
202205
head_sink == nullptr && !use_smooth_softmax_ &&
203-
local_window_size_ == -1 &&
206+
!use_sliding_window &&
204207
CanApplyFlashAttention(attention_bias, present_key, present_value, parameters, context)) {
205208
return ApplyFlashAttention(query, key, value, attention_bias, output, past_key, present_key, past_value,
206209
present_value, parameters, context);

tools/ci_build/github/azure-pipelines/c-api-noopenmp-test-pipelines.yml

Lines changed: 17 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -121,109 +121,6 @@ stages:
121121
parameters:
122122
StageSuffix: 'macOS_CPU_x64'
123123

124-
- template: templates/final-jar-testing.yml
125-
parameters:
126-
OS: Windows
127-
PoolName: 'onnxruntime-Win-CPU-2022'
128-
129-
- template: templates/final-jar-testing.yml
130-
parameters:
131-
OS: Linux
132-
PoolName: 'onnxruntime-Ubuntu2204-AMD-CPU'
133-
134-
- template: templates/final-jar-testing.yml
135-
parameters:
136-
OS: MacOS
137-
PoolName: 'macOS-14'
138-
139-
140-
- stage: GPU_JAR_Testing
141-
dependsOn: Setup
142-
jobs:
143-
- job: Final_Jar_Testing_Windows_GPU
144-
workspace:
145-
clean: all
146-
pool: 'onnxruntime-Win2022-GPU-A10'
147-
timeoutInMinutes: 60
148-
variables:
149-
- name: runCodesignValidationInjection
150-
value: false
151-
152-
steps:
153-
- template: templates/set-version-number-variables-step.yml
154-
155-
- template: templates/jobs/download_win_gpu_library.yml
156-
parameters:
157-
CudaVersion: 12.2
158-
DownloadCUDA: true
159-
DownloadTRT: true
160-
161-
- template: templates/flex-downloadPipelineArtifact.yml
162-
parameters:
163-
StepName: 'Download Final Jar'
164-
ArtifactName: onnxruntime-java-gpu
165-
TargetPath: '$(Build.BinariesDirectory)\final-jar'
166-
167-
- template: templates/flex-downloadPipelineArtifact.yml
168-
parameters:
169-
StepName: 'Download Jar Tools'
170-
ArtifactName: onnxruntime-java-tools
171-
TargetPath: '$(Build.BinariesDirectory)\final-jar'
172-
173-
- task: CmdLine@2
174-
inputs:
175-
script: |
176-
mkdir test
177-
pushd test
178-
jar xf $(Build.BinariesDirectory)\final-jar\testing.jar
179-
popd
180-
java -DUSE_CUDA=1 -jar junit-platform-console-standalone-1.6.2.jar -cp .;.\test;protobuf-java-3.25.5.jar;onnxruntime_gpu-$(OnnxRuntimeVersion).jar --scan-class-path --fail-if-no-tests --disable-banner
181-
workingDirectory: '$(Build.BinariesDirectory)\final-jar'
182-
183-
- job: Final_Jar_Testing_Linux_GPU
184-
workspace:
185-
clean: all
186-
pool:
187-
name: 'Onnxruntime-Linux-GPU-A10'
188-
os: linux
189-
variables:
190-
- name: runCodesignValidationInjection
191-
value: false
192-
- name: docker_base_image
193-
value: onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda12_x64_almalinux8_gcc12:20250724.1
194-
timeoutInMinutes: 60
195-
steps:
196-
- checkout: self
197-
submodules: false
198-
- template: templates/set-version-number-variables-step.yml
199-
200-
- template: templates/flex-downloadPipelineArtifact.yml
201-
parameters:
202-
StepName: 'Download Final Jar'
203-
ArtifactName: onnxruntime-java-gpu
204-
TargetPath: '$(Build.BinariesDirectory)/final-jar'
205-
206-
- template: templates/get-docker-image-steps.yml
207-
parameters:
208-
Dockerfile: tools/ci_build/github/linux/docker/Dockerfile.package_ubi8_cuda_tensorrt10_0
209-
Context: tools/ci_build/github/linux/docker/
210-
DockerBuildArgs: "
211-
--build-arg BUILD_UID=$( id -u )
212-
--build-arg BASEIMAGE=${{ variables.docker_base_image }}
213-
--build-arg TRT_VERSION=${{ variables.linux_trt_version }}
214-
"
215-
Repository: onnxruntimeubi8packagestest
216-
217-
- bash: |
218-
docker run -e SYSTEM_COLLECTIONURI --rm \
219-
--gpus all \
220-
--volume $(Build.SourcesDirectory):/onnxruntime_src \
221-
--volume $(Build.BinariesDirectory):/build \
222-
--volume /data/models:/build/models:ro \
223-
onnxruntimeubi8packagestest \
224-
/bin/bash /onnxruntime_src/tools/ci_build/github/linux/java_linux_final_test.sh -r /build -v $(OnnxRuntimeVersion)
225-
displayName: 'Test'
226-
227124
- template: nuget/templates/test_win.yml
228125
parameters:
229126
AgentPool: 'onnxruntime-Win2022-GPU-A10'
@@ -274,13 +171,14 @@ stages:
274171
clean: true
275172
submodules: none
276173

277-
- template: templates/flex-downloadPipelineArtifact.yml
278-
parameters:
279-
ArtifactName: "Windows_Packaging_cuda_build_artifacts"
280-
StepName: 'Download Pipeline Artifact - Windows GPU Packages Build'
281-
TargetPath: '$(Build.BinariesDirectory)/RelWithDebInfo/'
174+
- download: build
175+
artifact: 'Windows_Packaging_cuda_build_artifacts'
176+
displayName: 'Download Windows GPU Packages Build'
282177

283-
- template: templates/telemetry-steps.yml
178+
- task: CmdLine@2
179+
inputs:
180+
script: |
181+
move $(Pipeline.Workspace)/build/Windows_Packaging_cuda_build_artifacts $(Build.BinariesDirectory)/RelWithDebInfo
284182
285183
- template: templates/set-version-number-variables-step.yml
286184

@@ -323,7 +221,7 @@ stages:
323221
displayName: 'test'
324222
inputs:
325223
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
326-
arguments: '--config RelWithDebInfo --use_binskim_compliant_compile_flags --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --enable_onnx_tests $(TelemetryOption) '
224+
arguments: '--config RelWithDebInfo --use_binskim_compliant_compile_flags --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --enable_onnx_tests'
327225
workingDirectory: '$(Build.BinariesDirectory)'
328226
# Previous stage only assembles the java binaries, testing will be done in this stage with GPU machine
329227
- template: templates/make_java_win_binaries.yml
@@ -345,13 +243,15 @@ stages:
345243
clean: true
346244
submodules: none
347245

348-
- template: templates/flex-downloadPipelineArtifact.yml
349-
parameters:
350-
ArtifactName: "Windows_Packaging_tensorrt_build_artifacts"
351-
StepName: 'Download Pipeline Artifact - Windows GPU Packages Build'
352-
TargetPath: '$(Build.BinariesDirectory)/RelWithDebInfo/'
353246

354-
- template: templates/telemetry-steps.yml
247+
- download: build
248+
artifact: 'Windows_Packaging_tensorrt_build_artifacts'
249+
displayName: 'Download Windows GPU Packages Build'
250+
251+
- task: CmdLine@2
252+
inputs:
253+
script: |
254+
move $(Pipeline.Workspace)/build/Windows_Packaging_tensorrt_build_artifacts $(Build.BinariesDirectory)/RelWithDebInfo
355255
356256
- template: templates/set-version-number-variables-step.yml
357257

@@ -394,7 +294,7 @@ stages:
394294
displayName: 'test'
395295
inputs:
396296
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
397-
arguments: '--config RelWithDebInfo --use_binskim_compliant_compile_flags --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --enable_onnx_tests $(TelemetryOption) '
297+
arguments: '--config RelWithDebInfo --use_binskim_compliant_compile_flags --enable_lto --disable_rtti --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --test --enable_onnx_tests'
398298
workingDirectory: '$(Build.BinariesDirectory)'
399299
# Previous stage only assembles the java binaries, testing will be done in this stage with GPU machine
400300
- template: templates/make_java_win_binaries.yml

tools/ci_build/github/azure-pipelines/custom-nuget-packaging-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ extends:
157157
targetType: 'inline'
158158
script: |
159159
mkdir -p $(Build.BinariesDirectory)/osx-x64
160-
Move-Item -Path $(Build.BinariesDirectory)/osx/onnxruntime-osx-x86_64* -Destination $(Build.BinariesDirectory)/osx-x64
160+
Move-Item -Path $(Build.BinariesDirectory)/osx/onnxruntime-osx-x86_64* -Destination $(Build.BinariesDirectory)/osx-x64
161161
162162
mkdir -p $(Build.BinariesDirectory)/osx-arm64
163163
Move-Item -Path $(Build.BinariesDirectory)/osx/onnxruntime-osx-arm64* -Destination $(Build.BinariesDirectory)/osx-arm64
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
resources:
2+
pipelines:
3+
- pipeline: build
4+
source: 'Zip-Nuget-Java-Nodejs Packaging Pipeline'
5+
trigger: true
6+
branch: main
7+
8+
variables:
9+
mavenVersion: '3.9.8'
10+
11+
stages:
12+
- template: templates/final-jar-testing-win.yml
13+
parameters:
14+
PoolName: 'onnxruntime-Win-CPU-2022'
15+
16+
- template: templates/final-jar-testing-linux.yml
17+
parameters:
18+
OS: Linux
19+
PoolName: 'onnxruntime-Ubuntu2204-AMD-CPU'
20+
21+
- template: templates/final-jar-testing-linux.yml
22+
parameters:
23+
OS: MacOS
24+
PoolName: 'macOS-14'
25+
26+
- stage: GPU_JAR_Testing
27+
dependsOn: []
28+
jobs:
29+
- job: Final_Jar_Testing_Windows_GPU
30+
workspace:
31+
clean: all
32+
pool: 'onnxruntime-Win2022-GPU-A10'
33+
timeoutInMinutes: 60
34+
variables:
35+
- name: runCodesignValidationInjection
36+
value: false
37+
38+
steps:
39+
- template: templates/set-version-number-variables-step.yml
40+
41+
- template: templates/jobs/download_win_gpu_library.yml
42+
parameters:
43+
CudaVersion: 12.2
44+
DownloadCUDA: true
45+
DownloadTRT: true
46+
47+
- template: templates/download_maven_for_tests.yml
48+
- download: build
49+
artifact: 'onnxruntime-java-gpu'
50+
displayName: 'Download Final Jar'
51+
- script: |
52+
move $(Pipeline.Workspace)\build\onnxruntime-java-gpu\*.jar $(Pipeline.Workspace)\build\onnxruntime-java\
53+
54+
- task: PowerShell@2
55+
displayName: 'Run Java Tests with PowerShell'
56+
inputs:
57+
targetType: 'inline'
58+
script: |
59+
# Exit script on any error
60+
$ErrorActionPreference = "Stop"
61+
62+
cd $(Pipeline.Workspace)/build/onnxruntime-java
63+
del *.asc
64+
del *.sha256
65+
del *.sha512
66+
del *.pom
67+
cd ..
68+
mkdir tests
69+
cd tests
70+
jar xf $(Pipeline.Workspace)/build/onnxruntime-java/testing.jar
71+
del $(Pipeline.Workspace)/build/onnxruntime-java/testing.jar
72+
dir $(Pipeline.Workspace)/build/tests
73+
Write-Host "Running JUnit Tests..."
74+
& java -DUSE_CUDA=1 `
75+
-cp "$(Pipeline.Workspace)\build\tests;$(Pipeline.Workspace)\build\onnxruntime-java\*" org.junit.platform.console.ConsoleLauncher --scan-classpath=$(Pipeline.Workspace)\build\tests `
76+
--fail-if-no-tests --disable-banner --reports-dir "$($env:Build_ArtifactStagingDirectory)/TestResults"
77+
78+
- task: PublishTestResults@2
79+
displayName: 'Publish Test Results'
80+
inputs:
81+
testResultsFormat: 'JUnit'
82+
testResultsFiles: '$(Build.ArtifactStagingDirectory)/TestResults/TEST-junit-jupiter.xml'
83+
failTaskOnFailedTests: true
84+
85+
86+
- job: Final_Jar_Testing_Linux_GPU
87+
workspace:
88+
clean: all
89+
pool:
90+
name: 'Onnxruntime-Linux-GPU-A10'
91+
variables:
92+
- name: runCodesignValidationInjection
93+
value: false
94+
- name: docker_base_image
95+
value: onnxruntimebuildcache.azurecr.io/internal/azureml/onnxruntime/build/cuda12_x64_almalinux8_gcc12:20250724.1
96+
timeoutInMinutes: 60
97+
steps:
98+
- checkout: self
99+
submodules: false
100+
101+
- template: templates/set-version-number-variables-step.yml
102+
103+
- bash: |
104+
sudo apt-get install -y msopenjdk-17
105+
dpkg -l msopenjdk-17
106+
107+
- bash: |
108+
echo "Downloading and installing Maven $(mavenVersion) for Linux..."
109+
MAVEN_DIR="$(Agent.TempDirectory)/apache-maven-$(mavenVersion)"
110+
# Download Maven binary
111+
wget https://archive.apache.org/dist/maven/maven-3/$(mavenVersion)/binaries/apache-maven-$(mavenVersion)-bin.tar.gz -O $(Agent.TempDirectory)/maven.tar.gz
112+
113+
# Extract to the temp directory
114+
mkdir -p ${MAVEN_DIR}
115+
tar -xzf $(Agent.TempDirectory)/maven.tar.gz -C $(Agent.TempDirectory)
116+
117+
# Add Maven's bin directory to the PATH for subsequent tasks in the job
118+
echo "##vso[task.prependpath]${MAVEN_DIR}/bin"
119+
displayName: 'Install Maven (Linux)'
120+
121+
- script: |
122+
echo "Maven is now on the PATH."
123+
mvn --version
124+
125+
- download: build
126+
artifact: 'onnxruntime-java-gpu'
127+
displayName: 'Download Final Jar'
128+
129+
# Rename the downloaded folder
130+
- script: |
131+
mv $(Pipeline.Workspace)/build/onnxruntime-java-gpu $(Pipeline.Workspace)/build/onnxruntime-java
132+
133+
- task: Maven@4
134+
displayName: 'Download Dependencies'
135+
inputs:
136+
mavenPomFile: '$(Build.SourcesDirectory)/tools/ci_build/java/pom.xml'
137+
goals: 'dependency:copy-dependencies'
138+
options: '-DoutputDirectory=$(Pipeline.Workspace)/build/onnxruntime-java'
139+
publishJUnitTestResults: false
140+
javaHomeOption: 'Path'
141+
jdkDirectory: '/usr/lib/jvm/msopenjdk-17-amd64'
142+
jdkVersionOption: 'Default'
143+
mavenVersionOption: 'Default'
144+
145+
# Now all the jars are in the $(Pipeline.Workspace)/build folder
146+
147+
- template: templates/get-docker-image-steps.yml
148+
parameters:
149+
Dockerfile: tools/ci_build/github/linux/docker/Dockerfile.package_ubi8_cuda_tensorrt10_0
150+
Context: tools/ci_build/github/linux/docker/
151+
DockerBuildArgs: "--build-arg BUILD_UID=$( id -u ) --build-arg BASEIMAGE=${{ variables.docker_base_image }} --build-arg TRT_VERSION=${{ variables.linux_trt_version }}"
152+
Repository: onnxruntimeubi8packagestest
153+
154+
- bash: |
155+
docker run --network=none --rm \
156+
--gpus all \
157+
--volume $(Build.SourcesDirectory):/onnxruntime_src \
158+
--volume $(Pipeline.Workspace)/build:/build \
159+
--volume /data/models:/build/models:ro \
160+
onnxruntimeubi8packagestest \
161+
/bin/bash /onnxruntime_src/tools/ci_build/github/linux/java_linux_final_test.sh -r /build -v $(OnnxRuntimeVersion)
162+
displayName: 'Test'

tools/ci_build/github/azure-pipelines/nodejs/templates/test.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@ steps:
44
displayName: 'Download NPM_packages'
55
artifact: 'NPM_packages'
66

7-
- script: |
8-
mv $(Pipeline.Workspace)/build/NPM_packages '$(Build.BinariesDirectory)/nodejs-artifact'
7+
8+
- task: PowerShell@2
9+
displayName: 'Move Artifact Directory'
10+
inputs:
11+
targetType: 'inline'
12+
script: |
13+
Move-Item -Path "$(Pipeline.Workspace)/build/NPM_packages" -Destination "$(Build.BinariesDirectory)/nodejs-artifact"
914
1015
- script: mkdir e2e_test
1116
workingDirectory: '$(Build.BinariesDirectory)'

tools/ci_build/github/azure-pipelines/nodejs/templates/test_macos.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ stages:
1111
clean: all
1212
timeoutInMinutes: 120
1313
pool:
14-
name: 'Azure Pipelines'
15-
image: 'macOS-15'
16-
os: 'macOS'
14+
vmImage: 'macOS-15'
1715

1816
variables:
1917
- name: OnnxRuntimeBuildDirectory

tools/ci_build/github/azure-pipelines/npm-packaging-pipeline.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ extends:
5050
sourceAnalysisPool:
5151
name: onnxruntime-Win-CPU-2022
5252
os: windows
53+
codeql:
54+
compiled:
55+
enabled: false
56+
justificationForDisabling: 'CodeQL causes the React Native Android tests to fail when trying to load Linux x64 .so'
57+
5358
stages:
5459
- template: templates/web-ci.yml
5560
parameters:

0 commit comments

Comments
 (0)