Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User/xianz/merge windowsai #2883

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
b42cb61
Packaging pipeline changes for VS 2019 (#2711)
snnn Dec 21, 2019
da03ed4
Tiny fix to codegen
snnn Nov 13, 2019
4b900dc
Simplify cache implementation and avoid static variables that may car…
Dec 21, 2019
bbe32f0
Extend DML kernels (#2641)
jeffbloo Dec 21, 2019
71940c0
Update Nuphar tutorial notebook (#2721)
Dec 23, 2019
cd6ff42
Add schema for new Qops (#2611)
askhade Dec 23, 2019
abda478
[server] Add supposed for model_name and model_version as cli paramet…
tinchi Dec 23, 2019
71ce0b8
remove 64bit warning message from python validation. (#2727)
jywu-msft Dec 24, 2019
ebf2374
MLAS: ARM64 build fix (#2734)
tracysh Dec 25, 2019
f142b68
Fix broken python docs links (#2740)
faxu Dec 25, 2019
9013fe6
Fix build on Mac OS (#2731)
tinchi Dec 26, 2019
6e4ec9b
fix ngraph wheel (#2737)
mszhanyi Dec 27, 2019
c7a9c6b
Split onnxruntime server to a separated folder (#2744)
snnn Dec 27, 2019
b40a85a
Fix build for Python 3.8 (#2747)
kcy1019 Dec 27, 2019
90b708f
Update protobuf to 3.11.2 (#1928)
snnn Dec 28, 2019
56bb503
Change default optimization level to All (from Basic) (#2745)
askhade Dec 30, 2019
fd334af
Update numpy to 1.18 (#2758)
snnn Dec 30, 2019
382fa86
Pipeline changes for python 3.8 (#2753)
snnn Jan 2, 2020
a2c8981
Add basic stacktrace output for posix debug builds. (#2749)
skottmckay Jan 3, 2020
2096f32
[NupharEP] fix a race condition when multiple sessions running differ…
Jan 3, 2020
013642e
Revert "Change default optimization level to All (from Basic) (#2745)"
snnn Jan 3, 2020
3d75c1b
Fix typo in error message (#2736)
take-cheeze Jan 5, 2020
7666d13
Rename MKL-DNN to DNNL to fix broken link (#2730)
kcy1019 Jan 6, 2020
7ace7a5
Pass BUILD_BUILDNUMBER to linux docker
snnn Jan 3, 2020
e3f674b
Disable featurizers in python packages
snnn Jan 3, 2020
1b23118
Fix nightly build version number issue
snnn Jan 2, 2020
6f66260
Import more featurizers (#2781)
yuslepukhin Jan 6, 2020
72bdfc8
Implement a more stable softmax (#2715)
yufenglee Jan 6, 2020
f22bffe
Contributing: Fix a typo (#2784)
MaherJendoubi Jan 7, 2020
fdc0106
ACL EP GEMM improvements (#2780)
Andrews548 Jan 7, 2020
3e6f183
ACL EP convolution improvements (#2774)
Andrews548 Jan 7, 2020
ebfcad1
Add script for release Nuget validation (#2719)
hariharans29 Jan 8, 2020
f84240d
add uint8 support to where op (#2792)
ybrnathan Jan 8, 2020
32c5e76
Improve bert optimization script: (#2712)
tianleiwu Jan 8, 2020
1978376
add session creation time cost. (#2798)
jywu-msft Jan 8, 2020
2c8179b
ML.NET team needs featurizers within a package (#2789)
yuslepukhin Jan 9, 2020
71b5165
Initialize max of softmax with lowest of float (#2786)
yufenglee Jan 9, 2020
7ef6570
MLAS: update SGEMM threading parameters (#2808)
tracysh Jan 9, 2020
b0019ac
add interface to copy batch tensors. (#2807)
linkerzhang Jan 10, 2020
31200ed
speed up Windows TRT CI (#2811)
jywu-msft Jan 10, 2020
48e0428
Update test data (#2356)
snnn Jan 10, 2020
afa48b7
Add timeseries imputer transformer featurizer kernel (#2813)
yuslepukhin Jan 10, 2020
c4f6db7
Fix memory leak in TRT (#2815)
stevenlix Jan 10, 2020
e37cdbe
Add manifest missing comma
yuslepukhin Jan 10, 2020
c4e4abc
Run static code analyzer on most of our code (#2817)
snnn Jan 11, 2020
8d017f5
Scneario Test : Build Google Test and Taef Test based on preprocessor…
ryanlai2 Jan 13, 2020
cc75e5a
update quantization doc (#2783)
askhade Jan 13, 2020
6ad3e74
Filter CPU case for IsFloat16Supported (#2802)
Jan 13, 2020
7c6242b
update default optimization level + fix gemm_activation fusion (#2791)
askhade Jan 13, 2020
07502ec
Fix dnnl wheel package name (#2823)
y-wan Jan 13, 2020
723cf83
Update Ubuntu & TensorRT version in README (#2820)
Sanster Jan 13, 2020
36bc7c2
merge master
jeffbloo Jan 14, 2020
3e8768d
Merge fixes
jeffbloo Jan 14, 2020
120433c
Add OneHotEncoder and HashOneHotEncoder kernels. (#2830)
yuslepukhin Jan 14, 2020
5c39185
Upgrade gtest to the latest version (#2827)
snnn Jan 14, 2020
b308e82
Add support for int64_t for topk CPU. Fixes github issue #2806. (#2833)
pranavsharma Jan 14, 2020
98cb41a
Ignore allocator type in ExecutionProviders allocator map. Make defau…
skottmckay Jan 14, 2020
aa37dea
Convert ExternalProject Featurizers into git submodule (#2834)
yuslepukhin Jan 14, 2020
8643f3e
add domain check for nodes + update documentation (#2831)
askhade Jan 14, 2020
db05436
User/orilevari/32bit comparison warning (#2800)
Jan 8, 2020
cff266e
Fix cgmanifest.json generating script (#2770)
tiagoshibata Jan 2, 2020
dbe7d97
CMake cross-generator fixes (#2790)
tiagoshibata Jan 14, 2020
56030f8
Fix Linux CUDA nuget packaging pipeline break
snnn Jan 15, 2020
dcdebb4
Refactor WinMLAPI Tests to build both google and taef test based on p…
ryanlai2 Jan 15, 2020
39c9f98
Fix test build break since winml_lib_api needs to be statically linke…
ryanlai2 Jan 15, 2020
408e600
Enforce WINML_TEST_CLASS_BEGIN_* matches w/ a WINML_TEST_CLASS_END (#…
tiagoshibata Jan 15, 2020
5db8543
update optimization doc for BERT related fusions (#2819)
tianleiwu Jan 16, 2020
0b1b400
Merge branch 'windowsai' into jeffbloo/MergeMasterToWindowsAI
Jan 16, 2020
70523a3
Fix warnings that cause build to fail
Jan 16, 2020
928b6bb
MLAS: enable threading for quantized GEMMs (#2844)
tracysh Jan 16, 2020
45c5835
Fix test warnings and delayload linking (#2843)
tiagoshibata Jan 16, 2020
ebf7047
Merge branch 'windowsai' of https://github.com/Microsoft/onnxruntime …
Jan 16, 2020
908372b
Merge remote-tracking branch 'origin/master' into windowsai
Jan 16, 2020
650bdf9
Ortmemoryinfo struct changed
Jan 16, 2020
5d3f05d
mark the camera scenario test as edgecore because it uses d3d11 (#2852)
Jan 16, 2020
6dbfc5a
User/orilevari/pipeline fi breaks (#2853)
Jan 16, 2020
6dee13d
Remove internal libs from tests (#2864)
tiagoshibata Jan 17, 2020
93f6e3e
Support custom DML in onnxruntime_providers.cmake (#2867)
tiagoshibata Jan 18, 2020
f15e765
merge windowsai and make it build
zhangxiang1993 Jan 21, 2020
8fefe01
remove old winmladapter cpp
zhangxiang1993 Jan 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 6 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,9 @@
[submodule "cmake/external/eigen"]
path = cmake/external/eigen
url = https://github.com/eigenteam/eigen-git-mirror.git
[submodule "cmake/external/grpc"]
path = cmake/external/grpc
url = https://github.com/grpc/grpc
[submodule "cmake/external/DNNLibrary"]
path = cmake/external/DNNLibrary
url = https://github.com/JDAI-CV/DNNLibrary
[submodule "cmake/external/spdlog"]
path = cmake/external/spdlog
url = https://github.com/gabime/spdlog.git
[submodule "cmake/external/mimalloc"]
path = cmake/external/mimalloc
url = https://github.com/microsoft/mimalloc.git
Expand All @@ -49,3 +43,9 @@
[submodule "cmake/external/json"]
path = cmake/external/json
url = https://github.com/nlohmann/json
[submodule "server/external/spdlog"]
path = server/external/spdlog
url = https://github.com/gabime/spdlog.git
[submodule "cmake/external/FeaturizersLibrary"]
path = cmake/external/FeaturizersLibrary
url = https://github.com/microsoft/FeaturizersLibrary.git
6 changes: 3 additions & 3 deletions cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"component": {
"type": "git",
"git": {
"commitHash": "9bda90b7e5e08c4c37a832d0cea218aed6af6470",
"commitHash": "703bd9caab50b139428cea1aaff9974ebee5742e",
"repositoryUrl": "https://github.com/google/googletest.git"
}
}
Expand Down Expand Up @@ -247,7 +247,7 @@
"component": {
"type": "git",
"git": {
"commitHash": "48cb18e5c419ddd23d9badcfe4e9df7bde1979b2",
"commitHash": "fe1790ca0df67173702f70d5646b82f48f412b99",
"repositoryUrl": "https://github.com/protocolbuffers/protobuf.git"
}
}
Expand Down Expand Up @@ -450,7 +450,7 @@
{
"component": {
"git": {
"commitHash": "3f0f9802553944b75015aad098d856b2d17220df",
"commitHash": "ebec32ef06859b6399bf8854f18b91158c87760b",
"repositoryUrl": "https://github.com/microsoft/FeaturizersLibrary.git"
},
"type": "git"
Expand Down
23 changes: 15 additions & 8 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,7 @@ else()
string(APPEND CMAKE_C_FLAGS_RELEASE " -march=native -mtune=native")
string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO " -march=native -mtune=native")
string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO " -march=native -mtune=native")
endif()
if(onnxruntime_BUILD_x86)
set (CMAKE_SYSTEM_PROCESSOR "x86")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2 -mfpmath=sse -Wno-narrowing")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 -mfpmath=sse -Wno-narrowing")
endif()
endif()
endif()

if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
Expand Down Expand Up @@ -279,10 +274,14 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/external)


# use protobuf as a submodule
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE BOOL "Build protobuf tests" FORCE)
endif()

add_subdirectory(${PROJECT_SOURCE_DIR}/external/protobuf/cmake EXCLUDE_FROM_ALL)
set_target_properties(libprotobuf PROPERTIES FOLDER "External/Protobuf")
set_target_properties(libprotobuf-lite PROPERTIES FOLDER "External/Protobuf")
set_target_properties(libprotoc PROPERTIES FOLDER "External/Protobuf")
set_target_properties(libprotoc PROPERTIES FOLDER "External/Protobuf")
set_target_properties(protoc PROPERTIES FOLDER "External/Protobuf")
if (onnxruntime_USE_FULL_PROTOBUF)
add_library(protobuf::libprotobuf ALIAS libprotobuf)
Expand All @@ -295,7 +294,6 @@ if(UNIX AND onnxruntime_ENABLE_LTO)
#https://github.com/protocolbuffers/protobuf/issues/5923
target_link_options(protoc PRIVATE "-Wl,--no-as-needed")
endif()

include(protobuf_function.cmake)

if (onnxruntime_DISABLE_CONTRIB_OPS)
Expand Down Expand Up @@ -422,6 +420,14 @@ if (onnxruntime_USE_TVM)
list(APPEND onnxruntime_EXTERNAL_DEPENDENCIES tvm nnvm_compiler)
endif()

if (APPLE)
#onnx/onnx/proto_utils.h:34:16: error: 'SetTotalBytesLimit' is deprecated: Please use the single
#parameter version of SetTotalBytesLimit(). The second parameter is ignored.
# coded_stream.SetTotalBytesLimit((2048LL << 20) - 1, 512LL << 20);
#TODO: fix the warning in ONNX and re-enable this flag
string(APPEND CMAKE_CXX_FLAGS " -Wno-deprecated")
string(APPEND CMAKE_C_FLAGS " -Wno-deprecated")
endif()
# ONNX
add_subdirectory(onnx)

Expand Down Expand Up @@ -498,6 +504,7 @@ else()
endif()
check_cxx_compiler_flag(-Wunused-but-set-variable HAS_UNUSED_BUT_SET_VARIABLE)
check_cxx_compiler_flag(-Wunused-parameter HAS_UNUSED_PARAMETER)
check_cxx_compiler_flag(-Wunused-variable HAS_UNUSED_VARIABLE)
check_cxx_compiler_flag(-Wcast-function-type HAS_CAST_FUNCTION_TYPE)
check_cxx_compiler_flag(-Wparentheses HAS_PARENTHESES)
check_cxx_compiler_flag(-Wuseless-cast HAS_USELESS_CAST)
Expand Down
1 change: 1 addition & 0 deletions cmake/external/FeaturizersLibrary
Submodule FeaturizersLibrary added at ebec32
8 changes: 3 additions & 5 deletions cmake/external/dml.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,17 @@ if (NOT onnxruntime_USE_CUSTOM_DIRECTML)
set(NUGET_CONFIG ${PROJECT_SOURCE_DIR}/../NuGet.config)
set(PACKAGES_CONFIG ${PROJECT_SOURCE_DIR}/../packages.config)
set(PACKAGES_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages)
set(DML_PACKAGE_DIR ${PACKAGES_DIR}/DirectML.0.0.1)

# Restore nuget packages, which will pull down the DirectML redist package
add_custom_command(
OUTPUT restore_packages.stamp
OUTPUT ${DML_PACKAGE_DIR}/bin/x64/DirectML.lib ${DML_PACKAGE_DIR}/bin/x86/DirectML.lib
DEPENDS ${PACKAGES_CONFIG} ${NUGET_CONFIG}
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/nuget/src/nuget restore ${PACKAGES_CONFIG} -PackagesDirectory ${PACKAGES_DIR} -ConfigFile ${NUGET_CONFIG}
COMMAND ${CMAKE_COMMAND} -E touch restore_packages.stamp
VERBATIM)

add_custom_target(RESTORE_PACKAGES ALL DEPENDS restore_packages.stamp)
add_custom_target(RESTORE_PACKAGES ALL DEPENDS ${DML_PACKAGE_DIR}/bin/x64/DirectML.lib ${DML_PACKAGE_DIR}/bin/x86/DirectML.lib)
add_dependencies(RESTORE_PACKAGES nuget)

list(APPEND onnxruntime_EXTERNAL_DEPENDENCIES RESTORE_PACKAGES)
else()
include_directories(${dml_INCLUDE_DIR})
endif()
42 changes: 5 additions & 37 deletions cmake/external/featurizers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,17 @@
# Licensed under the MIT License.
# This source code should not depend on the onnxruntime and may be built independently

set(featurizers_URL "https://github.com/microsoft/FeaturizersLibrary.git")
set(featurizers_TAG "3f0f9802553944b75015aad098d856b2d17220df")

set(featurizers_pref FeaturizersLibrary)
set(featurizers_ROOT ${PROJECT_SOURCE_DIR}/external/${featurizers_pref})
set(featurizers_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/external/${featurizers_pref})

# Only due to GIT_CONFIG
# Uncoment UPDATE_COMMAND if you work locally
# on the featurizers so cmake does not undo your changes.
if (WIN32)
ExternalProject_Add(featurizers_lib
PREFIX ${featurizers_pref}
GIT_REPOSITORY ${featurizers_URL}
GIT_TAG ${featurizers_TAG}
# Need this to properly checkout crlf
GIT_CONFIG core.autocrlf=input
SOURCE_DIR ${featurizers_ROOT}
# Location of CMakeLists.txt
SOURCE_SUBDIR src/Featurizers
BINARY_DIR ${featurizers_BINARY_DIR}
CMAKE_ARGS -Dfeaturizers_MSVC_STATIC_RUNTIME=${onnxruntime_MSVC_STATIC_RUNTIME}
# UPDATE_COMMAND ""
INSTALL_COMMAND ""
)
else()
ExternalProject_Add(featurizers_lib
PREFIX ${featurizers_pref}
GIT_REPOSITORY ${featurizers_URL}
GIT_TAG ${featurizers_TAG}
SOURCE_DIR ${featurizers_ROOT}
# Location of CMakeLists.txt
SOURCE_SUBDIR src/Featurizers
BINARY_DIR ${featurizers_BINARY_DIR}
CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON
# UPDATE_COMMAND ""
INSTALL_COMMAND ""
)
endif()
add_subdirectory(external/FeaturizersLibrary/src/Featurizers ${featurizers_BINARY_DIR} EXCLUDE_FROM_ALL)
set_target_properties(FeaturizersCode PROPERTIES FOLDER "External/FeaturizersLibrary")

add_library(onnxruntime_featurizers STATIC IMPORTED)
add_dependencies(onnxruntime_featurizers featurizers_lib)
target_include_directories(onnxruntime_featurizers INTERFACE ${featurizers_ROOT}/src)
add_dependencies(onnxruntime_featurizers FeaturizersCode)

target_include_directories(onnxruntime_featurizers INTERFACE ${featurizers_ROOT}/src)
if(MSVC)
set_property(TARGET onnxruntime_featurizers PROPERTY IMPORTED_LOCATION
${CMAKE_CURRENT_BINARY_DIR}/external/${featurizers_pref}/${CMAKE_BUILD_TYPE}/FeaturizersCode.lib)
Expand All @@ -54,6 +21,7 @@ else()
${CMAKE_CURRENT_BINARY_DIR}/external/${featurizers_pref}/libFeaturizersCode.a)
endif()


if (WIN32)
# Add Code Analysis properties to enable C++ Core checks. Have to do it via a props file include.
set_target_properties(onnxruntime_featurizers PROPERTIES VS_USER_PROPS ${PROJECT_SOURCE_DIR}/ConfigureVisualStudioCodeAnalysis.props)
Expand Down
1 change: 0 additions & 1 deletion cmake/external/grpc
Submodule grpc deleted from 02a2a4
6 changes: 5 additions & 1 deletion cmake/onnx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ target_include_directories(onnx_proto PUBLIC $<TARGET_PROPERTY:protobuf::libprot
target_compile_definitions(onnx_proto PUBLIC $<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_COMPILE_DEFINITIONS>)
onnxruntime_protobuf_generate(APPEND_PATH IMPORT_DIRS ${ONNXRUNTIME_ROOT}/core/protobuf TARGET onnx_proto)
if (WIN32)
target_compile_options(onnx_proto PRIVATE /wd4146) # unary minus operator applied to unsigned type
target_compile_options(onnx_proto PRIVATE "/wd4146" "/wd4125" "/wd4456" "/wd4267")
else()
if(HAS_UNUSED_VARIABLE)
target_compile_options(onnx_proto PRIVATE "-Wno-unused-variable")
endif()
endif()
# Cpp Tests were added and they require googletest
# since we have our own copy, try using that
Expand Down
16 changes: 16 additions & 0 deletions cmake/onnxruntime_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ else()
endif()
endif()

if(CMAKE_GENERATOR_PLATFORM)
# Multi-platform generator
set(onnxruntime_target_platform ${CMAKE_GENERATOR_PLATFORM})
else()
set(onnxruntime_target_platform ${CMAKE_SYSTEM_PROCESSOR})
endif()
if(onnxruntime_target_platform STREQUAL "ARM64")
set(onnxruntime_target_platform "ARM64")
elseif(onnxruntime_target_platform STREQUAL "ARM" OR CMAKE_GENERATOR MATCHES "ARM")
set(onnxruntime_target_platform "ARM")
elseif(onnxruntime_target_platform STREQUAL "x64" OR onnxruntime_target_platform STREQUAL "x86_64" OR onnxruntime_target_platform STREQUAL "AMD64" OR CMAKE_GENERATOR MATCHES "Win64")
set(onnxruntime_target_platform "x64")
elseif(onnxruntime_target_platform STREQUAL "x86" OR onnxruntime_target_platform STREQUAL "i386" OR onnxruntime_target_platform STREQUAL "i686")
set(onnxruntime_target_platform "x86")
endif()

file(GLOB onnxruntime_common_src CONFIGURE_DEPENDS
${onnxruntime_common_src_patterns}
)
Expand Down
6 changes: 3 additions & 3 deletions cmake/onnxruntime_mlas.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set(mlas_common_srcs
)

if(MSVC)
if(CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
if(onnxruntime_target_platform STREQUAL "ARM64")
set(asm_filename ${ONNXRUNTIME_ROOT}/core/mlas/lib/arm64/SgemmKernelNeon.asm)
set(pre_filename ${CMAKE_CURRENT_BINARY_DIR}/SgemmKernelNeon.i)
set(obj_filename ${CMAKE_CURRENT_BINARY_DIR}/SgemmKernelNeon.obj)
Expand All @@ -38,11 +38,11 @@ if(MSVC)
armasm64.exe ${ARMASM_FLAGS} ${pre_filename} ${obj_filename}
)
set(mlas_platform_srcs ${obj_filename})
elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "ARM" OR CMAKE_GENERATOR MATCHES "ARM")
elseif(onnxruntime_target_platform STREQUAL "ARM")
set(mlas_platform_srcs
${ONNXRUNTIME_ROOT}/core/mlas/lib/arm/sgemmc.cpp
)
elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "x64" OR CMAKE_GENERATOR MATCHES "Win64")
elseif(onnxruntime_target_platform STREQUAL "x64")
enable_language(ASM_MASM)

set(mlas_platform_srcs
Expand Down
39 changes: 29 additions & 10 deletions cmake/onnxruntime_providers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ if (onnxruntime_USE_TENSORRT)
if ( CMAKE_COMPILER_IS_GNUCC )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-missing-field-initializers")
endif()
set(CXX_VERSION_DEFINED TRUE)
set(CXX_VERSION_DEFINED TRUE)
add_subdirectory(${ONNXRUNTIME_ROOT}/../cmake/external/onnx-tensorrt)
set(CMAKE_CXX_FLAGS ${OLD_CMAKE_CXX_FLAGS})
if (WIN32)
Expand Down Expand Up @@ -303,7 +303,7 @@ if (onnxruntime_USE_OPENVINO)
if(WIN32)
set(OPENVINO_LIB_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/lib/intel64/Release)
set(OPENVINO_TBB_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/lib/intel64/Release)
set(OPENVINO_MKL_TINY_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/bin/intel64/Release)
set(OPENVINO_MKL_TINY_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/bin/intel64/Release)
else()
set(OPENVINO_LIB_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/lib/intel64/)
set(OPENVINO_TBB_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/tbb/lib)
Expand All @@ -327,9 +327,9 @@ if (onnxruntime_USE_OPENVINO)
else()
target_include_directories(onnxruntime_providers_openvino SYSTEM PUBLIC ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS} ${OPENVINO_INCLUDE_DIR} ${OPENVINO_EXTENSIONS_DIR} ${OPENVINO_LIB_DIR} ${OPENVINO_TBB_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS})
endif()
if (WIN32)
string(REPLACE "include" "libs" PYTHON_LIB ${PYTHON_INCLUDE_DIRS})

if (WIN32)
string(REPLACE "include" "libs" PYTHON_LIB ${PYTHON_INCLUDE_DIRS})
find_package(InferenceEngine 2.1 REQUIRED)
set(PYTHON_LIBRARIES ${PYTHON_LIB})
set(OPENVINO_CPU_EXTENSION_DIR ${onnxruntime_BINARY_DIR}/ie_cpu_extension/${CMAKE_BUILD_TYPE})
Expand Down Expand Up @@ -430,22 +430,41 @@ if (onnxruntime_USE_DML)
onnxruntime_add_include_to_target(onnxruntime_providers_dml onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf)
add_dependencies(onnxruntime_providers_dml ${onnxruntime_EXTERNAL_DEPENDENCIES})
target_include_directories(onnxruntime_providers_dml PRIVATE ${ONNXRUNTIME_ROOT} ${ONNXRUNTIME_ROOT}/../cmake/external/wil/include)

target_link_libraries(onnxruntime_providers_dml ${CMAKE_CURRENT_BINARY_DIR}/packages/DirectML.0.0.1/build/DirectML.targets)
target_link_libraries(onnxruntime_providers_dml d3d12.lib dxgi.lib)

if (NOT onnxruntime_USE_CUSTOM_DIRECTML)
if(NOT onnxruntime_target_platform STREQUAL "x86" AND NOT onnxruntime_target_platform STREQUAL "x64")
message(FATAL_ERROR "Target platform ${onnxruntime_target_platform} is not supported by DML")
endif()
foreach(file "DirectML.dll" "DirectML.pdb" "DirectML.Debug.dll" "DirectML.Debug.pdb")
add_custom_command(TARGET onnxruntime_providers_dml
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${DML_PACKAGE_DIR}/bin/${onnxruntime_target_platform}/${file}" $<TARGET_FILE_DIR:onnxruntime_providers_dml>)
endforeach()
endif()

function(target_add_dml target)
if (NOT onnxruntime_USE_CUSTOM_DIRECTML)
target_link_libraries(${target} PRIVATE "${DML_PACKAGE_DIR}/bin/${onnxruntime_target_platform}/DirectML.lib")
target_include_directories(${target} PRIVATE "${DML_PACKAGE_DIR}/include")
endif()
endfunction()

target_add_dml(onnxruntime_providers_dml)
target_link_libraries(onnxruntime_providers_dml PRIVATE d3d12.lib dxgi.lib delayimp.lib)
list(APPEND ONNXRUNTIME_LINKER_FLAGS "/DELAYLOAD:DirectML.dll /DELAYLOAD:d3d12.dll /DELAYLOAD:dxgi.dll")

# The DML EP requires C++17
set_target_properties(onnxruntime_providers_dml PROPERTIES CXX_STANDARD 17)
set_target_properties(onnxruntime_providers_dml PROPERTIES CXX_STANDARD_REQUIRED ON)

target_compile_definitions(onnxruntime_providers_dml PRIVATE ONNX_NAMESPACE=onnx ONNX_ML LOTUS_LOG_THRESHOLD=2 LOTUS_ENABLE_STDERR_LOGGING PLATFORM_WINDOWS)
target_compile_definitions(onnxruntime_providers_dml PRIVATE UNICODE _UNICODE NOMINMAX)
if (MSVC)
target_compile_definitions(onnxruntime_providers_dml PRIVATE _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING)
target_compile_options(onnxruntime_providers_dml PRIVATE "/W3")
endif()

install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/dml DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)

set_target_properties(onnxruntime_providers_dml PROPERTIES LINKER_LANGUAGE CXX)
Expand Down
Loading