Make DNNL EP not depending on onnx (#8588)

This commit is contained in:
Changming Sun 2021-08-03 14:11:36 -07:00 committed by GitHub
parent e09321f4db
commit 375e86f0a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 7 deletions

View file

@ -440,11 +440,11 @@ if (onnxruntime_USE_DNNL)
source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_dnnl_cc_srcs})
onnxruntime_add_shared_library_module(onnxruntime_providers_dnnl ${onnxruntime_providers_dnnl_cc_srcs})
target_link_directories(onnxruntime_providers_dnnl PRIVATE ${DNNL_LIB_DIR})
onnxruntime_add_include_to_target(onnxruntime_providers_dnnl onnxruntime_common onnx) # onnx needed for stl_backports.h
add_dependencies(onnxruntime_providers_dnnl onnxruntime_providers_shared project_dnnl ${onnxruntime_EXTERNAL_DEPENDENCIES})
target_include_directories(onnxruntime_providers_dnnl PRIVATE ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${eigen_INCLUDE_DIRS} ${DNNL_INCLUDE_DIR} ${DNNL_OCL_INCLUDE_DIR})
target_include_directories(onnxruntime_providers_dnnl PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS} ${DNNL_INCLUDE_DIR} ${DNNL_OCL_INCLUDE_DIR})
# ${CMAKE_CURRENT_BINARY_DIR} is so that #include "onnxruntime_config.h" inside tensor_shape.h is found
target_link_libraries(onnxruntime_providers_dnnl PRIVATE dnnl ${ONNXRUNTIME_PROVIDERS_SHARED})
target_link_libraries(onnxruntime_providers_dnnl PRIVATE dnnl ${ONNXRUNTIME_PROVIDERS_SHARED} Boost::mp11)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/dnnl DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)
set_target_properties(onnxruntime_providers_dnnl PROPERTIES FOLDER "ONNXRuntime")
set_target_properties(onnxruntime_providers_dnnl PROPERTIES LINKER_LANGUAGE CXX)

View file

@ -127,12 +127,12 @@ bool DnnlMatMulNodeCapability::IsDimensionSupported(const Node* node) const {
if ((node_inputs[0]->Shape() != nullptr && node_inputs[0]->Shape()->dim_size() >= 2) &&
(node_inputs[1]->Shape() != nullptr && node_inputs[1]->Shape()->dim_size() >= 2) &&
(node_inputs[0]->Shape()->dim_size() == node_inputs[1]->Shape()->dim_size())) {
for (const onnx::TensorShapeProto_Dimension& dim : node_inputs[0]->Shape()->dim()) {
for (const auto& dim : node_inputs[0]->Shape()->dim()) {
if (utils::HasDimValue(dim) && dim.dim_value() == 0) {
return false;
}
}
for (const onnx::TensorShapeProto_Dimension& dim : node_inputs[1]->Shape()->dim()) {
for (const auto& dim : node_inputs[1]->Shape()->dim()) {
if (utils::HasDimValue(dim) && dim.dim_value() == 0) {
return false;
}

View file

@ -41,7 +41,6 @@ struct DeleteOnUnloadPtr {
#include <unordered_map>
#include <unordered_set>
#include <stddef.h>
#include "onnx/common/stl_backports.h"
#include "core/common/common.h"
#include "core/common/const_pointer_container.h"
#include "core/common/type_list.h"

View file

@ -51,7 +51,6 @@ using IndexedSubGraph_MetaDef = IndexedSubGraph::MetaDef;
} // namespace onnxruntime
#include "core/common/cpuid_info.h"
#include "onnx/common/stl_backports.h"
#include "core/common/logging/logging.h"
#include "core/providers/shared_library/provider_interfaces.h"