diff --git a/cmake/external/dml.cmake b/cmake/external/dml.cmake index af1e5c940f..49a2d7a144 100644 --- a/cmake/external/dml.cmake +++ b/cmake/external/dml.cmake @@ -20,18 +20,18 @@ if (NOT onnxruntime_USE_CUSTOM_DIRECTML) set(NUGET_CONFIG ${PROJECT_SOURCE_DIR}/../NuGet.config) set(PACKAGES_CONFIG ${PROJECT_SOURCE_DIR}/../packages.config) get_filename_component(PACKAGES_DIR ${CMAKE_CURRENT_BINARY_DIR}/../packages ABSOLUTE) - set(DML_PACKAGE_DIR ${PACKAGES_DIR}/DirectML.1.3.0) + set(DML_PACKAGE_DIR ${PACKAGES_DIR}/Microsoft.AI.DirectML.1.4.0) set(DML_SHARED_LIB DirectML.dll) # Restore nuget packages, which will pull down the DirectML redist package add_custom_command( - OUTPUT ${DML_PACKAGE_DIR}/bin/x64/DirectML.lib ${DML_PACKAGE_DIR}/bin/x86/DirectML.lib + OUTPUT ${DML_PACKAGE_DIR}/bin/x64-win/DirectML.lib ${DML_PACKAGE_DIR}/bin/x86-win/DirectML.lib DEPENDS ${PACKAGES_CONFIG} ${NUGET_CONFIG} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/nuget/src/nuget restore ${PACKAGES_CONFIG} -PackagesDirectory ${PACKAGES_DIR} -ConfigFile ${NUGET_CONFIG} VERBATIM) include_directories(BEFORE "${DML_PACKAGE_DIR}/include") - add_custom_target(RESTORE_PACKAGES ALL DEPENDS ${DML_PACKAGE_DIR}/bin/x64/DirectML.lib ${DML_PACKAGE_DIR}/bin/x86/DirectML.lib) + add_custom_target(RESTORE_PACKAGES ALL DEPENDS ${DML_PACKAGE_DIR}/bin/x64-win/DirectML.lib ${DML_PACKAGE_DIR}/bin/x86-win/DirectML.lib) add_dependencies(RESTORE_PACKAGES nuget) else() include_directories(${dml_INCLUDE_DIR}) diff --git a/cmake/onnxruntime_providers.cmake b/cmake/onnxruntime_providers.cmake index 4692dfd4de..2afa476a44 100644 --- a/cmake/onnxruntime_providers.cmake +++ b/cmake/onnxruntime_providers.cmake @@ -776,7 +776,7 @@ if (onnxruntime_USE_DML) add_custom_command(TARGET onnxruntime_providers_dml POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${DML_PACKAGE_DIR}/bin/${onnxruntime_target_platform}/${file}" $) + "${DML_PACKAGE_DIR}/bin/${onnxruntime_target_platform}-win/${file}" $) endforeach() endif() @@ -785,8 +785,8 @@ if (onnxruntime_USE_DML) target_link_libraries(${target} PRIVATE DirectML) else() add_dependencies(${target} RESTORE_PACKAGES) - target_link_libraries(${target} PRIVATE "${DML_PACKAGE_DIR}/bin/${onnxruntime_target_platform}/DirectML.lib") - target_compile_definitions(${target} PRIVATE DML_TARGET_VERSION_USE_LATEST) + target_link_libraries(${target} PRIVATE "${DML_PACKAGE_DIR}/bin/${onnxruntime_target_platform}-win/DirectML.lib") + target_compile_definitions(${target} PRIVATE DML_TARGET_VERSION_USE_LATEST) endif() endfunction() diff --git a/cmake/onnxruntime_python.cmake b/cmake/onnxruntime_python.cmake index 81088e9b49..5fbfa3fdfb 100644 --- a/cmake/onnxruntime_python.cmake +++ b/cmake/onnxruntime_python.cmake @@ -396,7 +396,7 @@ if (onnxruntime_USE_DML) add_custom_command( TARGET onnxruntime_pybind11_state POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy - ${DML_PACKAGE_DIR}/bin/${onnxruntime_target_platform}/${DML_SHARED_LIB} + ${DML_PACKAGE_DIR}/bin/${onnxruntime_target_platform}-win/${DML_SHARED_LIB} $/onnxruntime/capi/ ) endif() diff --git a/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.targets b/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.targets index 74a611d67f..68a53643b5 100644 --- a/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.targets +++ b/csharp/src/Microsoft.AI.MachineLearning.Interop/Microsoft.AI.MachineLearning.targets @@ -13,17 +13,6 @@ $(MSBuildThisFileDirectory)..\..\runtimes\win-$(WindowsAI-Platform)\native $(RuntimesDirectory)\Microsoft.AI.MachineLearning.dll $(RuntimesDirectory)\onnxruntime.dll - $(RuntimesDirectory)\directml.dll - - - - $(WindowsAIBinary);$(OnnxRuntimeBinary);$(DirectMLBinary) - - - $(WindowsAIBinary);$(OnnxRuntimeBinary);$(DirectMLBinary) - - - $(WindowsAIBinary);$(OnnxRuntimeBinary) @@ -31,6 +20,6 @@ Binplacing WindowsAI binaries: {0} and {1}. - + diff --git a/csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.Rules.Project.xml b/csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.Rules.Project.xml index 7492025563..6e1599f102 100644 --- a/csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.Rules.Project.xml +++ b/csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.Rules.Project.xml @@ -13,11 +13,6 @@ Description="Suppresses binplacing the onnxruntime.dll from the Mirosoft.AI.MachineLearning NuGet distribution." Category="General" /> - - + + + + true + true + true + diff --git a/csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.targets b/csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.targets index 4f43996fc9..bfecff8c98 100644 --- a/csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.targets +++ b/csharp/src/Microsoft.AI.MachineLearning/Microsoft.AI.MachineLearning.targets @@ -15,25 +15,14 @@ $(RuntimesDirectory)\$(WindowsAIBinarySubfolder)onnxruntime.dll - - - $(RuntimesDirectory)\directml.dll - $(WindowsAIBinary) - - - $(WindowsAIBinary);$(OnnxRuntimeBinary);$(DirectMLBinary) - - - $(WindowsAIBinary);$(OnnxRuntimeBinary) - - + diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj b/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj index cf650200d0..803e191181 100644 --- a/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj +++ b/csharp/src/Microsoft.ML.OnnxRuntime/Microsoft.ML.OnnxRuntime.csproj @@ -113,14 +113,6 @@ CopyToOutputDirectory="Always" Visible="false" /> - $(MSBuildThisFileDirectory)..\..\runtimes\win-$(EnginePlatform)\native\onnxruntime.dll - $(MSBuildThisFileDirectory)..\..\runtimes\win-$(EnginePlatform)\native\directml.dll + + + + + true + true + true diff --git a/docs/execution_providers/DirectML-ExecutionProvider.md b/docs/execution_providers/DirectML-ExecutionProvider.md index f74fb45acd..3a1c7b5292 100644 --- a/docs/execution_providers/DirectML-ExecutionProvider.md +++ b/docs/execution_providers/DirectML-ExecutionProvider.md @@ -6,7 +6,7 @@ When used standalone, the DirectML API is a low-level DirectX 12 library and is The *DirectML Execution Provider* is an optional component of ONNX Runtime that uses DirectML to accelerate inference of ONNX models. The DirectML execution provider is capable of greatly improving evaluation time of models using commodity GPU hardware, without sacrificing broad hardware support or requiring vendor-specific extensions to be installed. -The DirectML Execution Provider currently uses DirectML version 1.3.0. +The DirectML Execution Provider currently uses DirectML version 1.4.0. ## Table of contents @@ -15,11 +15,12 @@ The DirectML Execution Provider currently uses DirectML version 1.3.0. - [Minimum requirements](#minimum-requirements) - [Building from source](#building-from-source) - [Using the DirectML execution provider](#using-the-directml-execution-provider) - - [`OrtSessionOptionsAppendExecutionProvider_DML` function](#ortsessionoptionsappendexecutionproviderdml-function) - - [`OrtSessionOptionsAppendExecutionProviderEx_DML` function](#ortsessionoptionsappendexecutionproviderexdml-function) + - [`OrtSessionOptionsAppendExecutionProvider_DML` function](#ortsessionoptionsappendexecutionprovider_dml-function) + - [`OrtSessionOptionsAppendExecutionProviderEx_DML` function](#ortsessionoptionsappendexecutionproviderex_dml-function) - [ONNX opset support](#onnx-opset-support) - [Multi-threading and supported session options](#multi-threading-and-supported-session-options) - [Samples](#samples) + - [Performance best practices](#performance-best-practices) - [See also](#see-also) ## Minimum requirements diff --git a/packages.config b/packages.config index 6fce6d078a..cf2b71e61a 100644 --- a/packages.config +++ b/packages.config @@ -1,5 +1,5 @@  - + diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/gpu.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/gpu.yml index 5ade2044cb..d694d2c846 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/gpu.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/gpu.yml @@ -200,8 +200,6 @@ jobs: 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\directml.dll %%~ni\runtimes\win-x86\native\DirectML.dll - move win-x86\runtimes\win-x86\native\directml.pdb %%~ni\runtimes\win-x86\native\DirectML.pdb pushd %%~ni zip -r ..\%%~ni.zip . diff --git a/tools/ci_build/github/azure-pipelines/nuget/templates/windowsai.yml b/tools/ci_build/github/azure-pipelines/nuget/templates/windowsai.yml index 8ff5811300..417138d94d 100644 --- a/tools/ci_build/github/azure-pipelines/nuget/templates/windowsai.yml +++ b/tools/ci_build/github/azure-pipelines/nuget/templates/windowsai.yml @@ -363,7 +363,6 @@ jobs: Copy-Item ([System.IO.Path]::Combine($x86_runtime_path_old, 'onnxruntime.lib')) $x86_runtime_path_new Copy-Item ([System.IO.Path]::Combine($x86_runtime_path_old, 'microsoft.ai.machinelearning.dll')) $x86_runtime_path_new Copy-Item ([System.IO.Path]::Combine($x86_runtime_path_old, 'microsoft.ai.machinelearning.lib')) $x86_runtime_path_new - Copy-Item ([System.IO.Path]::Combine($x86_runtime_path_old, 'directml.dll')) $x86_runtime_path_new Copy-Item ([System.IO.Path]::Combine($arm64_runtime_path_old, 'onnxruntime.dll')) $arm64_runtime_path_new Copy-Item ([System.IO.Path]::Combine($arm64_runtime_path_old, 'onnxruntime.lib')) $arm64_runtime_path_new diff --git a/tools/nuget/generate_nuspec_for_native_nuget.py b/tools/nuget/generate_nuspec_for_native_nuget.py index aa74ccb82a..75b4e3d44c 100644 --- a/tools/nuget/generate_nuspec_for_native_nuget.py +++ b/tools/nuget/generate_nuspec_for_native_nuget.py @@ -76,6 +76,8 @@ def generate_repo_url(list, repo_url, commit_id): def generate_dependencies(list, package_name, version): + dml_dependency = '' + if (package_name == 'Microsoft.AI.MachineLearning'): list.append('') @@ -96,23 +98,41 @@ def generate_dependencies(list, package_name, version): list.append('') # UAP10.0.16299, This is the earliest release of the OS that supports .NET Standard apps list.append('') + list.append(dml_dependency) + list.append('') + # Support Native C++ + list.append('') + list.append(dml_dependency) list.append('') list.append('') else: + include_dml = package_name == 'Microsoft.ML.OnnxRuntime.DirectML' + list.append('') # Support .Net Core list.append('') list.append('') + if include_dml: + list.append(dml_dependency) list.append('') # Support .Net Standard list.append('') list.append('') + if include_dml: + list.append(dml_dependency) list.append('') # Support .Net Framework list.append('') list.append('') + if include_dml: + list.append(dml_dependency) list.append('') + # Support Native C++ + if include_dml: + list.append('') + list.append(dml_dependency) + list.append('') list.append('') @@ -289,14 +309,6 @@ def generate_files(list, args): 'libonnxruntime.so') + '" target="runtimes\\linux-' + args.target_architecture + '\\native" />') - if includes_directml: - files_list.append('') - files_list.append('') - files_list.append('') - if includes_winml: # Process microsoft.ai.machinelearning import lib, dll, and pdb files_list.append('