Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
bd63893
add back the scripts used for Update Python API Docs pipeline publish…
HectorSVC Apr 15, 2025
b1bad30
Merge branch 'main' of https://github.com/microsoft/onnxruntime
HectorSVC Apr 18, 2025
68cb0ca
Merge branch 'main' of https://github.com/microsoft/onnxruntime
HectorSVC Apr 28, 2025
90365c5
build Qnn nuget package with arm64x setting
HectorSVC Apr 28, 2025
4f9529f
move the copying of Qnn SDK dependencies from test_all project to pro…
HectorSVC Apr 28, 2025
0abb5e6
update the Qnn Nuget build pipeline: remove parameters not used, remo…
HectorSVC Apr 28, 2025
9a9bfc8
remove steps not required anymore
HectorSVC Apr 28, 2025
f830003
increase timeout
HectorSVC Apr 28, 2025
7eac3d8
add --enable_generic_interface to DML Nuget package build
HectorSVC Apr 28, 2025
01a02c7
update the publish steps
HectorSVC Apr 29, 2025
a5f8b32
update dml package to include onnxruntime_providers_shared.dll
HectorSVC Apr 29, 2025
2c5be99
update dml build stage to copy onnxruntime_providers_shared.dll to th…
HectorSVC Apr 29, 2025
72219c4
format
HectorSVC Apr 29, 2025
c732892
fix for qnn ep static lib build
HectorSVC Apr 29, 2025
46b3505
Merge branch 'qnn_nuget_arm64x' of https://github.com/microsoft/onnxr…
HectorSVC Apr 29, 2025
ac7d682
update custom nuget package pipeline for Qnn part
HectorSVC Apr 30, 2025
2669ee5
increase timeout
HectorSVC Apr 30, 2025
8e76bab
remove enable_generic_interface from Qnn Nuget package build
HectorSVC Apr 30, 2025
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
40 changes: 35 additions & 5 deletions cmake/onnxruntime_providers_qnn.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
onnxruntime_add_include_to_target(onnxruntime_providers_qnn onnxruntime_common onnxruntime_framework onnx
onnx_proto protobuf::libprotobuf-lite
flatbuffers::flatbuffers Boost::mp11
nlohmann_json::nlohmann_json)
nlohmann_json::nlohmann_json)
add_dependencies(onnxruntime_providers_qnn onnx ${onnxruntime_EXTERNAL_DEPENDENCIES})
set_target_properties(onnxruntime_providers_qnn PROPERTIES CXX_STANDARD_REQUIRED ON)
set_target_properties(onnxruntime_providers_qnn PROPERTIES FOLDER "ONNXRuntime")
Expand All @@ -36,6 +36,21 @@
if(NOT MSVC)
target_compile_options(onnxruntime_providers_qnn PRIVATE "-Wno-unknown-pragmas")
endif()

set(onnxruntime_providers_qnn_target onnxruntime_providers_qnn)

if (MSVC OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
add_custom_command(
TARGET ${onnxruntime_providers_qnn_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${QNN_LIB_FILES} $<TARGET_FILE_DIR:${onnxruntime_providers_qnn_target}>
)
endif()
if (EXISTS "${onnxruntime_QNN_HOME}/Qualcomm AI Hub Proprietary License.pdf")
add_custom_command(
TARGET ${onnxruntime_providers_qnn_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${onnxruntime_QNN_HOME}/Qualcomm AI Hub Proprietary License.pdf" $<TARGET_FILE_DIR:${onnxruntime_providers_qnn_target}>
)
endif()
else()
#
# Build QNN EP as a shared library
Expand All @@ -46,13 +61,13 @@
"${ONNXRUNTIME_ROOT}/core/providers/shared_library/*.cc"
)
set(onnxruntime_providers_qnn_srcs ${onnxruntime_providers_qnn_ep_srcs}
${onnxruntime_providers_qnn_shared_lib_srcs})
${onnxruntime_providers_qnn_shared_lib_srcs})

source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_qnn_srcs})
onnxruntime_add_shared_library_module(onnxruntime_providers_qnn ${onnxruntime_providers_qnn_srcs})
onnxruntime_add_include_to_target(onnxruntime_providers_qnn ${ONNXRUNTIME_PROVIDERS_SHARED} ${GSL_TARGET} onnx
onnxruntime_common Boost::mp11 safeint_interface
nlohmann_json::nlohmann_json)
onnxruntime_common Boost::mp11 safeint_interface
nlohmann_json::nlohmann_json)
target_link_libraries(onnxruntime_providers_qnn PRIVATE ${ONNXRUNTIME_PROVIDERS_SHARED} ${ABSEIL_LIBS} ${CMAKE_DL_LIBS})
add_dependencies(onnxruntime_providers_qnn onnxruntime_providers_shared ${onnxruntime_EXTERNAL_DEPENDENCIES})
target_include_directories(onnxruntime_providers_qnn PRIVATE ${ONNXRUNTIME_ROOT}
Expand Down Expand Up @@ -90,4 +105,19 @@
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

set(onnxruntime_providers_qnn_target onnxruntime_providers_qnn)

if (MSVC OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
add_custom_command(
TARGET ${onnxruntime_providers_qnn_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${QNN_LIB_FILES} $<TARGET_FILE_DIR:${onnxruntime_providers_qnn_target}>
)
endif()
if (EXISTS "${onnxruntime_QNN_HOME}/Qualcomm AI Hub Proprietary License.pdf")
add_custom_command(
TARGET ${onnxruntime_providers_qnn_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${onnxruntime_QNN_HOME}/Qualcomm AI Hub Proprietary License.pdf" $<TARGET_FILE_DIR:${onnxruntime_providers_qnn_target}>
)
endif()
endif()
15 changes: 0 additions & 15 deletions cmake/onnxruntime_unittests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1075,21 +1075,6 @@ if (NOT onnxruntime_ENABLE_TRAINING_TORCH_INTEROP)
)
endif()

if (onnxruntime_USE_QNN)
if (MSVC OR ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
add_custom_command(
TARGET ${test_data_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${QNN_LIB_FILES} $<TARGET_FILE_DIR:${test_data_target}>
)
endif()
if (EXISTS "${onnxruntime_QNN_HOME}/Qualcomm AI Hub Proprietary License.pdf")
add_custom_command(
TARGET ${test_data_target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${onnxruntime_QNN_HOME}/Qualcomm AI Hub Proprietary License.pdf" $<TARGET_FILE_DIR:${test_data_target}>
)
endif()
endif()

if (onnxruntime_USE_DNNL)
if(onnxruntime_DNNL_GPU_RUNTIME STREQUAL "ocl" AND onnxruntime_DNNL_OPENCL_ROOT STREQUAL "")
message(FATAL_ERROR "--dnnl_opencl_root required")
Expand Down
103 changes: 103 additions & 0 deletions csharp/src/Microsoft.ML.OnnxRuntime/targets/netstandard/props_qnn.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)../../build/native/include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)../../build/native/include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>

<ItemDefinitionGroup Condition="'$(PlatformTarget)' == 'ARM64'">
<Link>
<AdditionalDependencies>$(MSBuildThisFileDirectory)../../runtimes/win-arm64x/native/onnxruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>

<ItemDefinitionGroup Condition="'$(PlatformTarget)' == 'ARM'">
<Link>
<AdditionalDependencies>$(MSBuildThisFileDirectory)../../runtimes/win-arm/native/onnxruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>

<ItemDefinitionGroup Condition="'$(PlatformTarget)' == 'x64' OR ('$(PlatformTarget)' == 'AnyCPU' AND '$(Prefer32Bit)' != 'true')">
<Link>
<AdditionalDependencies>$(MSBuildThisFileDirectory)../../runtimes/win-arm64x/native/onnxruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>

<ItemDefinitionGroup Condition="'$(PlatformTarget)' == 'x86' OR ('$(PlatformTarget)' == 'AnyCPU' AND '$(Prefer32Bit)' == 'true')">
<Link>
<AdditionalDependencies>$(MSBuildThisFileDirectory)../../runtimes/win-x86/native/onnxruntime.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>

<PropertyGroup>
<EnginePlatform Condition="'$(Platform)' == 'Win32'">x86</EnginePlatform>
<EnginePlatform Condition="'$(Platform)' == 'ARM64'">arm64x</EnginePlatform>
<EnginePlatform Condition="'$(Platform)' == 'ARM'">arm</EnginePlatform>
<EnginePlatform Condition="'$(Platform)' != 'Win32' AND '$(Platform)' != 'ARM64'">$(Platform)</EnginePlatform>
</PropertyGroup>

<PropertyGroup>
<OnnxRuntimeBinary>$(MSBuildThisFileDirectory)..\..\runtimes\win-$(EnginePlatform)\native\onnxruntime.dll</OnnxRuntimeBinary>
</PropertyGroup>

<ItemGroup>
<!-- x64 -->
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-arm64x\native\onnxruntime.dll"
Condition="('$(PlatformTarget)' == 'x64' OR ('$(PlatformTarget)' == 'AnyCPU' AND '$(Prefer32Bit)' != 'true')) AND
Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-arm64x\native\onnxruntime.dll')">
<Link>onnxruntime.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-arm64x\native\onnxruntime_providers_shared.dll"
Condition="('$(PlatformTarget)' == 'x64' OR ('$(PlatformTarget)' == 'AnyCPU' AND '$(Prefer32Bit)' != 'true')) AND
Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-arm64x\native\onnxruntime_providers_shared.dll')">
<Link>onnxruntime_providers_shared.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>

<!-- arm64 -->
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-arm64x\native\onnxruntime.dll"
Condition="'$(PlatformTarget)' == 'ARM64'">
<Link>onnxruntime.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-arm64x\native\onnxruntime_providers_shared.dll"
Condition="'$(PlatformTarget)' == 'ARM64' AND
Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-arm64x\native\onnxruntime_providers_shared.dll')">
<Link>onnxruntime_providers_shared.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>

<!-- arm -->
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-arm\native\onnxruntime.dll"
Condition="'$(PlatformTarget)' == 'ARM'">
<Link>onnxruntime.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-arm\native\onnxruntime_providers_shared.dll"
Condition="'$(PlatformTarget)' == 'ARM' AND
Exists('$(MSBuildThisFileDirectory)..\..\runtimes\win-arm\native\onnxruntime_providers_shared.dll')">
<Link>onnxruntime_providers_shared.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>

<!-- x86 -->
<None Include="$(MSBuildThisFileDirectory)..\..\runtimes\win-x86\native\onnxruntime.dll"
Condition="('$(PlatformTarget)' == 'x86' OR ('$(PlatformTarget)' == 'AnyCPU' AND '$(Prefer32Bit)' == 'true'))">
<Link>onnxruntime.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</None>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ extends:
IsReleaseBuild: ${{ parameters.IsReleaseBuild }}
ArtifactName: 'drop-nuget-dml'
StageName: 'Windows_CI_GPU_DML_Dev'
BuildCommand: --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --enable_onnx_tests --enable_wcos --use_telemetry --use_dml --build_nodejs --cmake_generator "Visual Studio 17 2022" --use_vcpkg --use_vcpkg_ms_internal_asset_cache
BuildCommand: --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --enable_onnx_tests --enable_wcos --use_telemetry --use_dml --enable_generic_interface --build_nodejs --cmake_generator "Visual Studio 17 2022" --use_vcpkg --use_vcpkg_ms_internal_asset_cache
BuildArch: 'x64'
msbuildArchitecture: 'amd64'
EnvSetupScript: 'setup_env.bat'
Expand All @@ -199,7 +199,7 @@ extends:
IsReleaseBuild: ${{ parameters.IsReleaseBuild }}
ArtifactName: 'drop-win-dml-x86-zip'
StageName: 'Windows_CI_GPU_DML_Dev_x86'
BuildCommand: --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --enable_onnx_tests --enable_wcos --use_telemetry --use_dml --cmake_generator "Visual Studio 17 2022" --use_vcpkg --use_vcpkg_ms_internal_asset_cache
BuildCommand: --build_dir $(Build.BinariesDirectory) --skip_submodule_sync --build_shared_lib --enable_onnx_tests --enable_wcos --use_telemetry --use_dml --enable_generic_interface --cmake_generator "Visual Studio 17 2022" --use_vcpkg --use_vcpkg_ms_internal_asset_cache
BuildArch: 'x86'
EnvSetupScript: 'setup_env_x86.bat'
sln_platform: 'Win32'
Expand All @@ -220,7 +220,7 @@ extends:
IsReleaseBuild: ${{ parameters.IsReleaseBuild }}
ArtifactName: 'drop-win-dml-arm64-zip'
StageName: 'Windows_CI_GPU_DML_Dev_arm64'
BuildCommand: --build_dir $(Build.BinariesDirectory) --arm64 --skip_submodule_sync --build_shared_lib --enable_onnx_tests --enable_wcos --use_telemetry --use_dml --build_nodejs --cmake_generator "Visual Studio 17 2022" --use_vcpkg --use_vcpkg_ms_internal_asset_cache
BuildCommand: --build_dir $(Build.BinariesDirectory) --arm64 --skip_submodule_sync --build_shared_lib --enable_onnx_tests --enable_wcos --use_telemetry --use_dml --enable_generic_interface --build_nodejs --cmake_generator "Visual Studio 17 2022" --use_vcpkg --use_vcpkg_ms_internal_asset_cache
BuildArch: 'x64'
EnvSetupScript: 'setup_env.bat'
sln_platform: 'arm64'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ extends:
DoEsrp: true
ArtifactName: 'drop-nuget-qnn-arm64'
# Add --use_webgpu to enable WebGPU
buildParameter: '--arm64'
buildPlatform: 'ARM64'
buildArch: 'ARM64'
StageName: 'OnnxRuntime_QNN_Nuget_Win_Arm64'
build_config: 'RelWithDebInfo'
PublishArchive: true
Expand Down Expand Up @@ -105,7 +102,7 @@ extends:
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - managed nuget'
inputs:
artifactName: 'drop-nuget-qnn-arm64'
artifactName: 'drop-signed-nuget-qnn'
targetPath: '$(Build.BinariesDirectory)/managed-nuget'

- task: DownloadPipelineArtifact@0
Expand All @@ -117,7 +114,7 @@ extends:
- task: DownloadPipelineArtifact@0
displayName: 'Download Pipeline Artifact - win-arm64'
inputs:
artifactName: 'onnxruntime-win-ARM64-qnn'
artifactName: 'onnxruntime-win-arm64x-qnn'
targetPath: '$(Build.BinariesDirectory)/win-arm64'

- task: DownloadPipelineArtifact@0
Expand Down Expand Up @@ -180,13 +177,13 @@ extends:
targetType: 'inline'
script: |
Expand-Archive -Path $(Build.BinariesDirectory)/win-x64/onnxruntime-win-x64-cuda*.zip -DestinationPath $(Build.BinariesDirectory)/win-x64
Expand-Archive -Path $(Build.BinariesDirectory)/win-arm64/onnxruntime-win-ARM64-qnn*.zip -DestinationPath $(Build.BinariesDirectory)/win-arm64
Expand-Archive -Path $(Build.BinariesDirectory)/win-arm64/onnxruntime-win-arm64x-qnn*.zip -DestinationPath $(Build.BinariesDirectory)/win-arm64
$osx_x64_archive = (Get-ChildItem -Path $(Build.BinariesDirectory)/osx-x64 -Filter onnxruntime-osx-x86_64*)[0].FullName
$osx_arm64_archive = (Get-ChildItem -Path $(Build.BinariesDirectory)/osx-arm64 -Filter onnxruntime-osx-arm64*)[0].FullName
tar -xzf $osx_x64_archive -C $(Build.BinariesDirectory)/osx-x64 2>$null
tar -xzf $osx_arm64_archive -C $(Build.BinariesDirectory)/osx-arm64 2>$null
$win_x64 = (Get-ChildItem -Path $(Build.BinariesDirectory)/win-x64 -Filter onnxruntime-win-x64-cuda*)[0].FullName
$win_arm64 = (Get-ChildItem -Path $(Build.BinariesDirectory)/win-arm64 -Filter onnxruntime-win-ARM64-qnn*)[0].FullName
$win_arm64 = (Get-ChildItem -Path $(Build.BinariesDirectory)/win-arm64 -Filter onnxruntime-win-arm64x-qnn*)[0].FullName
$osx_x64 = (Get-ChildItem -Path $(Build.BinariesDirectory)/osx-x64 -Filter onnxruntime-osx-x86_64*)[0].FullName
$osx_arm64 = (Get-ChildItem -Path $(Build.BinariesDirectory)/osx-arm64 -Filter onnxruntime-osx-arm64*)[0].FullName
Write-Host "##vso[task.setvariable variable=win_x64;]$win_x64"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,27 +53,10 @@ extends:
QnnSdk: ${{ parameters.QnnSdk }}
IsReleaseBuild: ${{ parameters.IsReleaseBuild }}
DoEsrp: ${{ parameters.DoEsrp }}
ArtifactName: 'drop-nuget-qnn-x64'
StageName: 'OnnxRuntime_QNN_Nuget_Win_x64'
ArtifactName: 'drop-nuget-qnn-arm64x'
StageName: 'OnnxRuntime_QNN_Nuget_Win_Arm64x'
build_config: ${{ parameters.build_config }}

- template: templates/qnn-ep-win.yml
parameters:
qnn_ep_build_pool_name: 'Onnxruntime-QNNEP-Windows-2022-CPU'
QnnSdk: ${{ parameters.QnnSdk }}
IsReleaseBuild: ${{ parameters.IsReleaseBuild }}
DoEsrp: ${{ parameters.DoEsrp }}
ArtifactName: 'drop-nuget-qnn-arm64'
buildParameter: '--arm64'
buildPlatform: 'ARM64'
buildArch: 'ARM64'
StageName: 'OnnxRuntime_QNN_Nuget_Win_Arm64'
build_config: ${{ parameters.build_config }}

- template: stages/nuget-qnn-packaging-stage.yml
parameters:
DoEsrp: ${{ parameters.DoEsrp }}

- template: templates/publish-nuget-steps.yml
parameters:
download_artifacts_steps:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ stages:
move win-x86\runtimes\win-x86\native\onnxruntime.dll %%~ni\runtimes\win-x86\native\onnxruntime.dll
move win-x86\runtimes\win-x86\native\onnxruntime.lib %%~ni\runtimes\win-x86\native\onnxruntime.lib
move win-x86\runtimes\win-x86\native\onnxruntime.pdb %%~ni\runtimes\win-x86\native\onnxruntime.pdb
move win-x86\runtimes\win-x86\native\onnxruntime_providers_shared.dll %%~ni\runtimes\win-x86\native\onnxruntime_providers_shared.dll

unzip win-dml-arm64.zip -d win-arm64
mkdir %%~ni\runtimes\win-arm64
Expand All @@ -63,6 +64,7 @@ stages:
move win-arm64\runtimes\win-arm64\native\onnxruntime.dll %%~ni\runtimes\win-arm64\native\onnxruntime.dll
move win-arm64\runtimes\win-arm64\native\onnxruntime.lib %%~ni\runtimes\win-arm64\native\onnxruntime.lib
move win-arm64\runtimes\win-arm64\native\onnxruntime.pdb %%~ni\runtimes\win-arm64\native\onnxruntime.pdb
move win-arm64\runtimes\win-arm64\native\onnxruntime_providers_shared.dll %%~ni\runtimes\win-arm64\native\onnxruntime_providers_shared.dll


pushd %%~ni
Expand Down
Loading
Loading