Skip to content

Commit

Permalink
[CPU] Plug-in migration on ngraph initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-gorokhov authored and mandrono committed May 3, 2021
1 parent 5d8f209 commit bd78e71
Show file tree
Hide file tree
Showing 86 changed files with 4,568 additions and 4,716 deletions.
118 changes: 113 additions & 5 deletions inference-engine/src/mkldnn_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,115 @@ if (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNOMINMAX")
endif()

file(GLOB_RECURSE SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
## TODO
set(LAYERS
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_batchnorm_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_bin_conv_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_concat_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_conv_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_crop_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_deconv_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_def_conv_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_eltwise_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_fullyconnected_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_gemm_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_generic_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_input_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_lrn_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_memory_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_pad_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_permute_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_pooling_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_quantize_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_reorder_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_reshape_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_rnn.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_roi_align_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_roi_pooling_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_softmax_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_split_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_tensoriterator_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_tile_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_mvn_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_normalize_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_scatter_update_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_interpolate_node.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_reduce_node.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/mkldnn_reference_node.cpp

${CMAKE_CURRENT_SOURCE_DIR}/nodes/list.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/batch_to_space.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/broadcast.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/convert.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/ctc_greedy.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/ctc_loss.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/depth_to_space.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/detectionoutput.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/detectionoutput_onnx.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/embedding_bag_offset_sum.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/embedding_bag_packed_sum.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/embedding_bag_sum.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/embedding_segments_sum.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/extract_image_patches.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/fill.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/gather.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/gather_elements.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/gather_nd.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/gather_tree.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/grn.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/non_max_suppression.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/log_softmax.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/math.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/one_hot.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/powerfile.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/priorbox.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/priorbox_clustered.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/priorgridgenerator_onnx.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/proposal_onnx.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/psroi.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/range.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/region_yolo.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/reorg_yolo.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/reverse_sequence.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/roifeatureextractor_onnx.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/select.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/shuffle_channels.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/simplernms.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/space_to_batch.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/space_to_depth.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/sparse_fill_empty_rows.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/sparse_segment_reduce.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/sparse_weighted_reduce.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/sparse_to_dense.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/bucketize.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/squeeze.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/strided_slice.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/topkrois_onnx.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/unique.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/unsqueeze.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/common/softmax.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/common/emitter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/jit_eltwise_emitters.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/jit_mkldnn_emitters.cpp
#
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/argmax.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/argmax_imp.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/topk.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/proposal.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/proposal_imp.cpp
# ${CMAKE_CURRENT_SOURCE_DIR}/nodes/cum_sum.cpp
)

file(GLOB SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/mkldnn/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/utils/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/utils/rt_info/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/nodes/common/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/emitters/*.cpp
${LAYERS}
${OS_SPECIFIC_SRC}
)

file(GLOB HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/*.h
Expand Down Expand Up @@ -50,8 +157,10 @@ if(SELECTIVE_BUILD STREQUAL "ON")
endif()
endif()

target_link_libraries(${TARGET_NAME} PRIVATE mkldnn inference_engine inference_engine_legacy
inference_engine_transformations inference_engine_lp_transformations)
target_link_libraries(${TARGET_NAME} PRIVATE mkldnn
inference_engine
inference_engine_transformations
inference_engine_lp_transformations)

target_include_directories(${TARGET_NAME} PRIVATE
$<TARGET_PROPERTY:mkldnn,INCLUDE_DIRECTORIES>)
Expand Down Expand Up @@ -81,7 +190,6 @@ add_library(${TARGET_NAME}_obj OBJECT ${SOURCES} ${HEADERS})
target_link_libraries(${TARGET_NAME}_obj PUBLIC mkldnn)

target_include_directories(${TARGET_NAME}_obj PRIVATE $<TARGET_PROPERTY:inference_engine_preproc_s,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:inference_engine_transformations,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:openvino::itt,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:inference_engine_lp_transformations,INTERFACE_INCLUDE_DIRECTORIES>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#include "jit_eltwise_emitters.hpp"
#include <cpu/x64/jit_uni_eltwise.hpp>
#include "legacy/ie_layers.h"

#include <ngraph/opsets/opset1.hpp>

using namespace InferenceEngine;
Expand Down Expand Up @@ -1307,13 +1305,17 @@ jit_power_static_emitter::jit_power_static_emitter(jit_generator *host, cpu_isa_
}
jit_power_static_emitter::jit_power_static_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, Precision exec_prc)
: jit_emitter(host, host_isa, node, exec_prc) {
<<<<<<< c9d0292929cecb8988b8473ae4fe13022a5f8a81
auto *powerLayer = dynamic_cast<InferenceEngine::PowerLayer *>(node->getCnnLayer().get());
if (powerLayer == nullptr)
IE_THROW() << "Cannot convert power layer.";
=======
THROW_IE_EXCEPTION << "[NM] Not implemented";
>>>>>>> [CPU] Plug-in migration on ngraph initial commit

power = powerLayer->power;
scale = powerLayer->scale;
shift = powerLayer->offset;
// power = powerLayer->power;
// scale = powerLayer->scale;
// shift = powerLayer->offset;

prepare_table();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#include "jit_emitter.hpp"
#include "jit_load_store_emitters.hpp"
#include "legacy/ie_layers.h"
#include <cpu/x64/jit_generator.hpp>
#include "utils/bfloat16.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jit_mkldnn_emitter::jit_mkldnn_emitter(jit_generator *host, cpu_isa_t host_isa,
jit_mkldnn_emitter::jit_mkldnn_emitter(jit_generator *host, cpu_isa_t host_isa, const MKLDNNNode* node, InferenceEngine::Precision exec_prc)
: jit_emitter(host, host_isa, node, exec_prc) {
auto eltwiseNode = dynamic_cast<const MKLDNNEltwiseNode*>(node);
kind = static_cast<mkldnn_alg_kind_t>(eltwiseNode->getAlgorithm());
kind = static_cast<mkldnn_alg_kind_t>(eltwiseNode->getMKLDNNAlgorithm());
alpha = eltwiseNode->getAlpha();
beta = eltwiseNode->getBeta();

Expand Down
Loading

0 comments on commit bd78e71

Please sign in to comment.