mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-29 20:14:01 +00:00
* Added FP16 transformations
* Revert "Added CMAKE_BUILD_TYPE to make building dynamic"
This reverts commit d3e17af1af655cfdc4d2fec33f52055caa525e85.
* Added FP16 transformations for FP16 builds
* Backend logic cleanup
Cleans the backend(intel_graph.*) code in the following ways:-
1. Minimize global usage: Since all the IR graphs need to be
re-generated on every Infer, it is bad practice to rely on globals
for their saving and usage as there would be multiple readers and
writers to the same global variable leading to incorrect usages or
contentions. This change replaces globals with locals where possible.
This change also fixes an existing bug with due to
incorrect global usage.
2. Remove all unused functions.
3. Remove all unused headers and prepocessor directives.
* removed commented out code
* Disabled default optimization for Intel EP
Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com>
* Fix missed plugins.xml for python bindings
* Fixed the build after latest master changes
Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com>
* Disabled unsupported ops for accelerators
Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com>
* Added some more disabled ops
Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com>
* Added environment variable to enable debugging
Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com>
* Added more debug statements
Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com>
* Fixed unsupported ops list for GPU and VPU
Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com>
* Fixed unsqueeze unit tests
Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com>
* Added error message to the status
Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com>
* Overwrite Model proto with shape info from data
Overwrites the shape info of Model proto with the shape from
actual input data. Needed for inferring models with Dynamic
shapes.
* Removed print statement and disabled where op
Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com>
* Disabled Reshape with Empty initializer
* Added more debug statements for 1P
* Don't allow 1D inputs with symbol for dimension
* Disabled some 3rd phase ops
* Disabled split and added zero dimension check for OutputDefs
* Cleanup zero dimensionality check
* Added different data type check for inputs and initializers
* Added conditions for Mod, Cast and Pad
* Removed unused variable
* Disabled scan and added conditions for squeeze
* Added changes for fixing all C++ unit tests
* Implements Backend Manager class for caching
Backend Manager provides a layer of indirection between EP interface
and OV backend that provides caching services for models with
symbolic dims in input shapes.
* clean up commented blocks
* clang-formatting
* Read I/O type info from ModleProto
Read the tensor element type information from ModelProto object,
as FusedNode is no longer available.
* code cleanup
* clang-formatting
* Added print statement for jenkins
* Disabled some python tests
* Changed the path of convert fp32 to fp16 hpp
* Added conditions for BatchNorm in GetCapability
* Fixed failed tests
* Revert "Added conditions for BatchNorm in GetCapability"
This reverts commit c3c28c3b00d27892c42546b35dacdd807a48ee90.
* Added Intel to onnxruntime backends
* pick up vars set by OV package setupvars.sh
* Added conditions for Identity
* remove a few cout prints
* Added conditions for GPU_FP32 unit tests
* Revert "pick up vars set by OV package setupvars.sh"
This reverts commit 8199e029c03eae21a1a7ef6bfdc93d00e5d0198b.
* Commented out fatal message for protobuf
* Might need to be removed
* Add interface class for current backend
* moved common logic to base class
* simplified cpu backend
* Removed unused headers
* use vectors to save i/o tensors for windows compatibility
* move utils fxns to backend_utils namespace
* rename ov_backend to ibackend
* Factory pattern for backend creation
* rename CPU backend to Basic backend
* renamed to vad-M and added to factory list
* Added conditions for VPU
* Added print statements
* Changed the logic for checking for symbolic shapes
* Modified logic for zero dimension check
* Removed VPU single dimension condition
* Removed comments
* Modified logic in DimensionCheck method
* Remove legacy OpenVINO EP
Remove all the legacy code for OpenVINO EP. UEP code will take its
place going forward.
This change does NOT remove OVEP files in the following areas asa
they will be reused by UEP:-
1. Documentation: All .md files
2. Docker releated files
3. Python bindings
4. Java bindings
5. C# bindings
6. ORT Server
7. CI pipeline setup files
* Rename Intel EP to OpenVINO EP
* Added unique names to the subgraphs
* Removed subgraphs with only constant inputs
* Modified subgraph partitioning algorithm to remove const input subgraphs
* Apply suggestion to onnxruntime/core/providers/openvino/openvino_execution_provider.cc
* Tracking output names to fix the output order bug
* Changed output names to a unordered map
* Modified logic to check for symbolic input shapes
* Fixed a bug in Reshape check
* Added empty model path to Model constructor
* Made necessary changes to cmake to build from the binary package
* Changed INTEL_CVSDK_DIR to INTEL_OPENVINO_DIR
* Enable dyn device selection with C++ API
* Added Round operator to unsupported list
* Modified subgraph partition logic for MYRIAD
* Removed supported ops from the list
* Enable dyn dev selection in Py API's
* Add documentation for dynamic device selection
* Use MYRIAD || HDDL instead of VPU
* Removed temporary cast of Int64 to FP32
* Disabled unit Tests for CPU_FP32 and GPU_FP32
* Removed default "CPU" from unit tests to allow overriding
* Removed ops Concat, Squeeze, Unsqueeze from unsupported list
* Get the device id from info
* Removed overwriting device_id and precision
* Enabled ConvTranspose and EyeLike
* Reordered unsupported ops in alphabetical order
* Fixed syntax error
* Fixed syntax error
* Code clean-up: Handle exceptions, logs and formatting
Code formatted according to ORT coding guidelines.
* remove debug print from pybind code
* updated docs with ops and models
* formatting prints
* Added default values for c and j for openvino
* Overriding the values set for c and j to be 1
* BACKEND_OPENVINO should be empty if openvino is not in build
* Overriding c value with default for perftest
* fix VAD-M device string bug
* Add IE error details to exceptions
* Use IE specific device names in EP
* Add VAD-F (FPGA) device support
* Removed unecessary libraries from whl package
* Code changes for Windows compatibility
* Add VAD-F option to python API
* [revert before merge] cmake changes for RC
* Enable Windows build in CMake
* Unset macro OPTIONAL for windows builds
inference_engine.hpp's include chain defines a macro 'OPTIONAL'
which conflicts with onnx project's headers when using MSVC. So
would need to explictly unset it for MSVC.
* Use a single copy of plugin/IE::Core
Defined as a static member in Backend manager
* Remove restriction of single subgraphs for myriad
* Passed subgraph name to Backend to enhance log statements
* Disabled zero dimension conditions
* Disabled concat to remove zero dims
* Enabled building ngraph as part of ORT
* Removed serializing and added versioning
* Fix CPU_FP32 unit tests
* Removed unecessary condition
* add ngraph.so.0.0 to .whl
* Check for zero dimensions only for inputs and outputs
* Restrict loading only 10 subgraphs on myriad
* Build ngraph.dll within UEP. Doesn't link yet
* Rename Linux included libngraph.so to libovep_ngraph.so
Renames locally built libngraph.so containing ONNX importer to
libovep_ngraph.so in order to avoid linkage conflicts with
libngraph.so supplied by OpenVINO binary installer.
Applies only for Linux builds.
* use output_name cmake properties for lib name
* fix .so name format in lib_name.patch
* CMake code cleanup
* Rename WIN32 included ngraph.dll to ovep_ngraph.dll
To avoid conflict with ngraph.dll distributed by openvino.
* Added myriad config for networks without 4 dimensions
* Loading the 10 max clusters for inference on myriad
* Refactor code and add Batching support
Encapsulate subgraph settings into context structs.
Add batching support for completely supported models.
* Disabled some broken tests
* use input_indexes to avoid batch-checking initializers
* Avoid static initialization order error on WOS
* Added candy to broken tests
* InternalCI changes for 2020.2
* Updated DLDT instructions
* Unsaved changed in install_openvino.sh
* Changes after manual check
* Remove custom ngraph onnx_import build for WOS
ONNX Importer on WOS does not have protobuf issue.
* Remove FP32ToFP16 ngraph pass
This conversion is performed implicitly within IE.
* Surround debug logic by #ifndef NDEBUG
* remove invalid TODO comments
* removed references to ngrpah-ep
* clang-formatting
* remove commented code
* comment edits
* updating copyright year to that of first OpenVINO-EP release
* remove redundant log msg
* Modified operator and topology support
* Update build instructions
* doc formatting
* Fixed clip unit tests
* Revert "Remove FP32ToFP16 ngraph pass"
This reverts commit ec962ca5f315a5658ad980e740196f19de2639c1.
* Applying FP16 transformation only for GPU FP16
* Fixed GPU FP32 python tests
* automatically use full protobuf
* disable onnxrt server for now
* Disabled upsample
* update dockerfile instructions
* Removed MO paths and added ngraph path
* Remove OVEP from ORT Server docs
Will put it back in after validation
* Updated path to Ngraph lib
* Disabled Resize and some other python tests
* Removed unnecesary header files
* Use commit SHA to fetch ngraph repo
* Avoid un-needed file changes due to version update
* Fixed clip tests
* Fixed Pow, max and min onnx tests
* build.md doc typo
* Update cmake patch command for ngraph src
* remove dead cmake code for onnxruntime_USE_OPENVINO_BINARY
* use spaces instead of tab
* remove commented code
* Add info about protobuf version
* edit debug env var and enable for WIN32
* specify only version tag of 2020.2 for dockerbuilds
* remove unnecessary file changes
* Pass empty string as default argument to C# tests
* Use ${OPENVINO_VERSION} to name openvino install directory in CI builds
* Enabled unnecessarily disabled tests
* Fixed ngraph protobuf patch
* Fixed error in protobuf patch
* Revert "Use ${OPENVINO_VERSION} to name openvino install directory in CI builds"
This reverts commit 89e72adb8bf3b9712f5c81c5e13fe68c6c0df002.
* Remove unsetting OPTIONAL macro
This is no longer used in recent ONNX update onnx/onnx@da13be2,
so this unset workaround is no longer necessary.
* Use a null string default argument for C# API
* Set OpenVINO version yml files and pass to CI Docker builds
Git Tag info for DLDT as well as install directory are set
using this value.
This reverts commit 9fa9c20348ed72ae360a95c98e9b074d2f9fafc5.
* Documentation: recommendation and instructions for disabling ORT graph optimizations
* more doc updates
* Reduced the number of models according to CI time constraints
Co-authored-by: ynimmaga <yamini.nimmagadda@intel.com>
Co-authored-by: suryasidd <surya.siddharth.pemmaraju@intel.com>
Co-authored-by: Mikhail Treskin <mikhail.treskin@intel.com>
Co-authored-by: mbencer <mateusz.bencer@intel.com>
Co-authored-by: Aravind <aravindx.gunda@intel.com>
Co-authored-by: suryasidd <48925384+suryasidd@users.noreply.github.com>
473 lines
26 KiB
CMake
473 lines
26 KiB
CMake
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License.
|
|
|
|
file(GLOB_RECURSE onnxruntime_providers_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/core/providers/cpu/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/cpu/*.cc"
|
|
)
|
|
|
|
file(GLOB_RECURSE onnxruntime_cpu_contrib_ops_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/contrib_ops/cpu_contrib_kernels.h"
|
|
"${ONNXRUNTIME_ROOT}/contrib_ops/cpu_contrib_kernels.cc"
|
|
"${ONNXRUNTIME_ROOT}/contrib_ops/cpu/*.h"
|
|
"${ONNXRUNTIME_ROOT}/contrib_ops/cpu/*.cc"
|
|
)
|
|
|
|
file(GLOB_RECURSE onnxruntime_cuda_contrib_ops_cc_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/contrib_ops/cuda_contrib_kernels.h"
|
|
"${ONNXRUNTIME_ROOT}/contrib_ops/cuda_contrib_kernels.cc"
|
|
"${ONNXRUNTIME_ROOT}/contrib_ops/cuda/*.h"
|
|
"${ONNXRUNTIME_ROOT}/contrib_ops/cuda/*.cc"
|
|
)
|
|
|
|
file(GLOB_RECURSE onnxruntime_cuda_contrib_ops_cu_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/contrib_ops/cuda/*.cu"
|
|
"${ONNXRUNTIME_ROOT}/contrib_ops/cuda/*.cuh"
|
|
)
|
|
|
|
file(GLOB onnxruntime_cpu_featurizers_cc_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/featurizers_ops/cpu_featurizers_kernels.h"
|
|
"${ONNXRUNTIME_ROOT}/featurizers_ops/cpu_featurizers_kernels.cc"
|
|
"${ONNXRUNTIME_ROOT}/featurizers_ops/cpu/*.h"
|
|
"${ONNXRUNTIME_ROOT}/featurizers_ops/cpu/*.cc"
|
|
)
|
|
|
|
file(GLOB onnxruntime_providers_common_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/core/providers/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/*.cc"
|
|
)
|
|
|
|
if(onnxruntime_USE_DNNL)
|
|
set(PROVIDERS_DNNL onnxruntime_providers_dnnl)
|
|
list(APPEND ONNXRUNTIME_PROVIDER_NAMES dnnl)
|
|
endif()
|
|
if(onnxruntime_USE_NGRAPH)
|
|
set(PROVIDERS_NGRAPH onnxruntime_providers_ngraph)
|
|
list(APPEND ONNXRUNTIME_PROVIDER_NAMES ngraph)
|
|
endif()
|
|
if(onnxruntime_USE_NUPHAR)
|
|
set(PROVIDERS_NUPHAR onnxruntime_providers_nuphar)
|
|
list(APPEND ONNXRUNTIME_PROVIDER_NAMES nuphar)
|
|
endif()
|
|
if(onnxruntime_USE_CUDA)
|
|
set(PROVIDERS_CUDA onnxruntime_providers_cuda)
|
|
list(APPEND ONNXRUNTIME_PROVIDER_NAMES cuda)
|
|
endif()
|
|
if(onnxruntime_USE_TENSORRT)
|
|
set(PROVIDERS_TENSORRT onnxruntime_providers_tensorrt)
|
|
list(APPEND ONNXRUNTIME_PROVIDER_NAMES tensorrt)
|
|
endif()
|
|
if(onnxruntime_USE_NNAPI)
|
|
set(PROVIDERS_NNAPI onnxruntime_providers_nnapi)
|
|
list(APPEND ONNXRUNTIME_PROVIDER_NAMES nnapi)
|
|
endif()
|
|
if(onnxruntime_USE_DML)
|
|
set(PROVIDERS_DML onnxruntime_providers_dml)
|
|
list(APPEND ONNXRUNTIME_PROVIDER_NAMES dml)
|
|
endif()
|
|
if(onnxruntime_USE_OPENVINO)
|
|
set(PROVIDERS_OPENVINO onnxruntime_providers_openvino)
|
|
list(APPEND ONNXRUNTIME_PROVIDER_NAMES openvino)
|
|
endif()
|
|
if(onnxruntime_USE_WINML)
|
|
set(PROVIDERS_WINML onnxruntime_providers_winml)
|
|
list(APPEND ONNXRUNTIME_PROVIDER_NAMES winml)
|
|
endif()
|
|
if(onnxruntime_USE_ACL)
|
|
set(PROVIDERS_ACL onnxruntime_providers_acl)
|
|
list(APPEND ONNXRUNTIME_PROVIDER_NAMES acl)
|
|
endif()
|
|
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_common_srcs} ${onnxruntime_providers_srcs})
|
|
|
|
set(onnxruntime_providers_src ${onnxruntime_providers_common_srcs} ${onnxruntime_providers_srcs})
|
|
|
|
# disable contrib ops conditionally
|
|
if(NOT onnxruntime_DISABLE_CONTRIB_OPS)
|
|
# add using ONNXRUNTIME_ROOT so they show up under the 'contrib_ops' folder in Visual Studio
|
|
source_group(TREE ${ONNXRUNTIME_ROOT} FILES ${onnxruntime_cpu_contrib_ops_srcs})
|
|
list(APPEND onnxruntime_providers_src ${onnxruntime_cpu_contrib_ops_srcs})
|
|
endif()
|
|
|
|
if (onnxruntime_USE_FEATURIZERS)
|
|
source_group(TREE ${ONNXRUNTIME_ROOT}/ FILES ${onnxruntime_cpu_featurizers_cc_srcs})
|
|
list(APPEND onnxruntime_providers_src ${onnxruntime_cpu_featurizers_cc_srcs})
|
|
endif()
|
|
|
|
add_library(onnxruntime_providers ${onnxruntime_providers_src})
|
|
if (MSVC AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
target_compile_options(onnxruntime_providers PRIVATE "/wd4244")
|
|
endif()
|
|
onnxruntime_add_include_to_target(onnxruntime_providers onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf safeint_interface)
|
|
|
|
if (onnxruntime_USE_FEATURIZERS)
|
|
add_dependencies(onnxruntime_providers onnxruntime_featurizers)
|
|
onnxruntime_add_include_to_target(onnxruntime_providers onnxruntime_featurizers)
|
|
target_link_libraries(onnxruntime_providers onnxruntime_featurizers)
|
|
endif()
|
|
|
|
if(HAS_DEPRECATED_COPY)
|
|
#temporarily ignore this warning
|
|
#see: https://en.wikipedia.org/wiki/Rule_of_three_(C%2B%2B_programming)
|
|
set_source_files_properties("${ONNXRUNTIME_ROOT}/core/providers/cpu/math/matmul_integer.cc" PROPERTIES COMPILE_FLAGS -Wno-deprecated-copy)
|
|
set_source_files_properties("${ONNXRUNTIME_ROOT}/core/providers/cpu/math/quantize_linear_matmul.cc" PROPERTIES COMPILE_FLAGS -Wno-deprecated-copy)
|
|
set_source_files_properties("${ONNXRUNTIME_ROOT}/core/providers/cpu/nn/qlinearconv.cc" PROPERTIES COMPILE_FLAGS -Wno-deprecated-copy)
|
|
set_source_files_properties("${ONNXRUNTIME_ROOT}/core/providers/cpu/nn/conv_integer.cc" PROPERTIES COMPILE_FLAGS -Wno-deprecated-copy)
|
|
set_source_files_properties("${ONNXRUNTIME_ROOT}/core/providers/cpu/generator/random.cc" PROPERTIES COMPILE_FLAGS -Wno-deprecated-copy)
|
|
set_source_files_properties("${ONNXRUNTIME_ROOT}/core/providers/cpu/tensor/onehot.cc" PROPERTIES COMPILE_FLAGS -Wno-deprecated-copy)
|
|
set_source_files_properties("${ONNXRUNTIME_ROOT}/core/providers/cpu/tensor/where_op.cc" PROPERTIES COMPILE_FLAGS -Wno-deprecated-copy)
|
|
endif()
|
|
|
|
target_include_directories(onnxruntime_providers PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS} ${gemmlowp_src} ${RE2_INCLUDE_DIR})
|
|
add_dependencies(onnxruntime_providers onnx ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/cpu DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)
|
|
set_target_properties(onnxruntime_providers PROPERTIES LINKER_LANGUAGE CXX)
|
|
set_target_properties(onnxruntime_providers PROPERTIES FOLDER "ONNXRuntime")
|
|
|
|
if (onnxruntime_USE_CUDA)
|
|
file(GLOB_RECURSE onnxruntime_providers_cuda_cc_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/core/providers/cuda/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/cuda/*.cc"
|
|
)
|
|
file(GLOB_RECURSE onnxruntime_providers_cuda_cu_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/core/providers/cuda/*.cu"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/cuda/*.cuh"
|
|
)
|
|
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_cuda_cc_srcs} ${onnxruntime_providers_cuda_cu_srcs})
|
|
source_group(TREE ${ONNXRUNTIME_ROOT} FILES ${onnxruntime_cuda_contrib_ops_cc_srcs} ${onnxruntime_cuda_contrib_ops_cu_srcs})
|
|
|
|
# disable contrib ops conditionally
|
|
if(onnxruntime_DISABLE_CONTRIB_OPS)
|
|
add_library(onnxruntime_providers_cuda ${onnxruntime_providers_cuda_cc_srcs} ${onnxruntime_providers_cuda_cu_srcs})
|
|
else()
|
|
add_library(onnxruntime_providers_cuda ${onnxruntime_providers_cuda_cc_srcs} ${onnxruntime_providers_cuda_cu_srcs} ${onnxruntime_cuda_contrib_ops_cc_srcs} ${onnxruntime_cuda_contrib_ops_cu_srcs})
|
|
endif()
|
|
if (UNIX)
|
|
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler -Wno-reorder>"
|
|
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wno-reorder>")
|
|
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler -Wno-error=sign-compare>"
|
|
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wno-error=sign-compare>")
|
|
elseif(HAS_D2FH4)
|
|
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler /d2FH4->")
|
|
endif()
|
|
onnxruntime_add_include_to_target(onnxruntime_providers_cuda onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf)
|
|
add_dependencies(onnxruntime_providers_cuda ${onnxruntime_EXTERNAL_DEPENDENCIES} ${onnxruntime_tvm_dependencies})
|
|
target_include_directories(onnxruntime_providers_cuda PRIVATE ${ONNXRUNTIME_ROOT} ${PROJECT_SOURCE_DIR}/external/cub ${onnxruntime_CUDNN_HOME}/include ${eigen_INCLUDE_DIRS} ${TVM_INCLUDES} PUBLIC ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
|
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/cuda DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)
|
|
set_target_properties(onnxruntime_providers_cuda PROPERTIES LINKER_LANGUAGE CUDA)
|
|
set_target_properties(onnxruntime_providers_cuda PROPERTIES FOLDER "ONNXRuntime")
|
|
if (WIN32)
|
|
# *.cu cannot use PCH
|
|
foreach(src_file ${onnxruntime_providers_cuda_cc_srcs})
|
|
set_source_files_properties(${src_file}
|
|
PROPERTIES
|
|
COMPILE_FLAGS "/Yucuda_pch.h /FIcuda_pch.h")
|
|
endforeach()
|
|
if(NOT onnxruntime_DISABLE_CONTRIB_OPS)
|
|
foreach(src_file ${onnxruntime_cuda_contrib_ops_cc_srcs})
|
|
set_source_files_properties(${src_file}
|
|
PROPERTIES
|
|
COMPILE_FLAGS "/Yucuda_pch.h /FIcuda_pch.h")
|
|
endforeach()
|
|
endif()
|
|
set_source_files_properties("${ONNXRUNTIME_ROOT}/core/providers/cuda/cuda_pch.cc"
|
|
PROPERTIES
|
|
COMPILE_FLAGS "/Yccuda_pch.h"
|
|
)
|
|
# disable a warning from the CUDA headers about unreferenced local functions
|
|
#target_compile_options(onnxruntime_providers_cuda PRIVATE /wd4505)
|
|
if (onnxruntime_USE_TVM)
|
|
target_compile_options(onnxruntime_providers_cuda PRIVATE ${DISABLED_WARNINGS_FOR_TVM})
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
if (onnxruntime_USE_DNNL)
|
|
file(GLOB_RECURSE onnxruntime_providers_dnnl_cc_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/core/providers/dnnl/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/dnnl/*.cc"
|
|
)
|
|
|
|
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_dnnl_cc_srcs})
|
|
add_library(onnxruntime_providers_dnnl ${onnxruntime_providers_dnnl_cc_srcs})
|
|
onnxruntime_add_include_to_target(onnxruntime_providers_dnnl onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf)
|
|
add_dependencies(onnxruntime_providers_dnnl ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
set_target_properties(onnxruntime_providers_dnnl PROPERTIES FOLDER "ONNXRuntime")
|
|
target_include_directories(onnxruntime_providers_dnnl PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS} ${DNNL_INCLUDE_DIR})
|
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/dnnl DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)
|
|
set_target_properties(onnxruntime_providers_dnnl PROPERTIES LINKER_LANGUAGE CXX)
|
|
endif()
|
|
|
|
if (onnxruntime_USE_TENSORRT)
|
|
add_definitions(-DUSE_TENSORRT=1)
|
|
add_definitions("-DONNX_ML=1")
|
|
add_definitions("-DONNX_NAMESPACE=onnx")
|
|
include_directories(${PROJECT_SOURCE_DIR}/external/protobuf)
|
|
set(CUDA_INCLUDE_DIRS ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
|
|
set(TENSORRT_ROOT ${onnxruntime_TENSORRT_HOME})
|
|
include_directories(${ONNXRUNTIME_ROOT}/../cmake/external/onnx)
|
|
set(OLD_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
|
if (WIN32)
|
|
set(OLD_CMAKE_CUDA_FLAGS ${CMAKE_CUDA_FLAGS})
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996 /wd4244 /wd4267 /wd4099 /wd4551 /wd4505 /wd4515 /wd4706 /wd4456 /wd4324 /wd4701 /wd4804 /wd4702")
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4805")
|
|
endif()
|
|
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -include algorithm")
|
|
set(PROTOBUF_LIBRARY libprotobuf)
|
|
set(DISABLED_WARNINGS_FOR_TRT /wd4267 /wd4244 /wd4996 /wd4456)
|
|
list(APPEND CUDA_LIBRARIES cudart.lib cudadevrt.lib)
|
|
endif()
|
|
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)
|
|
add_subdirectory(${ONNXRUNTIME_ROOT}/../cmake/external/onnx-tensorrt)
|
|
set(CMAKE_CXX_FLAGS ${OLD_CMAKE_CXX_FLAGS})
|
|
if (WIN32)
|
|
set(CMAKE_CUDA_FLAGS ${OLD_CMAKE_CUDA_FLAGS})
|
|
unset(PROTOBUF_LIBRARY)
|
|
unset(OLD_CMAKE_CXX_FLAGS)
|
|
unset(OLD_CMAKE_CUDA_FLAGS)
|
|
set_target_properties(nvonnxparser PROPERTIES LINK_FLAGS "/ignore:4199")
|
|
target_sources(onnx2trt PRIVATE ${ONNXRUNTIME_ROOT}/test/win_getopt/mb/getopt.cc)
|
|
target_sources(getSupportedAPITest PRIVATE ${ONNXRUNTIME_ROOT}/test/win_getopt/mb/getopt.cc)
|
|
target_include_directories(onnx2trt PRIVATE ${ONNXRUNTIME_ROOT}/test/win_getopt/mb/include)
|
|
target_include_directories(getSupportedAPITest PRIVATE ${ONNXRUNTIME_ROOT}/test/win_getopt/mb/include)
|
|
target_compile_options(nvonnxparser_static PRIVATE /FIio.h /wd4100)
|
|
target_compile_options(nvonnxparser PRIVATE /FIio.h /wd4100)
|
|
target_compile_options(onnx2trt PRIVATE /FIio.h /wd4100)
|
|
target_compile_options(getSupportedAPITest PRIVATE /FIio.h /wd4100)
|
|
endif()
|
|
include_directories(${ONNXRUNTIME_ROOT}/../cmake/external/onnx-tensorrt)
|
|
include_directories(${TENSORRT_INCLUDE_DIR})
|
|
set(trt_link_libs cudnn ${CMAKE_DL_LIBS} ${TENSORRT_LIBRARY})
|
|
set(onnxparser_link_libs nvonnxparser_static)
|
|
|
|
file(GLOB_RECURSE onnxruntime_providers_tensorrt_cc_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/core/providers/tensorrt/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/tensorrt/*.cc"
|
|
)
|
|
|
|
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_tensorrt_cc_srcs})
|
|
add_library(onnxruntime_providers_tensorrt ${onnxruntime_providers_tensorrt_cc_srcs})
|
|
target_link_libraries(onnxruntime_providers_tensorrt ${onnxparser_link_libs} ${trt_link_libs})
|
|
onnxruntime_add_include_to_target(onnxruntime_providers_tensorrt onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf safeint_interface)
|
|
add_dependencies(onnxruntime_providers_tensorrt ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
target_include_directories(onnxruntime_providers_tensorrt PRIVATE ${ONNXRUNTIME_ROOT} ${onnxruntime_CUDNN_HOME}/include ${eigen_INCLUDE_DIRS} PUBLIC ${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
|
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/tensorrt DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)
|
|
set_target_properties(onnxruntime_providers_tensorrt PROPERTIES LINKER_LANGUAGE CXX)
|
|
set_target_properties(onnxruntime_providers_tensorrt PROPERTIES FOLDER "ONNXRuntime")
|
|
target_compile_definitions(onnxruntime_providers_tensorrt PRIVATE ONNXIFI_BUILD_LIBRARY=1)
|
|
target_compile_options(onnxruntime_providers_tensorrt PRIVATE ${DISABLED_WARNINGS_FOR_TRT})
|
|
if (WIN32)
|
|
target_compile_options(onnxruntime_providers_tensorrt INTERFACE /wd4267 /wd4244 /wd4996 /wd4456)
|
|
endif()
|
|
endif()
|
|
|
|
if (onnxruntime_USE_NGRAPH)
|
|
include_directories("${CMAKE_CURRENT_BINARY_DIR}/onnx")
|
|
file(GLOB_RECURSE onnxruntime_providers_ngraph_cc_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/core/providers/ngraph/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/ngraph/*.cc"
|
|
)
|
|
|
|
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_ngraph_cc_srcs})
|
|
add_library(onnxruntime_providers_ngraph ${onnxruntime_providers_ngraph_cc_srcs})
|
|
onnxruntime_add_include_to_target(onnxruntime_providers_ngraph onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf)
|
|
add_dependencies(onnxruntime_providers_ngraph project_ngraph onnx ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
set_target_properties(onnxruntime_providers_ngraph PROPERTIES FOLDER "ONNXRuntime")
|
|
target_include_directories(onnxruntime_providers_ngraph PRIVATE ${ONNXRUNTIME_ROOT} ${ngraph_INCLUDE_DIRS})
|
|
set_target_properties(onnxruntime_providers_ngraph PROPERTIES LINKER_LANGUAGE CXX)
|
|
|
|
if (NOT MSVC)
|
|
target_compile_options(onnxruntime_providers_ngraph PRIVATE "SHELL:-Wformat" "SHELL:-Wformat-security" "SHELL:-fstack-protector-strong" "SHELL:-D_FORTIFY_SOURCE=2")
|
|
target_link_options(onnxruntime_providers_ngraph PRIVATE "LINKER:-z, noexecstack " "LINKER:-z relro" "LINKER:-z now" "LINKER:-pie")
|
|
endif()
|
|
endif()
|
|
|
|
if (onnxruntime_USE_NUPHAR)
|
|
add_definitions(-DUSE_NUPHAR=1)
|
|
|
|
if (NOT onnxruntime_USE_TVM)
|
|
message(FATAL_ERROR "onnxruntime_USE_TVM required for onnxruntime_USE_NUPHAR")
|
|
endif()
|
|
|
|
if (NOT onnxruntime_USE_LLVM)
|
|
message(FATAL_ERROR "onnxruntime_USE_LLVM required for onnxruntime_USE_NUPHAR")
|
|
endif()
|
|
|
|
include(onnxruntime_nuphar_extern.cmake)
|
|
|
|
file(GLOB_RECURSE onnxruntime_providers_nuphar_cc_srcs
|
|
"${ONNXRUNTIME_ROOT}/core/providers/nuphar/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/nuphar/*.cc"
|
|
)
|
|
|
|
# following files required different build flag for AVX2 in separate onnxruntime_nuphar_extern.cmake file
|
|
list (REMOVE_ITEM onnxruntime_providers_nuphar_cc_srcs "${ONNXRUNTIME_ROOT}/core/providers/nuphar/extern/igemv_avx2.cc")
|
|
list (REMOVE_ITEM onnxruntime_providers_nuphar_cc_srcs "${ONNXRUNTIME_ROOT}/core/providers/nuphar/extern/igemv_avx2.h")
|
|
|
|
if (onnxruntime_USE_MKLML)
|
|
add_definitions(-DNUPHAR_USE_MKL)
|
|
endif()
|
|
|
|
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_nuphar_cc_srcs})
|
|
add_library(onnxruntime_providers_nuphar ${onnxruntime_providers_nuphar_cc_srcs})
|
|
onnxruntime_add_include_to_target(onnxruntime_providers_nuphar onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf safeint_interface)
|
|
set_target_properties(onnxruntime_providers_nuphar PROPERTIES FOLDER "ONNXRuntime")
|
|
target_include_directories(onnxruntime_providers_nuphar PRIVATE ${ONNXRUNTIME_ROOT} ${TVM_INCLUDES} ${eigen_INCLUDE_DIRS})
|
|
set_target_properties(onnxruntime_providers_nuphar PROPERTIES LINKER_LANGUAGE CXX)
|
|
target_compile_options(onnxruntime_providers_nuphar PRIVATE ${DISABLED_WARNINGS_FOR_TVM})
|
|
add_dependencies(onnxruntime_providers_nuphar ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/nuphar DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)
|
|
endif()
|
|
|
|
if (onnxruntime_USE_OPENVINO)
|
|
|
|
include_directories("${CMAKE_CURRENT_BINARY_DIR}/onnx")
|
|
file(GLOB_RECURSE onnxruntime_providers_openvino_cc_srcs
|
|
"${ONNXRUNTIME_ROOT}/core/providers/openvino/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/openvino/*.cc"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/openvino/*.hpp"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/openvino/*.cpp"
|
|
)
|
|
|
|
if (onnxruntime_USE_OPENVINO_BINARY)
|
|
set(OPENVINO_INCLUDE_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/include)
|
|
set(OPENVINO_TBB_INCLUDE_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/tbb/include)
|
|
set(OPENVINO_MKL_TINY_INCLUDE_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/mkltiny_lnx/include)
|
|
set(OPENVINO_TBB_LIB_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/tbb/lib)
|
|
set(OPENVINO_MKL_TINY_LIB_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/external/mkltiny_lnx/lib)
|
|
|
|
if(WIN32)
|
|
set(OPENVINO_NGRAPH_INCLUDE_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/ngraph/include)
|
|
set(OPENVINO_LIB_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/lib/intel64/Release)
|
|
set(OPENVINO_NGRAPH_LIB_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/ngraph/lib)
|
|
else()
|
|
set(OPENVINO_LIB_DIR $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/lib/intel64)
|
|
endif()
|
|
|
|
endif()
|
|
|
|
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_openvino_cc_srcs})
|
|
add_library(onnxruntime_providers_openvino ${onnxruntime_providers_openvino_cc_srcs})
|
|
onnxruntime_add_include_to_target(onnxruntime_providers_openvino onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf)
|
|
set_target_properties(onnxruntime_providers_openvino PROPERTIES FOLDER "ONNXRuntime")
|
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/openvino DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)
|
|
set_target_properties(onnxruntime_providers_openvino PROPERTIES LINKER_LANGUAGE CXX)
|
|
link_directories(onnxruntime_providers_openvino ${OPENVINO_LIB_DIR} ${OPENVINO_TBB_LIB_DIR} ${OPENVINO_MKL_TINY_LIB_DIR})
|
|
|
|
if(MSVC)
|
|
add_dependencies(onnxruntime_providers_openvino onnx ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
target_compile_options(onnxruntime_providers_openvino PUBLIC /wd4275 /wd4100 /wd4005 /wd4244)
|
|
target_include_directories(onnxruntime_providers_openvino SYSTEM PUBLIC ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS} ${OPENVINO_INCLUDE_DIR} ${OPENVINO_NGRAPH_INCLUDE_DIR} ${OPENVINO_TBB_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS})
|
|
target_link_libraries(onnxruntime_providers_openvino ${OPENVINO_LIB_DIR}/inference_engine.lib ${OPENVINO_NGRAPH_LIB_DIR}/ngraph.lib ${OPENVINO_LIB_DIR}/inference_engine_legacy.lib ${OPENVINO_TBB_LIB_DIR}/tbb.lib ${PYTHON_LIBRARIES})
|
|
else()
|
|
add_dependencies(onnxruntime_providers_openvino project_ngraph onnx ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
target_include_directories(onnxruntime_providers_openvino SYSTEM PUBLIC ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS} ${OPENVINO_INCLUDE_DIR} ${ngraph_INCLUDE_DIRS} ${OPENVINO_TBB_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS})
|
|
target_link_libraries(onnxruntime_providers_openvino -linference_engine -linference_engine_legacy -ltbb ${PYTHON_LIBRARIES})
|
|
endif()
|
|
|
|
endif()
|
|
|
|
if (onnxruntime_USE_NNAPI)
|
|
add_definitions(-DUSE_NNAPI=1)
|
|
option(DNN_READ_ONNX "" ON)
|
|
set(DNN_CUSTOM_PROTOC_EXECUTABLE ${ONNX_CUSTOM_PROTOC_EXECUTABLE})
|
|
option(DNN_CMAKE_INSTALL "" OFF)
|
|
option(DNN_BUILD_BIN "" OFF)
|
|
add_subdirectory(${REPO_ROOT}/cmake/external/DNNLibrary)
|
|
file(GLOB_RECURSE
|
|
onnxruntime_providers_nnapi_cc_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/core/providers/nnapi/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/nnapi/*.cc"
|
|
)
|
|
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_nnapi_cc_srcs})
|
|
add_library(onnxruntime_providers_nnapi ${onnxruntime_providers_nnapi_cc_srcs})
|
|
onnxruntime_add_include_to_target(onnxruntime_providers_nnapi onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf-lite dnnlibrary::dnnlibrary)
|
|
target_link_libraries(onnxruntime_providers_nnapi dnnlibrary::dnnlibrary)
|
|
add_dependencies(onnxruntime_providers_nnapi
|
|
dnnlibrary::dnnlibrary
|
|
onnx ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
# Header files of DNNLibrary requires C++17, fortunately, all modern Android NDKs support C++17
|
|
set_target_properties(onnxruntime_providers_nnapi PROPERTIES CXX_STANDARD 17)
|
|
set_target_properties(onnxruntime_providers_nnapi PROPERTIES CXX_STANDARD_REQUIRED ON)
|
|
set_target_properties(onnxruntime_providers_nnapi PROPERTIES FOLDER "ONNXRuntime")
|
|
target_include_directories(onnxruntime_providers_nnapi PRIVATE ${ONNXRUNTIME_ROOT} ${nnapi_INCLUDE_DIRS})
|
|
set_target_properties(onnxruntime_providers_nnapi PROPERTIES LINKER_LANGUAGE CXX)
|
|
endif()
|
|
|
|
if (onnxruntime_USE_DML)
|
|
file(GLOB_RECURSE onnxruntime_providers_dml_cc_srcs CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/core/providers/dml/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/dml/*.cpp"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/dml/*.cc"
|
|
)
|
|
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_dml_cc_srcs})
|
|
add_library(onnxruntime_providers_dml ${onnxruntime_providers_dml_cc_srcs})
|
|
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)
|
|
|
|
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")
|
|
add_dependencies(${target} RESTORE_PACKAGES)
|
|
endif()
|
|
endfunction()
|
|
|
|
target_add_dml(onnxruntime_providers_dml)
|
|
target_link_libraries(onnxruntime_providers_dml PRIVATE d3d12.lib dxgi.lib delayimp.lib)
|
|
set(onnxruntime_DELAYLOAD_FLAGS "${onnxruntime_DELAYLOAD_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)
|
|
set_target_properties(onnxruntime_providers_dml PROPERTIES FOLDER "ONNXRuntime")
|
|
endif()
|
|
|
|
if (onnxruntime_USE_ACL)
|
|
add_definitions(-DUSE_ACL=1)
|
|
file(GLOB_RECURSE onnxruntime_providers_acl_cc_srcs
|
|
"${ONNXRUNTIME_ROOT}/core/providers/acl/*.h"
|
|
"${ONNXRUNTIME_ROOT}/core/providers/acl/*.cc"
|
|
)
|
|
|
|
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_acl_cc_srcs})
|
|
add_library(onnxruntime_providers_acl ${onnxruntime_providers_acl_cc_srcs})
|
|
onnxruntime_add_include_to_target(onnxruntime_providers_acl onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf)
|
|
target_link_libraries(onnxruntime_providers_acl -L$ENV{LD_LIBRARY_PATH})
|
|
add_dependencies(onnxruntime_providers_acl ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
set_target_properties(onnxruntime_providers_acl PROPERTIES FOLDER "ONNXRuntime")
|
|
target_include_directories(onnxruntime_providers_acl PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS} ${ACL_INCLUDE_DIR})
|
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/acl DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)
|
|
set_target_properties(onnxruntime_providers_acl PROPERTIES LINKER_LANGUAGE CXX)
|
|
endif()
|
|
|
|
if (onnxruntime_ENABLE_MICROSOFT_INTERNAL)
|
|
include(onnxruntime_providers_internal.cmake)
|
|
endif()
|