Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/linux_minimal_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20

- uses: microsoft/onnxruntime-github-actions/[email protected]
with:
vcpkg-version: '2025.06.13'
Expand Down
89 changes: 31 additions & 58 deletions java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ plugins {
id 'signing'
id 'jacoco'
id "com.diffplug.spotless" version "6.25.0"
id "net.linguica.maven-settings" version "0.5"
}

allprojects {
Expand All @@ -14,17 +13,9 @@ allprojects {
}

project.group = "com.microsoft.onnxruntime"
version = rootProject.file('../VERSION_NUMBER').text.trim()

// cmake runs will inform us of the build directory of the current run
def cmakeBuildDir = System.properties['cmakeBuildDir']
def useCUDA = System.properties['USE_CUDA']
def useROCM = System.properties['USE_ROCM']

def adoArtifact = project.findProperty('adoArtifact')
def adoAccessToken = project.findProperty('adoAccessToken')
// Only publish to ADO feed if all two properties are set
def publishToAdo = adoArtifact != null && adoAccessToken != null

boolean enableTrainingApis = (System.properties['ENABLE_TRAINING_APIS'] ?: "0") == "1"
def cmakeJavaDir = "${cmakeBuildDir}/java"
Expand All @@ -33,21 +24,14 @@ def cmakeNativeJniDir = "${cmakeJavaDir}/native-jni"
def cmakeNativeTestDir = "${cmakeJavaDir}/native-test"
def cmakeBuildOutputDir = "${cmakeJavaDir}/build"

def mavenUser = System.properties['mavenUser']
def mavenPwd = System.properties['mavenPwd']

def tmpArtifactId = enableTrainingApis ? project.name + "-training" : project.name
def mavenArtifactId = (useCUDA == null && useROCM == null) ? tmpArtifactId : tmpArtifactId + "_gpu"
def mavenArtifactId = (useCUDA == null) ? tmpArtifactId : tmpArtifactId + "_gpu"

def defaultDescription = 'ONNX Runtime is a performance-focused inference engine for ONNX (Open Neural Network Exchange) models.'
def trainingDescription = 'ONNX Runtime Training is a training and inference package for ONNX ' +
'(Open Neural Network Exchange) models. This package is targeted for Learning on The Edge aka On-Device Training ' +
'See https://github.com/microsoft/onnxruntime-training-examples/tree/master/on_device_training for more details.'

// We need to have a custom settings.xml so codeql can bypass the need for settings.security.xml
mavenSettings {
userSettingsFileName = "${projectDir}/settings.xml"
}

java {
sourceCompatibility = JavaVersion.VERSION_17
Expand Down Expand Up @@ -202,16 +186,27 @@ test {
systemProperties System.getProperties().subMap([
'ENABLE_TRAINING_APIS',
'JAVA_FULL_TEST',
'USE_ACL',
'USE_ARMNN',
'USE_AZURE',
'USE_CANN',
'USE_COREML',
'USE_CUDA',
'USE_DML',
'USE_DNNL',
'USE_MIGRAPHX',
'USE_NNAPI',
'USE_NV',
'USE_OPENVINO',
'USE_ROCM',
'USE_TENSORRT',
'USE_QNN',
'USE_XNNPACK',
'USE_RKNPU',
'USE_SNPE',
'USE_TENSORRT',
'USE_VITISAI',
'USE_VSINPU',
'USE_WEBGPU',
'USE_WEBNN',
'USE_XNNPACK',
])
testLogging {
events "passed", "skipped", "failed"
Expand All @@ -233,13 +228,9 @@ publishing {
publications {
maven(MavenPublication) {
groupId = project.group
if(publishToAdo) {
artifactId = 'onnxruntime_gpu'
artifact (adoArtifact)
} else {
artifactId = mavenArtifactId
from components.java
}
artifactId = mavenArtifactId
from components.java

version = project.version
pom {
name = enableTrainingApis ? 'onnxruntime-training' : 'onnx-runtime'
Expand Down Expand Up @@ -270,42 +261,24 @@ publishing {
}
}
}
repositories {
if (publishToAdo) {
maven {
url "https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/${System.getenv('ADOFeedName')}/maven/v1"
name System.getenv('ADOFeedName')
authentication {
basic(BasicAuthentication)
}
credentials {
username 'aiinfra'
password "${project.findProperty('adoAccessToken')}"
}
}
} else {
maven {
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
credentials {
username mavenUser
password mavenPwd
}
}
}
}
}
// Generates a task signMavenPublication that will
// build all artifacts.
signing {
// Queries env vars:
// ORG_GRADLE_PROJECT_signingKey
// ORG_GRADLE_PROJECT_signingPassword but can be changed to properties
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
// Skip signing if no key is provided
if (signingKey != null && signingPassword != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.maven
sign publishing.publications.mavenAdo
}
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
// Skip signing if no key is provided
if (signingKey != null && signingPassword != null) {
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.maven
}
}

tasks.named('generatePomFileForMavenPublication') {
doFirst {
println "AGENT_LOG: Generating POM for version: ${project.version}"
}
}
18 changes: 12 additions & 6 deletions java/src/test/java/ai/onnxruntime/InferenceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -693,12 +693,6 @@ public void testCUDA() throws OrtException {
runProvider(OrtProvider.CUDA);
}

@Test
@EnabledIfSystemProperty(named = "USE_ROCM", matches = "1")
public void testROCM() throws OrtException {
runProvider(OrtProvider.ROCM);
}

@Test
@EnabledIfSystemProperty(named = "USE_TENSORRT", matches = "1")
public void testTensorRT() throws OrtException {
Expand All @@ -725,6 +719,18 @@ public void testDNNL() throws OrtException {
runProvider(OrtProvider.DNNL);
}

@Test
@EnabledIfSystemProperty(named = "USE_MIGRAPHX", matches = "1")
public void testMIGRAPHX() throws OrtException {
runProvider(OrtProvider.MI_GRAPH_X);
}

@Test
@EnabledIfSystemProperty(named = "USE_NNAPI", matches = "1")
public void testNNAPI() throws OrtException {
runProvider(OrtProvider.NNAPI);
}

@Test
@EnabledIfSystemProperty(named = "USE_XNNPACK", matches = "1")
public void testXNNPACK() throws OrtException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ parameters:
default: true

stages:

# build binaries for Android
- ${{ if parameters.BuildAndroidBinaries }}:
- stage: BuildAndroidBinaries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,29 +122,23 @@ extends:
PreReleaseVersionSuffixString: ${{ parameters.PreReleaseVersionSuffixString }}
PreReleaseVersionSuffixNumber: ${{ parameters.PreReleaseVersionSuffixNumber }}

- template: stages/download-java-tools-stage.yml

- template: templates/c-api-cpu.yml
parameters:
RunOnnxRuntimeTests: ${{ parameters.RunOnnxRuntimeTests }}
IsReleaseBuild: ${{ parameters.IsReleaseBuild }}
PreReleaseVersionSuffixString: ${{ parameters.PreReleaseVersionSuffixString }}
PreReleaseVersionSuffixNumber: ${{ parameters.PreReleaseVersionSuffixNumber }}
${{ if eq(parameters.NugetPackageSuffix, 'NONE') }}:
OrtNugetPackageId: 'Microsoft.ML.OnnxRuntime'
${{ else }}:
OrtNugetPackageId: 'Microsoft.ML.OnnxRuntime${{ parameters.NugetPackageSuffix }}'
AdditionalBuildFlags: ''
AdditionalWinBuildFlags: '--enable_onnx_tests ${{parameters.AdditionalBuildFlag}}'
BuildVariant: 'default'
SpecificArtifact: ${{ parameters.SpecificArtifact }}
BuildId: ${{ parameters.BuildId }}
QnnSDKVersion: ${{ parameters.QnnSdk }}
is1ES: true

- template: stages/java-cuda-packaging-stage.yml
parameters:
CudaVersion: 12.2
SpecificArtifact: ${{ parameters.SpecificArtifact }}
BuildId: ${{ parameters.BuildId }}

- template: stages/nuget-combine-cuda-stage.yml
parameters:
Expand All @@ -159,6 +153,8 @@ extends:
buildNodejs: true
SpecificArtifact: ${{ parameters.SpecificArtifact }}
BuildId: ${{ parameters.BuildId }}
PreReleaseVersionSuffixString: ${{ parameters.PreReleaseVersionSuffixString }}
PreReleaseVersionSuffixNumber: ${{ parameters.PreReleaseVersionSuffixNumber }}

- template: stages/nodejs-win-packaging-stage.yml
parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ stages:
artifact: 'Windows_Packaging_cuda_build_artifacts'
displayName: 'Download Windows GPU Packages Build'

- template: templates/setup-build-tools.yml

- task: CmdLine@2
inputs:
script: |
Expand All @@ -188,17 +190,6 @@ stages:
jdkArchitectureOption: x64
jdkSourceOption: 'PreInstalled'

- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
addToPath: true
architecture: x64

- task: PipAuthenticate@1
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: 'Lotus'

- task: PythonScript@0
displayName: 'Update CTest Path References'
inputs:
Expand All @@ -207,10 +198,6 @@ stages:
"$(Build.BinariesDirectory)/RelWithDebInfo/CTestTestfile.cmake"
"$(Build.BinariesDirectory)/RelWithDebInfo"

- task: NodeTool@0
inputs:
versionSpec: '22.x'

- template: templates/jobs/download_win_gpu_library.yml
parameters:
CudaVersion: 12.2
Expand All @@ -223,12 +210,6 @@ stages:
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
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'
workingDirectory: '$(Build.BinariesDirectory)'
# Previous stage only assembles the java binaries, testing will be done in this stage with GPU machine
- template: templates/make_java_win_binaries.yml
parameters:
msbuildPlatform: x64
java_artifact_id: onnxruntime_gpu
buildOnly: false

- stage: Windows_Packaging_Tensorrt_Testing
dependsOn: Setup
Expand All @@ -242,12 +223,13 @@ stages:
- checkout: self
clean: true
submodules: none



- download: build
artifact: 'Windows_Packaging_tensorrt_build_artifacts'
displayName: 'Download Windows GPU Packages Build'

- template: templates/setup-build-tools.yml

- task: CmdLine@2
inputs:
script: |
Expand All @@ -260,18 +242,7 @@ stages:
versionSpec: "17"
jdkArchitectureOption: x64
jdkSourceOption: 'PreInstalled'

- task: UsePythonVersion@0
inputs:
versionSpec: '3.12'
addToPath: true
architecture: x64

- task: PipAuthenticate@1
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: 'Lotus'


- task: PythonScript@0
displayName: 'Update CTest Path References'
inputs:
Expand All @@ -280,10 +251,6 @@ stages:
"$(Build.BinariesDirectory)/RelWithDebInfo/CTestTestfile.cmake"
"$(Build.BinariesDirectory)/RelWithDebInfo"

- task: NodeTool@0
inputs:
versionSpec: '22.x'

- template: templates/jobs/download_win_gpu_library.yml
parameters:
CudaVersion: 12.2
Expand All @@ -295,10 +262,4 @@ stages:
inputs:
scriptPath: '$(Build.SourcesDirectory)\tools\ci_build\build.py'
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'
workingDirectory: '$(Build.BinariesDirectory)'
# Previous stage only assembles the java binaries, testing will be done in this stage with GPU machine
- template: templates/make_java_win_binaries.yml
parameters:
msbuildPlatform: x64
java_artifact_id: onnxruntime_gpu
buildOnly: false
workingDirectory: '$(Build.BinariesDirectory)'
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,9 @@ extends:
buildNodejs: false
SpecificArtifact: ${{ parameters.SpecificArtifact }}
BuildId: ${{ parameters.BuildId }}
PreReleaseVersionSuffixString: ${{ parameters.PreReleaseVersionSuffixString }}
PreReleaseVersionSuffixNumber: ${{ parameters.PreReleaseVersionSuffixNumber }}

- template: stages/download-java-tools-stage.yml

- template: stages/java-cuda-packaging-stage.yml
parameters:
CudaVersion: ${{ parameters.CudaVersion }}
SpecificArtifact: ${{ parameters.SpecificArtifact }}
BuildId: ${{ parameters.BuildId }}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ extends:

- template: templates/win-ci.yml
parameters:
PreReleaseVersionSuffixString: ${{ parameters.PreReleaseVersionSuffixString }}
PreReleaseVersionSuffixNumber: ${{ parameters.PreReleaseVersionSuffixNumber }}
ort_build_pool_name: 'onnxruntime-Win2022-GPU-A10'
DoCompliance: false
DoEsrp: true
Expand Down Expand Up @@ -124,7 +126,6 @@ extends:
- template: templates/mac-cpu-packaging-pipeline.yml
parameters:
AllowReleasedOpsetOnly: 1
BuildForAllArchs: true
AdditionalBuildFlags: '--use_webgpu --skip_tests'
DoEsrp: true

Expand Down
Loading
Loading