diff --git a/.github/dockerfiles/docker_tag b/.github/dockerfiles/docker_tag index dc8abab3366b79..0d2fd1b31c0f73 100644 --- a/.github/dockerfiles/docker_tag +++ b/.github/dockerfiles/docker_tag @@ -1 +1 @@ -pr-28380 \ No newline at end of file +pr-28040 diff --git a/.github/dockerfiles/ov_build/ubuntu_22_04_x64_cc/Dockerfile b/.github/dockerfiles/ov_build/ubuntu_22_04_x64_cc/Dockerfile index 4e044eab71ef84..07f0941fb441fa 100644 --- a/.github/dockerfiles/ov_build/ubuntu_22_04_x64_cc/Dockerfile +++ b/.github/dockerfiles/ov_build/ubuntu_22_04_x64_cc/Dockerfile @@ -36,7 +36,11 @@ RUN apt-get update && \ # For Java API default-jdk \ # Compiler \ - clang \ + clang-15 \ + # Static analyzer + clang-tidy-15 \ + # clang-tidy uses clang-format as a dependency + clang-format-15 \ && \ rm -rf /var/lib/apt/lists/* @@ -47,8 +51,8 @@ RUN chmod +x /install_build_dependencies.sh && \ rm -rf /var/lib/apt/lists/* # Set clang as a default compiler -RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang 100 && \ - update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++ 100 +RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang-15 100 && \ + update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-15 100 # Install sscache ARG SCCACHE_VERSION="v0.7.5" diff --git a/.github/workflows/linux_conditional_compilation.yml b/.github/workflows/linux_conditional_compilation.yml index f198e64f7ad2ed..5e906e89541b30 100644 --- a/.github/workflows/linux_conditional_compilation.yml +++ b/.github/workflows/linux_conditional_compilation.yml @@ -151,7 +151,9 @@ jobs: # Build # - - name: CMake configure - CC COLLECT + - name: CMake configure - CC COLLECT with clang-tidy + # clang-tidy static analysis check is enabled as part of collection + # to avoid an additional separate build execution run: | cmake \ -G "${{ env.CMAKE_GENERATOR }}" \ @@ -159,6 +161,7 @@ jobs: -DBUILD_SHARED_LIBS=OFF \ -DENABLE_TESTS=ON \ -DENABLE_CPPLINT=OFF \ + -DENABLE_CLANG_TIDY=ON \ -DENABLE_NCC_STYLE=OFF \ -DCMAKE_COMPILE_WARNING_AS_ERROR=ON \ -DENABLE_PROFILING_ITT=ON \ diff --git a/cmake/developer_package/OpenVINODeveloperScriptsConfig.cmake b/cmake/developer_package/OpenVINODeveloperScriptsConfig.cmake index d953a2970b33da..ecb52325d7223b 100644 --- a/cmake/developer_package/OpenVINODeveloperScriptsConfig.cmake +++ b/cmake/developer_package/OpenVINODeveloperScriptsConfig.cmake @@ -305,6 +305,7 @@ include(python_requirements) include(cpplint/cpplint) include(clang_format/clang_format) +include(clang_tidy/clang_tidy) include(ncc_naming_style/ncc_naming_style) # Restore state diff --git a/cmake/developer_package/clang_tidy/clang_tidy.cmake b/cmake/developer_package/clang_tidy/clang_tidy.cmake new file mode 100644 index 00000000000000..f3b3a6e697e0cd --- /dev/null +++ b/cmake/developer_package/clang_tidy/clang_tidy.cmake @@ -0,0 +1,25 @@ +# Copyright (C) 2018-2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# + +if(ENABLE_CLANG_TIDY) + set(CLANG_TIDY_REQUIRED_VERSION 15 CACHE STRING "clang-tidy version to use") + set(CLANG_TIDY_FILENAME clang-tidy-${CLANG_TIDY_REQUIRED_VERSION} clang-tidy) + find_host_program(CLANG_TIDY NAMES ${CLANG_TIDY_FILENAME} PATHS ENV PATH) + if(CLANG_TIDY) + execute_process(COMMAND ${CLANG_TIDY} ${CMAKE_CURRENT_SOURCE_DIR} ARGS --version OUTPUT_VARIABLE CLANG_VERSION) + if(NOT CLANG_VERSION) + message(WARNING "Supported clang-tidy version is ${CLANG_TIDY_REQUIRED_VERSION}!") + set(ENABLE_CLANG_TIDY OFF) + else() + string(REGEX REPLACE "[^0-9]+([0-9]+)\\..*" "\\1" CLANG_TIDY_MAJOR_VERSION ${CLANG_VERSION}) + if(NOT CLANG_TIDY_MAJOR_VERSION EQUAL CLANG_TIDY_REQUIRED_VERSION) + message(WARNING "Supported clang-tidy version is ${CLANG_TIDY_REQUIRED_VERSION}! Provided version ${CLANG_TIDY_MAJOR_VERSION}") + set(ENABLE_CLANG_TIDY OFF) + endif() + endif() + else() + message(WARNING "Supported clang-tidy-${CLANG_TIDY_REQUIRED_VERSION} is not found!") + set(ENABLE_CLANG_TIDY OFF) + endif() +endif() diff --git a/cmake/developer_package/features.cmake b/cmake/developer_package/features.cmake index 387e6f25fd2a14..d4dacf28039516 100644 --- a/cmake/developer_package/features.cmake +++ b/cmake/developer_package/features.cmake @@ -78,6 +78,8 @@ ov_dependent_option (ENABLE_CPPLINT_REPORT "Build cpplint report instead of fail ov_option (ENABLE_CLANG_FORMAT "Enable clang-format checks during the build" ${STYLE_CHECKS_DEFAULT}) +ov_option (ENABLE_CLANG_TIDY "Enable clang-tidy checks during the build" ${STYLE_CHECKS_DEFAULT}) + ov_option (ENABLE_NCC_STYLE "Enable ncc style check" ${STYLE_CHECKS_DEFAULT}) ov_option (ENABLE_UNSAFE_LOCATIONS "skip check for MD5 for dependency" OFF) diff --git a/cmake/developer_package/plugins/plugins.cmake b/cmake/developer_package/plugins/plugins.cmake index 144d2e3ceab705..b7664557cec3d8 100644 --- a/cmake/developer_package/plugins/plugins.cmake +++ b/cmake/developer_package/plugins/plugins.cmake @@ -34,10 +34,11 @@ endif() # [SKIP_INSTALL] # [SKIP_REGISTRATION] Skip creation of .xml # [ADD_CLANG_FORMAT] +# [ADD_CLANG_TIDY] # ) # function(ov_add_plugin) - set(options SKIP_INSTALL PSEUDO_DEVICE ADD_CLANG_FORMAT AS_EXTENSION SKIP_REGISTRATION) + set(options SKIP_INSTALL PSEUDO_DEVICE ADD_CLANG_FORMAT ADD_CLANG_TIDY AS_EXTENSION SKIP_REGISTRATION) set(oneValueArgs NAME DEVICE_NAME VERSION_DEFINES_FOR PSEUDO_PLUGIN_FOR) set(multiValueArgs DEFAULT_CONFIG SOURCES OBJECT_LIBRARIES CPPLINT_FILTERS) cmake_parse_arguments(OV_PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -105,6 +106,12 @@ function(ov_add_plugin) string(CONCAT custom_filter "${custom_filter}" "," "${filter}") endforeach() + if (OV_PLUGIN_ADD_CLANG_TIDY) + if (ENABLE_CLANG_TIDY) + set_target_properties(${OV_PLUGIN_NAME} PROPERTIES CXX_CLANG_TIDY clang-tidy-${CLANG_TIDY_REQUIRED_VERSION}) + endif() + endif() + if (OV_PLUGIN_ADD_CLANG_FORMAT) ov_add_clang_format_target(${OV_PLUGIN_NAME}_clang FOR_SOURCES ${OV_PLUGIN_SOURCES}) else() diff --git a/src/plugins/intel_cpu/CMakeLists.txt b/src/plugins/intel_cpu/CMakeLists.txt index 5d66a4db8b6253..f47bc0b5d86fc2 100644 --- a/src/plugins/intel_cpu/CMakeLists.txt +++ b/src/plugins/intel_cpu/CMakeLists.txt @@ -239,7 +239,8 @@ ov_add_plugin(NAME ${TARGET_NAME} AS_EXTENSION VERSION_DEFINES_FOR src/plugin.cpp SOURCES ${SOURCES} ${HEADERS} - ADD_CLANG_FORMAT) + ADD_CLANG_FORMAT + ADD_CLANG_TIDY) # give a different file name depending on target platform architecture if(ARM OR AARCH64) diff --git a/src/plugins/intel_cpu/src/.clang-tidy b/src/plugins/intel_cpu/src/.clang-tidy new file mode 100644 index 00000000000000..b86cc0e063da84 --- /dev/null +++ b/src/plugins/intel_cpu/src/.clang-tidy @@ -0,0 +1,83 @@ +--- + +### NOTE: +# The 'Checks: >' is a multiline string here. Comment must not be moved into the string. +# +### Scopes to be enabled: +# +# cppcoreguidelines-*, +# google-*, +# readability-*, +# modernize-*, +# bugprone-*, +# misc-*, +# +### Checks that are turned off for a reason: +# +# -cppcoreguidelines-pro-bounds-pointer-arithmetic +# -google-readability-todo. No big reason to enforce +# -modernize-use-trailing-return-type. Just stylistic preference +# -readability-identifier-length. A lot of code use short names for readability, i.e. 'B' for batch +# -readability-uppercase-literal-suffix. +# +### Checks that are turned off but better be enabled later: +# -bugprone-narrowing-conversions +# -bugprone-easily-swappable-parameters +# -bugprone-fold-init-type +# -bugprone-implicit-widening-of-multiplication-result +# -cppcoreguidelines-narrowing-conversions +# -google-readability-braces-around-statements +# -readability-implicit-bool-conversion, +# -readability-magic-numbers, cppcoreguidelines-avoid-magic-numbers +# -readability-function-cognitive-complexity. Reasonable way to enforce splitting complex code into simple functions +# -modernize-concat-nested-namespaces. More compact way when C++17 is available + +Checks: > + -*, + performance-*, + modernize-pass-by-value, + cppcoreguidelines-prefer-member-initializer, + -bugprone-easily-swappable-parameters, + -bugprone-fold-init-type, + -bugprone-implicit-widening-of-multiplication-result, + -bugprone-narrowing-conversions, + -cppcoreguidelines-narrowing-conversions, + -cppcoreguidelines-pro-bounds-pointer-arithmetic, + -google-build-using-namespace, + -google-readability-todo, + -readability-braces-around-statements, + -google-readability-braces-around-statements, + -modernize-use-trailing-return-type, + -readability-identifier-length, + -readability-implicit-bool-conversion, + -readability-magic-numbers, + -cppcoreguidelines-avoid-magic-numbers, + -readability-uppercase-literal-suffix, + -readability-function-cognitive-complexity, + -modernize-concat-nested-namespaces, +# Treat warnings as errors +WarningsAsErrors: '*' +# Use clang-format for applied fixes +FormatStyle: file +HeaderFilterRegex: '' +CheckOptions: + - key: cppcoreguidelines-avoid-do-while.IgnoreMacros + value: true + # matches with corresponding cpplink check + - key: google-readability-namespace-comments.ShortNamespaceLines + value: "10" + # matches with corresponding cpplink check + - key: google-readability-namespace-comments.SpacesBeforeComments + value: "2" + - key: modernize-loop-convert.MinConfidence + value: reasonable + - key: modernize-pass-by-value.IncludeStyle + value: google +### To be considered to enable: +# # Unifies the usage of the statements +# - key: readability-braces-around-statements.ShortStatementLines +# value: "1" +# Reasonable way to enforce splitting complex code into simple functions +# - key: google-readability-function-size.StatementThreshold +# value: "800" +--- diff --git a/src/plugins/intel_cpu/src/compiled_model.cpp b/src/plugins/intel_cpu/src/compiled_model.cpp index 3b560cf5518ba4..c9b7f45222d155 100644 --- a/src/plugins/intel_cpu/src/compiled_model.cpp +++ b/src/plugins/intel_cpu/src/compiled_model.cpp @@ -8,6 +8,7 @@ #include #include "async_infer_request.h" +#include "config.h" #include "cpu/x64/cpu_isa_traits.hpp" #include "infer_request.h" #include "itt.h" @@ -44,34 +45,34 @@ struct ImmediateSerialExecutor : public ov::threading::ITaskExecutor { CompiledModel::CompiledModel(const std::shared_ptr& model, const std::shared_ptr& plugin, - const Config& cfg, + Config cfg, const bool loaded_from_cache, - const std::shared_ptr sub_memory_manager) + std::shared_ptr sub_memory_manager) : ov::ICompiledModel::ICompiledModel(model, plugin), m_model(model), m_plugin(plugin), - m_cfg{cfg}, + m_cfg{std::move(cfg)}, m_name{model->get_name()}, m_loaded_from_cache(loaded_from_cache), - m_sub_memory_manager(sub_memory_manager) { + m_sub_memory_manager(std::move(sub_memory_manager)) { m_mutex = std::make_shared(); const auto& core = m_plugin->get_core(); if (!core) OPENVINO_THROW("Unable to get API version. Core is unavailable"); - IStreamsExecutor::Config executor_confg; - if (cfg.exclusiveAsyncRequests) { + IStreamsExecutor::Config executor_config; + if (m_cfg.exclusiveAsyncRequests) { // special case when all InferRequests are muxed into a single queue m_task_executor = m_plugin->get_executor_manager()->get_executor("CPU"); } else { - executor_confg = m_cfg.numSubStreams > 0 ? IStreamsExecutor::Config{"CPUMainStreamExecutor", - 1, - 1, - ov::hint::SchedulingCoreType::ANY_CORE, - false, - true} - : m_cfg.streamExecutorConfig; - m_task_executor = m_plugin->get_executor_manager()->get_idle_cpu_streams_executor(executor_confg); + executor_config = m_cfg.numSubStreams > 0 ? IStreamsExecutor::Config{"CPUMainStreamExecutor", + 1, + 1, + ov::hint::SchedulingCoreType::ANY_CORE, + false, + true} + : m_cfg.streamExecutorConfig; + m_task_executor = m_plugin->get_executor_manager()->get_idle_cpu_streams_executor(executor_config); } if (0 != m_cfg.streamExecutorConfig.get_streams()) { m_callback_executor = m_plugin->get_executor_manager()->get_idle_cpu_streams_executor( @@ -85,11 +86,11 @@ CompiledModel::CompiledModel(const std::shared_ptr& model, if (m_callback_executor) set_callback_executor(m_callback_executor); - int streams = std::max(1, executor_confg.get_streams()); + int streams = std::max(1, executor_config.get_streams()); std::vector tasks; tasks.resize(streams); m_graphs.resize(streams); - if (executor_confg.get_streams() != 0) { + if (executor_config.get_streams() != 0) { auto all_graphs_ready = [&] { return std::all_of(m_graphs.begin(), m_graphs.end(), [&](Graph& graph) { return graph.IsReady(); @@ -196,7 +197,8 @@ std::shared_ptr CompiledModel::create_infer_request() co get_callback_executor()); if (m_has_sub_compiled_models) { std::vector> requests; - for (auto model : m_sub_compiled_models) { + requests.reserve(m_sub_compiled_models.size()); + for (const auto& model : m_sub_compiled_models) { requests.push_back(model->create_infer_request()); } async_infer_request->setSubInferRequest(requests); diff --git a/src/plugins/intel_cpu/src/compiled_model.h b/src/plugins/intel_cpu/src/compiled_model.h index 68e82bee77ae38..1f9cc3c0fdb590 100644 --- a/src/plugins/intel_cpu/src/compiled_model.h +++ b/src/plugins/intel_cpu/src/compiled_model.h @@ -34,9 +34,9 @@ class CompiledModel : public ov::ICompiledModel { CompiledModel(const std::shared_ptr& model, const std::shared_ptr& plugin, - const Config& cfg, + Config cfg, const bool loaded_from_cache, - const std::shared_ptr sub_memory_manager = nullptr); + std::shared_ptr sub_memory_manager = nullptr); ~CompiledModel() { if (m_has_sub_compiled_models) { diff --git a/src/plugins/intel_cpu/src/cpu_map_scheduling.cpp b/src/plugins/intel_cpu/src/cpu_map_scheduling.cpp index e9855a01309564..e0d4fa5fa44f9d 100644 --- a/src/plugins/intel_cpu/src/cpu_map_scheduling.cpp +++ b/src/plugins/intel_cpu/src/cpu_map_scheduling.cpp @@ -48,7 +48,7 @@ std::vector> apply_scheduling_core_type(ov::hint::SchedulingCor std::vector> apply_hyper_threading(bool& input_ht_hint, const bool input_ht_changed, - const std::string input_pm_hint, + const std::string& input_pm_hint, const std::vector>& proc_type_table) { std::vector> result_table = proc_type_table; diff --git a/src/plugins/intel_cpu/src/cpu_map_scheduling.hpp b/src/plugins/intel_cpu/src/cpu_map_scheduling.hpp index 2d6a29f38bf595..ae0c95ea8ed4b0 100644 --- a/src/plugins/intel_cpu/src/cpu_map_scheduling.hpp +++ b/src/plugins/intel_cpu/src/cpu_map_scheduling.hpp @@ -37,7 +37,7 @@ std::vector> apply_scheduling_core_type(ov::hint::SchedulingCor */ std::vector> apply_hyper_threading(bool& input_ht_hint, const bool input_ht_changed, - const std::string input_pm_hint, + const std::string& input_pm_hint, const std::vector>& proc_type_table); /** diff --git a/src/plugins/intel_cpu/src/cpu_memory.cpp b/src/plugins/intel_cpu/src/cpu_memory.cpp index 754003c9ce0c0b..5e749121ecda51 100644 --- a/src/plugins/intel_cpu/src/cpu_memory.cpp +++ b/src/plugins/intel_cpu/src/cpu_memory.cpp @@ -15,6 +15,7 @@ # include # include /* strerror(errno) */ +# include #endif namespace ov { @@ -67,35 +68,35 @@ void transferData(const IMemory& src, const IMemory& dst, bool ftz) { } // namespace -Memory::Memory(const dnnl::engine& eng, MemoryDescPtr desc, const void* data, bool pads_zeroing) - : m_eng(eng), - m_pMemDesc(desc), +Memory::Memory(dnnl::engine eng, MemoryDescPtr desc, const void* data, bool pads_zeroing) + : m_eng(std::move(eng)), + m_pMemDesc(std::move(desc)), m_blockHandle(std::make_shared(make_unique()), this), dnnlMemHandle(this) { - if (desc->getPrecision() == element::string) { + if (m_pMemDesc->getPrecision() == element::string) { OPENVINO_THROW("[CPU] Memory object cannot be created for string data."); } create(m_pMemDesc, data, pads_zeroing); } -Memory::Memory(const dnnl::engine& eng, const MemoryDesc& desc, const void* data, bool pads_zeroing) - : Memory::Memory(eng, desc.clone(), data, pads_zeroing) {} +Memory::Memory(dnnl::engine eng, const MemoryDesc& desc, const void* data, bool pads_zeroing) + : Memory::Memory(std::move(eng), desc.clone(), data, pads_zeroing) {} -Memory::Memory(const dnnl::engine& eng, MemoryDescPtr desc, MemoryBlockPtr block) - : m_eng(eng), - m_pMemDesc(desc), +Memory::Memory(dnnl::engine eng, MemoryDescPtr desc, MemoryBlockPtr block) + : m_eng(std::move(eng)), + m_pMemDesc(std::move(desc)), m_blockHandle(std::move(block), this), dnnlMemHandle(this) { - if (desc->getPrecision() == element::string) { + if (m_pMemDesc->getPrecision() == element::string) { OPENVINO_THROW("[CPU] Memory object can't be created for string data."); } bool memAllocated = m_blockHandle->getRawPtr(); - create(desc, nullptr, !memAllocated); + create(m_pMemDesc, nullptr, !memAllocated); } -Memory::Memory(const dnnl::engine& eng, const MemoryDesc& desc, MemoryBlockPtr block) - : Memory::Memory(eng, desc.clone(), std::move(block)) {} +Memory::Memory(dnnl::engine eng, const MemoryDesc& desc, MemoryBlockPtr block) + : Memory::Memory(std::move(eng), desc.clone(), std::move(block)) {} size_t Memory::getSize() const { auto size = getDesc().getCurrentMemSize(); @@ -110,7 +111,7 @@ void Memory::create(const MemoryDesc& desc, const void* data, bool pads_zeroing) } void Memory::create(MemoryDescPtr desc, const void* data, bool pads_zeroing) { - m_pMemDesc = desc; + m_pMemDesc = std::move(desc); m_padsZeroing = pads_zeroing; dnnlMemHandle.resetDnnlPrim(); @@ -248,9 +249,9 @@ void MemoryBlockWithReuse::destroy(void* ptr) { /////////////// StringMemory /////////////// -StringMemory::StringMemory(const dnnl::engine& engine, const MemoryDescPtr& desc, const void* data) - : m_engine(engine), - m_mem_desc(desc) { +StringMemory::StringMemory(dnnl::engine engine, MemoryDescPtr desc, const void* data) + : m_engine(std::move(engine)), + m_mem_desc(std::move(desc)) { if (m_mem_desc->getPrecision() != element::string) { OPENVINO_THROW("[CPU] StringMemory supports String type only."); } @@ -407,10 +408,10 @@ void DnnlMemoryBlock::notifyUpdate() { } } -StaticMemory::StaticMemory(const dnnl::engine& eng, MemoryDescPtr desc, const void* data, bool pads_zeroing) - : m_eng(eng), - m_pMemDesc(desc) { - if (desc->getPrecision() == element::string) { +StaticMemory::StaticMemory(dnnl::engine eng, MemoryDescPtr desc, const void* data, bool pads_zeroing) + : m_eng(std::move(eng)), + m_pMemDesc(std::move(desc)) { + if (m_pMemDesc->getPrecision() == element::string) { OPENVINO_THROW("[CPU] StaticMemory object cannot be created for string data."); } if (!m_pMemDesc->isDefined()) { @@ -439,8 +440,8 @@ StaticMemory::StaticMemory(const dnnl::engine& eng, MemoryDescPtr desc, const vo } } -StaticMemory::StaticMemory(const dnnl::engine& eng, const MemoryDesc& desc, const void* data, bool pads_zeroing) - : StaticMemory::StaticMemory(eng, desc.clone(), data, pads_zeroing) {} +StaticMemory::StaticMemory(dnnl::engine eng, const MemoryDesc& desc, const void* data, bool pads_zeroing) + : StaticMemory::StaticMemory(std::move(eng), desc.clone(), data, pads_zeroing) {} const MemoryDesc& StaticMemory::getDesc() const { return *m_pMemDesc; @@ -553,7 +554,8 @@ bool mbind_move(void* data, size_t size, int targetNode) { int realNode = ov::get_org_numa_id(targetNode); auto pagesize = getpagesize(); auto page_count = (size + pagesize - 1) / pagesize; - char* pages = reinterpret_cast((((uintptr_t)data) & ~((uintptr_t)(pagesize - 1)))); + char* pages = reinterpret_cast( // NOLINT(performance-no-int-to-ptr) + (((uintptr_t)data) & ~((uintptr_t)(pagesize - 1)))); unsigned long mask = 0; unsigned flags = 0; if (realNode < 0) { @@ -578,13 +580,13 @@ bool mbind_move(void* data, size_t size, int targetNode) { } #endif -bool mbind_move(const MemoryCPtr mem, int numaNodeID) { +bool mbind_move(const MemoryCPtr& mem, int numaNodeID) { void* data = mem->getData(); auto size = mem->getSize(); return mbind_move(data, size, numaNodeID); } -bool mbind_move(const dnnl::memory mem, int numaNodeID) { +bool mbind_move(const dnnl::memory& mem, int numaNodeID) { void* data = mem.get_data_handle(); auto desc = mem.get_desc(); auto size = desc.get_size(); diff --git a/src/plugins/intel_cpu/src/cpu_memory.h b/src/plugins/intel_cpu/src/cpu_memory.h index 8776511873ac5d..1b1b4debe4fcc4 100644 --- a/src/plugins/intel_cpu/src/cpu_memory.h +++ b/src/plugins/intel_cpu/src/cpu_memory.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "dnnl_extension_utils.h" #include "memory_desc/cpu_memory_desc.h" @@ -131,11 +132,11 @@ class DnnlMemBlockHandle { DnnlMemBlockHandle(const DnnlMemBlockHandle&) = delete; DnnlMemBlockHandle& operator=(const DnnlMemBlockHandle&) = delete; - DnnlMemBlockHandle(DnnlMemBlockHandle&& source) { + DnnlMemBlockHandle(DnnlMemBlockHandle&& source) noexcept { std::swap(m_pMemBlock, source.m_pMemBlock); std::swap(m_pMem, source.m_pMem); } - DnnlMemBlockHandle& operator=(DnnlMemBlockHandle&& rhs) { + DnnlMemBlockHandle& operator=(DnnlMemBlockHandle&& rhs) noexcept { std::swap(m_pMemBlock, rhs.m_pMemBlock); std::swap(m_pMem, rhs.m_pMem); return *this; @@ -238,8 +239,8 @@ class StaticMemory final : public IMemory { using MemBlockPtr = std::shared_ptr; public: - StaticMemory(const dnnl::engine& eng, MemoryDescPtr desc, const void* data = nullptr, bool pads_zeroing = true); - StaticMemory(const dnnl::engine& eng, const MemoryDesc& desc, const void* data = nullptr, bool pads_zeroing = true); + StaticMemory(dnnl::engine eng, MemoryDescPtr desc, const void* data = nullptr, bool pads_zeroing = true); + StaticMemory(dnnl::engine eng, const MemoryDesc& desc, const void* data = nullptr, bool pads_zeroing = true); StaticMemory(const StaticMemory&) = delete; StaticMemory& operator=(const StaticMemory&) = delete; @@ -279,10 +280,10 @@ class StaticMemory final : public IMemory { class Memory : public IMemory { public: - Memory(const dnnl::engine& eng, MemoryDescPtr desc, const void* data = nullptr, bool pads_zeroing = true); - Memory(const dnnl::engine& eng, const MemoryDesc& desc, const void* data = nullptr, bool pads_zeroing = true); - Memory(const dnnl::engine& eng, MemoryDescPtr desc, MemoryBlockPtr block); - Memory(const dnnl::engine& eng, const MemoryDesc& desc, MemoryBlockPtr block); + Memory(dnnl::engine eng, MemoryDescPtr desc, const void* data = nullptr, bool pads_zeroing = true); + Memory(dnnl::engine eng, const MemoryDesc& desc, const void* data = nullptr, bool pads_zeroing = true); + Memory(dnnl::engine eng, MemoryDescPtr desc, MemoryBlockPtr block); + Memory(dnnl::engine eng, const MemoryDesc& desc, MemoryBlockPtr block); Memory(const Memory&) = delete; Memory& operator=(const Memory&) = delete; @@ -385,18 +386,18 @@ class StringMemory : public IMemory { using StringMemoryBlockPtr = std::shared_ptr; - StringMemory(const dnnl::engine& engine, const MemoryDescPtr& desc, const void* data = nullptr); + StringMemory(dnnl::engine engine, MemoryDescPtr desc, const void* data = nullptr); - StringMemory(const dnnl::engine& engine, const MemoryDesc& desc, const void* data = nullptr) - : StringMemory(engine, desc.clone(), data) {} + StringMemory(dnnl::engine engine, const MemoryDesc& desc, const void* data = nullptr) + : StringMemory(std::move(engine), desc.clone(), data) {} - StringMemory(const dnnl::engine& engine, const MemoryDescPtr& desc, const StringMemoryBlockPtr& block) - : m_engine(engine), - m_mem_desc(desc), - m_memoryBlock(block) {} + StringMemory(dnnl::engine engine, MemoryDescPtr desc, StringMemoryBlockPtr block) + : m_engine(std::move(engine)), + m_mem_desc(std::move(desc)), + m_memoryBlock(std::move(block)) {} - StringMemory(const dnnl::engine& engine, const MemoryDesc& desc, const StringMemoryBlockPtr& block) - : StringMemory(engine, desc.clone(), block) {} + StringMemory(dnnl::engine engine, const MemoryDesc& desc, StringMemoryBlockPtr block) + : StringMemory(std::move(engine), desc.clone(), std::move(block)) {} const MemoryDesc& getDesc() const override { return *m_mem_desc; @@ -443,8 +444,8 @@ using MemoryCPtr = std::shared_ptr; using StringMemoryPtr = std::shared_ptr; bool mbind_move(void* data, size_t size, int numaNodeID); -bool mbind_move(const MemoryCPtr mem, int numaNodeID); -bool mbind_move(const dnnl::memory mem, int numaNodeID); +bool mbind_move(const MemoryCPtr& mem, int numaNodeID); +bool mbind_move(const dnnl::memory& mem, int numaNodeID); MemoryPtr split_horizontal(const dnnl::engine& eng, const MemoryPtr& src, diff --git a/src/plugins/intel_cpu/src/cpu_shape.h b/src/plugins/intel_cpu/src/cpu_shape.h index 3c8d6d093220b9..f60ba585df89bf 100644 --- a/src/plugins/intel_cpu/src/cpu_shape.h +++ b/src/plugins/intel_cpu/src/cpu_shape.h @@ -36,9 +36,7 @@ class Shape { }); } - explicit Shape(const VectorDims& shape) { - dims = minDims = maxDims = shape; - type = ShapeType::Static; + explicit Shape(const VectorDims& shape) : type(ShapeType::Static), dims(minDims = maxDims = shape) { hasZeroDimensions = std::any_of(dims.begin(), dims.end(), [](size_t dim) { return dim == 0; }); @@ -66,10 +64,10 @@ class Shape { }); } - Shape(const std::initializer_list& shape) { + Shape(const std::initializer_list& shape) : type(ShapeType::Static) { minDims.reserve(shape.size()); maxDims.reserve(shape.size()); - type = ShapeType::Static; + for (auto dim : shape) { minDims.push_back(dim); maxDims.push_back(dim); diff --git a/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp b/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp index a88ec8e4a1da4a..6b68afffa711e7 100644 --- a/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp +++ b/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp @@ -49,8 +49,8 @@ std::vector> get_streams_info_table( const int input_threads, const int input_infer_requests, const int model_prefer_threads, - const std::string input_perf_hint, - const std::set hint_model_distribution_policy, + const std::string& input_perf_hint, + const std::set& hint_model_distribution_policy, const std::vector>& proc_type_table) { std::vector stream_info(CPU_STREAMS_TABLE_SIZE, INIT_VAL); std::vector> streams_info_table; @@ -562,7 +562,7 @@ std::vector> get_streams_rank_table(const std::vector> proc_type_table, + const std::vector>& proc_type_table, const std::shared_ptr& model, Config& config) { const int sockets = get_num_sockets(); diff --git a/src/plugins/intel_cpu/src/cpu_streams_calculation.hpp b/src/plugins/intel_cpu/src/cpu_streams_calculation.hpp index 2af57e05bfd53d..b3a9694d7cb336 100644 --- a/src/plugins/intel_cpu/src/cpu_streams_calculation.hpp +++ b/src/plugins/intel_cpu/src/cpu_streams_calculation.hpp @@ -48,8 +48,8 @@ std::vector> get_streams_info_table( const int input_threads, const int input_infer_requests, const int model_prefer_threads, - const std::string input_perf_hint, - const std::set hint_llm_distribution_policy, + const std::string& input_perf_hint, + const std::set& hint_llm_distribution_policy, const std::vector>& proc_type_table); /** @@ -75,7 +75,7 @@ std::vector> get_streams_rank_table(const std::vector> proc_type_table, + const std::vector>& proc_type_table, const std::shared_ptr& model, Config& config); diff --git a/src/plugins/intel_cpu/src/cpu_tensor.cpp b/src/plugins/intel_cpu/src/cpu_tensor.cpp index 1a31fa063b306f..14378592c576e0 100644 --- a/src/plugins/intel_cpu/src/cpu_tensor.cpp +++ b/src/plugins/intel_cpu/src/cpu_tensor.cpp @@ -4,6 +4,8 @@ #include "cpu_tensor.h" +#include + #include "memory_desc/blocked_memory_desc.h" #include "utils/debug_capabilities.h" #include "utils/general_utils.h" @@ -11,7 +13,7 @@ namespace ov { namespace intel_cpu { -Tensor::Tensor(MemoryPtr memptr) : m_memptr{memptr} { +Tensor::Tensor(MemoryPtr memptr) : m_memptr{std::move(memptr)} { OPENVINO_ASSERT(m_memptr != nullptr); // only support plain data format ncsp. @@ -100,7 +102,7 @@ void* Tensor::data(const element::Type& element_type) const { * @return Shared pointer to tensor interface */ std::shared_ptr make_tensor(MemoryPtr mem) { - return std::make_shared(mem); + return std::make_shared(std::move(mem)); } } // namespace intel_cpu diff --git a/src/plugins/intel_cpu/src/cpu_tensor.h b/src/plugins/intel_cpu/src/cpu_tensor.h index bcf738f321984a..4885d76358b496 100644 --- a/src/plugins/intel_cpu/src/cpu_tensor.h +++ b/src/plugins/intel_cpu/src/cpu_tensor.h @@ -47,4 +47,4 @@ class Tensor : public ITensor { std::shared_ptr make_tensor(MemoryPtr mem); } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/dnnl_scratch_pad.h b/src/plugins/intel_cpu/src/dnnl_scratch_pad.h index 17b366e8acd54d..198a18809e4064 100644 --- a/src/plugins/intel_cpu/src/dnnl_scratch_pad.h +++ b/src/plugins/intel_cpu/src/dnnl_scratch_pad.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include "cpu_memory.h" #include "utils/general_utils.h" @@ -17,7 +18,7 @@ class DnnlScratchPad { dnnl::engine eng; public: - DnnlScratchPad(const dnnl::engine& eng, int numa_node = -1) : eng(eng) { + DnnlScratchPad(dnnl::engine eng, int numa_node = -1) : eng(std::move(eng)) { blockPtr = std::make_shared(make_unique(numa_node)); } diff --git a/src/plugins/intel_cpu/src/edge.cpp b/src/plugins/intel_cpu/src/edge.cpp index 7819a9a4c1efd2..2ee0a42f4cae3b 100644 --- a/src/plugins/intel_cpu/src/edge.cpp +++ b/src/plugins/intel_cpu/src/edge.cpp @@ -77,7 +77,7 @@ void Edge::collectConsumers(std::vector& result) const { auto peerOutputNum = this->getOutputNum(); auto peerInPlacePort = peerChildSPD->getConfig().inConfs[peerOutputNum].inPlace(); auto vecChildEdges = getChild()->getChildEdgesAtPort(peerInPlacePort); - for (auto childEdge : vecChildEdges) { + for (const auto& childEdge : vecChildEdges) { childEdge->collectConsumers(result); } } @@ -256,7 +256,7 @@ Edge::ReorderStatus Edge::needReorder() { void Edge::reuse(MemoryPtr ptr) { OPENVINO_ASSERT(ptr != nullptr, "Attempt to reuse initialized memory in ", *this); - memoryPtr = ptr; + memoryPtr = std::move(ptr); changeStatus(Status::Allocated); DEBUG_LOG(*this, " memoryPtr=", memoryPtr); @@ -298,9 +298,9 @@ void Edge::allocate(MemoryBlockPtr memBlock) { OPENVINO_THROW("Unexpected: Memory block ptr is NULL"); } - auto allocateFunc = [OV_CAPTURE_CPY_AND_THIS](const MemoryDesc& inputDesc) -> MemoryPtr { + auto allocateFunc = [this, block = std::move(memBlock)](const MemoryDesc& inputDesc) mutable -> MemoryPtr { auto parentPtr = getParent(); - return std::make_shared(parentPtr->getEngine(), inputDesc, std::move(memBlock)); + return std::make_shared(parentPtr->getEngine(), inputDesc, std::move(block)); }; allocateCommon(allocateFunc); @@ -316,7 +316,7 @@ std::string Edge::hash() const { std::to_string(child_port); } -void Edge::externalAllocate(WeightsSharing::Ptr weightsCache) { +void Edge::externalAllocate(const WeightsSharing::Ptr& weightsCache) { if (status != Status::NeedAllocation) return; diff --git a/src/plugins/intel_cpu/src/edge.h b/src/plugins/intel_cpu/src/edge.h index 4b485419ff8edb..2f05bf1c92282d 100644 --- a/src/plugins/intel_cpu/src/edge.h +++ b/src/plugins/intel_cpu/src/edge.h @@ -57,7 +57,7 @@ class Edge { void init(); void allocate(const void* mem_ptr = nullptr); void allocate(MemoryBlockPtr memBlock); - void externalAllocate(WeightsSharing::Ptr weightsCache); + void externalAllocate(const WeightsSharing::Ptr& weightsCache); void reuse(MemoryPtr ptr); void validate(); diff --git a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_conversion_emitters.cpp b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_conversion_emitters.cpp index 43417942e8bc53..99de56b3c136eb 100644 --- a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_conversion_emitters.cpp +++ b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_conversion_emitters.cpp @@ -201,10 +201,9 @@ jit_convert_emitter::jit_convert_emitter(jit_generator* host, cpu_isa_t host_isa, const std::shared_ptr& node, ov::element::Type exec_prc) - : jit_emitter(host, host_isa, exec_prc) { - input_type = node->get_input_element_type(0); - output_type = node->get_output_element_type(0); -} + : jit_emitter(host, host_isa, exec_prc), + input_type(node->get_input_element_type(0)), + output_type(node->get_output_element_type(0)) {} void jit_convert_emitter::validate_types() const { OV_CPU_JIT_EMITTER_ASSERT( diff --git a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.hpp b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.hpp index c0bfb4114f9c17..d305b59f51a8d5 100644 --- a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.hpp +++ b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.hpp @@ -126,18 +126,18 @@ class jit_emitter : public ov::snippets::Emitter { mapped_table_t entry_map_; - Xbyak_aarch64::AdrImm table_val(std::string key, size_t key_off_val_shift = 0) const { + Xbyak_aarch64::AdrImm table_val(const std::string& key, size_t key_off_val_shift = 0) const { const int32_t off = table_off(key, key_off_val_shift); return Xbyak_aarch64::ptr(p_table, off); } - Xbyak_aarch64::AdrNoOfs table_val2(std::string key, size_t key_off_val_shift = 0) const { + Xbyak_aarch64::AdrNoOfs table_val2(const std::string& key, size_t key_off_val_shift = 0) const { const int32_t off = table_off(key, key_off_val_shift); h->add_imm(h->X_DEFAULT_ADDR, p_table, off, h->X_TMP_0); return Xbyak_aarch64::ptr(h->X_DEFAULT_ADDR); } - void push_arg_entry_of(const std::string key, const table_entry_val_t val, const bool broadcast) { + void push_arg_entry_of(const std::string& key, const table_entry_val_t val, const bool broadcast) { mapped_table_entry_t te{0, val, broadcast}; entry_map_.insert(std::make_pair(key, te)); } diff --git a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_bf16_emitters.hpp b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_bf16_emitters.hpp index 6bca11ffe39f47..78ad3b04aa06b1 100644 --- a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_bf16_emitters.hpp +++ b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_bf16_emitters.hpp @@ -16,9 +16,9 @@ class jit_uni_vcvtneps2bf16 : public jit_emitter { dnnl::impl::cpu::x64::cpu_isa_t host_isa, ov::element::Type exec_prc = ov::element::bf16, conversion_mode mode = conversion_mode::default_mode) - : jit_emitter(host, host_isa, exec_prc) { + : jit_emitter(host, host_isa, exec_prc), + mode_(mode) { prepare_table(); - mode_ = mode; } size_t get_inputs_num() const override { diff --git a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_conversion_emitters.cpp b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_conversion_emitters.cpp index b1ef291e45e111..e508b428c5506b 100644 --- a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_conversion_emitters.cpp +++ b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_conversion_emitters.cpp @@ -18,10 +18,9 @@ jit_convert_emitter::jit_convert_emitter(jit_generator* host, cpu_isa_t host_isa, const std::shared_ptr& node, ov::element::Type exec_prc) - : jit_emitter(host, host_isa, exec_prc) { - input_type = node->get_input_element_type(0); - output_type = node->get_output_element_type(0); - + : jit_emitter(host, host_isa, exec_prc), + input_type(node->get_input_element_type(0)), + output_type(node->get_output_element_type(0)) { if (output_type == ov::element::bf16) uni_vcvtneps2bf16.reset(new jit_uni_vcvtneps2bf16(host, host_isa)); } diff --git a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_dnnl_emitters.cpp b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_dnnl_emitters.cpp index b1c0f80242a847..e8d2f9d0936f14 100644 --- a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_dnnl_emitters.cpp +++ b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_dnnl_emitters.cpp @@ -22,11 +22,10 @@ jit_dnnl_emitter::jit_dnnl_emitter(jit_generator* host, cpu_isa_t host_isa, const std::shared_ptr& node, ov::element::Type exec_prc) - : jit_emitter(host, host_isa, exec_prc) { - kind = dnnl_eltwise_tanh; - alpha = 0.f; - beta = 0.f; - + : jit_emitter(host, host_isa, exec_prc), + kind(dnnl_eltwise_tanh), + alpha(0.f), + beta(0.f) { set_injector(); } diff --git a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_emitter.hpp b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_emitter.hpp index 5f7ef8d06b3a12..4c5821bc5a0aae 100644 --- a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_emitter.hpp +++ b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_emitter.hpp @@ -135,7 +135,7 @@ class jit_emitter : public ov::snippets::Emitter { static constexpr int k_mask_num = 8; static constexpr int gpr_size = 8; - Xbyak::Address table_val(std::string key, size_t key_off_val_shift = 0) const { + Xbyak::Address table_val(const std::string& key, size_t key_off_val_shift = 0) const { auto off = table_off(key, key_off_val_shift); return h->ptr[p_table + off]; } @@ -145,7 +145,7 @@ class jit_emitter : public ov::snippets::Emitter { mapped_table_t entry_map_; - void push_arg_entry_of(const std::string key, const table_entry_val_t val, const bool broadcast) { + void push_arg_entry_of(const std::string& key, const table_entry_val_t val, const bool broadcast) { mapped_table_entry_t te{0, val, broadcast}; entry_map_.insert(std::make_pair(key, te)); } @@ -172,7 +172,7 @@ class jit_emitter : public ov::snippets::Emitter { void push_vec(const Xbyak::Address& addr, size_t vec_idx) const; void pop_vec(size_t vec_idx, const Xbyak::Address& addr) const; - size_t table_off(std::string& key, size_t key_off_val_shift = 0) const { + size_t table_off(const std::string& key, size_t key_off_val_shift = 0) const { // assumption: all table entries sharing the same key also // share their broadcast property // TODO: enforce through data structure diff --git a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_load_store_emitters.cpp b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_load_store_emitters.cpp index 7d8f0c9eb42a7b..72384674edd97e 100644 --- a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_load_store_emitters.cpp +++ b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_load_store_emitters.cpp @@ -4,6 +4,8 @@ #include "jit_load_store_emitters.hpp" +#include + #include "utils/bfloat16.hpp" using namespace dnnl::impl; @@ -102,14 +104,14 @@ jit_load_emitter::jit_load_emitter(dnnl::impl::cpu::x64::jit_generator* host, emitter_in_out_map in_out_type) : jit_emitter(host, host_isa, exec_prc, in_out_type), name_("unknown"), + v_len_elt_(get_vec_length() / exec_prc.size()), load_num_(load_num), + load_size_(load_num * src_prc.size()), src_prc_(src_prc), dst_prc_(dst_prc), is_fill_(is_fill), - fill_value_(fill_value) { + fill_value_(std::move(fill_value)) { prepare_table(); - load_size_ = load_num * src_prc.size(); - v_len_elt_ = get_vec_length() / exec_prc.size(); } size_t jit_load_emitter::get_inputs_num() const { @@ -630,7 +632,7 @@ void jit_load_emitter::load_words_to_dword_extension(const Vmm& vmm, } template -void jit_load_emitter::fill_with_default(const Vmm& vmm, std::string fill_value, const int& load_num) const { +void jit_load_emitter::fill_with_default(const Vmm& vmm, const std::string& fill_value, const int& load_num) const { constexpr bool is_xmm = std::is_same::value; constexpr bool is_ymm = std::is_same::value; constexpr bool is_zmm = std::is_same::value; @@ -671,13 +673,13 @@ jit_store_emitter::jit_store_emitter(dnnl::impl::cpu::x64::jit_generator* host, emitter_in_out_map in_out_type) : jit_emitter(host, host_isa, exec_prc, in_out_type), name_("unknown"), + v_len_elt_(get_vec_length() / exec_prc.size()), store_num_(store_num), + store_size_(store_num * dst_prc.size()), src_prc_(src_prc), dst_prc_(dst_prc), mode_(mode) { prepare_table(); - v_len_elt_ = get_vec_length() / exec_prc.size(); - store_size_ = store_num * dst_prc.size(); uni_vcvtneps2bf16_.reset(new jit_uni_vcvtneps2bf16(host, host_isa)); } diff --git a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_load_store_emitters.hpp b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_load_store_emitters.hpp index 54f0948035ee6d..ee8104e290da9f 100644 --- a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_load_store_emitters.hpp +++ b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_load_store_emitters.hpp @@ -4,6 +4,8 @@ #pragma once +#include + #include "jit_bf16_emitters.hpp" #include "jit_emitter.hpp" @@ -20,7 +22,7 @@ struct load_emitter_params : public emitter_params { dst_prc_(dst_prc), load_num_(load_num), is_fill_(is_fill), - fill_value_(fill_value) {} + fill_value_(std::move(fill_value)) {} size_t hash() const override; @@ -99,7 +101,7 @@ class jit_load_emitter : public jit_emitter { int load_size) const; template - void fill_with_default(const Vmm& vmm, std::string fill_value, const int& load_num) const; + void fill_with_default(const Vmm& vmm, const std::string& fill_value, const int& load_num) const; void register_table_entries() override; diff --git a/src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_loop_emitters.cpp b/src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_loop_emitters.cpp index 0666505a6d31ab..9e3dc9674079b1 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_loop_emitters.cpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/aarch64/jit_loop_emitters.cpp @@ -88,7 +88,7 @@ jit_loop_end_emitter::jit_loop_end_emitter(dnnl::impl::cpu::aarch64::jit_generat ov::snippets::lowered::ExpressionPtr jit_loop_end_emitter::get_loop_begin_expr( const ov::snippets::lowered::ExpressionPtr& expr) { - const auto begin_expr = expr->get_input_port_connectors().back()->get_source().get_expr(); + auto begin_expr = expr->get_input_port_connectors().back()->get_source().get_expr(); OV_CPU_JIT_EMITTER_ASSERT(ov::is_type(begin_expr->get_node()), "LoopEnd expression must have th last port connector to LoopBegin"); return begin_expr; diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp index de2160e0053808..5e4a8992aa7165 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp @@ -373,6 +373,7 @@ std::vector intel_cpu::CPUTargetMachine::get_vec_reg_pool() const } }(); std::vector reg_pool; + reg_pool.reserve(num_vec_regs); for (int i = 0; i < num_vec_regs; i++) reg_pool.emplace_back(snippets::RegType::vec, static_cast(i)); return reg_pool; diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_debug_emitter.hpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_debug_emitter.hpp index 4bf2e55baeb05f..2c92b23e85fb46 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_debug_emitter.hpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_debug_emitter.hpp @@ -6,6 +6,8 @@ # pragma once +# include + # include "emitters/plugin/x64/jit_emitter.hpp" namespace ov { @@ -15,14 +17,14 @@ class jit_debug_emitter : public jit_emitter { public: enum class EmissionLocation { preamble, postamble, both }; jit_debug_emitter(const std::shared_ptr& target_emitter, - const std::shared_ptr& decorator_emitter, + std::shared_ptr decorator_emitter, const EmissionLocation& loc) : jit_emitter(target_emitter->h, target_emitter->host_isa_, target_emitter->exec_prc_, target_emitter->in_out_type_), m_target_emitter(target_emitter), - m_decorator_emitter(decorator_emitter), + m_decorator_emitter(std::move(decorator_emitter)), m_decorator_emit_loc(loc) { prepare_table(); } diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_loop_emitters.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_loop_emitters.cpp index 86421678a29011..19eba960b2d79a 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_loop_emitters.cpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_loop_emitters.cpp @@ -160,7 +160,7 @@ jit_loop_end_emitter::jit_loop_end_emitter(dnnl::impl::cpu::x64::jit_generator* ov::snippets::lowered::ExpressionPtr jit_loop_end_emitter::get_loop_begin_expr( const ov::snippets::lowered::ExpressionPtr& expr) { - const auto begin_expr = expr->get_input_port_connectors().back()->get_source().get_expr(); + auto begin_expr = expr->get_input_port_connectors().back()->get_source().get_expr(); OV_CPU_JIT_EMITTER_ASSERT(ov::is_type(begin_expr->get_node()), "LoopEnd expression must have th last port connector to LoopBegin"); return begin_expr; diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_segfault_detector_emitter.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_segfault_detector_emitter.cpp index e9744ae5098c5f..298733a70843b3 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_segfault_detector_emitter.cpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_segfault_detector_emitter.cpp @@ -6,6 +6,8 @@ # include "jit_segfault_detector_emitter.hpp" +# include + # include "emitters/plugin/x64/utils.hpp" using namespace dnnl::impl::utils; @@ -29,7 +31,7 @@ jit_uni_segfault_detector_emitter::jit_uni_segfault_detector_emitter(dnnl::impl: m_target_emitter(target_emitter), is_target_use_load_emitter(is_load), is_target_use_store_emitter(is_store), - m_target_node_name(target_node_name) {} + m_target_node_name(std::move(target_node_name)) {} size_t jit_uni_segfault_detector_emitter::get_inputs_num() const { return 1; diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_copy_b.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_copy_b.cpp index 6d4fdf738ab355..30d95ed6a2bf7a 100644 --- a/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_copy_b.cpp +++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_copy_b.cpp @@ -22,9 +22,8 @@ BrgemmCopyBKernelConfig::BrgemmCopyBKernelConfig(const element::Type& src_dt, bool is_with_comp, bool is_transposed_B, dnnl_dim_t wei_N_blk) - : m_static_params(std::make_shared(src_dt, wei_dt, isa, is_with_comp, is_transposed_B, wei_N_blk)) { - m_hash = compute_hash(); -} + : m_static_params(std::make_shared(src_dt, wei_dt, isa, is_with_comp, is_transposed_B, wei_N_blk)), + m_hash(compute_hash()) {} bool BrgemmCopyBKernelConfig::is_completed() const { return !utils::one_of(0, m_N, m_K, m_copy_B_wei_stride, m_LDB) || is_empty(); diff --git a/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_debug_emitter.hpp b/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_debug_emitter.hpp index 4afc6ee1d7c5d7..5d6759e22c757e 100644 --- a/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_debug_emitter.hpp +++ b/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_debug_emitter.hpp @@ -3,6 +3,8 @@ // #pragma once +#include + #include "jit_tpp_emitter.hpp" namespace ov { @@ -15,28 +17,29 @@ namespace intel_cpu { */ class DebugTppEmitter : public TppEmitter { public: - DebugTppEmitter(const ov::snippets::lowered::ExpressionPtr& expr, const std::shared_ptr& original) - : TppEmitter(*original), - m_original(original), - m_compiled_kernel(m_original->get_compiled_kernel_ptr()), - m_execute_function(m_original->get_execute_function_ptr()), - m_source_expr(expr) { - } + DebugTppEmitter(ov::snippets::lowered::ExpressionPtr expr, const std::shared_ptr& original) + : TppEmitter(*original), + m_original(original), + m_compiled_kernel(m_original->get_compiled_kernel_ptr()), + m_execute_function(m_original->get_execute_function_ptr()), + m_source_expr(std::move(expr)) {} - void validate_arguments(const std::vector &in, const std::vector &out) const override { + void validate_arguments(const std::vector& in, const std::vector& out) const override { m_original->validate_arguments(in, out); }; - size_t get_inputs_num() const override { return num_kernel_args - 1; } + size_t get_inputs_num() const override { + return num_kernel_args - 1; + } protected: - static void execute_kernel_unary(const DebugTppEmitter* emitter, void *in0, void *out0) { + static void execute_kernel_unary(const DebugTppEmitter* emitter, void* in0, void* out0) { OV_CPU_JIT_EMITTER_ASSERT(emitter && emitter->m_execute_function && emitter->m_compiled_kernel, "Unable to execute unary kernel"); // Note: put a breakpoint here and analyze all the necessary debug info in runtime std::cout << "Running unary DebugTPPEmitter for node with name " << emitter->m_source_expr->get_node()->get_friendly_name() << std::endl; - auto f = reinterpret_cast(emitter->m_execute_function); + auto f = reinterpret_cast(emitter->m_execute_function); f(emitter->m_compiled_kernel, in0, out0); } @@ -46,16 +49,19 @@ class DebugTppEmitter : public TppEmitter { // Note: put a breakpoint here and analyze all the necessary debug info in runtime std::cout << "Running binary DebugTPPEmitter for node with name " << emitter->m_source_expr->get_node()->get_friendly_name() << std::endl; - auto f = reinterpret_cast(emitter->m_execute_function); + auto f = reinterpret_cast(emitter->m_execute_function); f(emitter->m_compiled_kernel, in0, in1, out0); } const uintptr_t get_execute_function_ptr() const override { // Note: num_kernel_args accounts for both input and output args switch (num_kernel_args) { - case 2: return reinterpret_cast(execute_kernel_unary); - case 3: return reinterpret_cast(execute_kernel_binary); - default: OV_CPU_JIT_EMITTER_THROW("More than two arguments are not supported"); + case 2: + return reinterpret_cast(execute_kernel_unary); + case 3: + return reinterpret_cast(execute_kernel_binary); + default: + OV_CPU_JIT_EMITTER_THROW("More than two arguments are not supported"); } } @@ -64,11 +70,11 @@ class DebugTppEmitter : public TppEmitter { } private: - std::shared_ptr m_original {nullptr}; - uintptr_t m_compiled_kernel {0}; - uintptr_t m_execute_function {0}; - snippets::lowered::ExpressionPtr m_source_expr {nullptr}; + std::shared_ptr m_original{nullptr}; + uintptr_t m_compiled_kernel{0}; + uintptr_t m_execute_function{0}; + snippets::lowered::ExpressionPtr m_source_expr{nullptr}; }; -} // namespace intel_cpu -} // namespace ov +} // namespace intel_cpu +} // namespace ov diff --git a/src/plugins/intel_cpu/src/emitters/utils.cpp b/src/plugins/intel_cpu/src/emitters/utils.cpp index 9743ac4638cca4..81066b9ed48ccb 100644 --- a/src/plugins/intel_cpu/src/emitters/utils.cpp +++ b/src/plugins/intel_cpu/src/emitters/utils.cpp @@ -20,7 +20,7 @@ std::string jit_emitter_pretty_name(const std::string& pretty_func) { // GCC: void foo() [with T = {type}] // clang: void foo() [T = {type}] // MSVC: void __cdecl foo<{type}>(void) - SAFE_SYMBOL_FINDING(parenthesis, pretty_func.find("(")) + SAFE_SYMBOL_FINDING(parenthesis, pretty_func.find('(')) if (pretty_func[parenthesis - 1] == '>') { // To cover template on MSVC parenthesis--; size_t counter = 1; @@ -33,7 +33,7 @@ std::string jit_emitter_pretty_name(const std::string& pretty_func) { } } SAFE_SYMBOL_FINDING(end, pretty_func.substr(0, parenthesis).rfind("::")) - SAFE_SYMBOL_FINDING(begin, pretty_func.substr(0, end).rfind(" ")) + SAFE_SYMBOL_FINDING(begin, pretty_func.substr(0, end).rfind(' ')) begin++; #undef SAFE_SYMBOL_FINDING return end > begin ? pretty_func.substr(begin, end - begin) : pretty_func; diff --git a/src/plugins/intel_cpu/src/graph.cpp b/src/plugins/intel_cpu/src/graph.cpp index cd7944b7246ef9..01371d64b779a0 100644 --- a/src/plugins/intel_cpu/src/graph.cpp +++ b/src/plugins/intel_cpu/src/graph.cpp @@ -60,7 +60,7 @@ Graph::~Graph() { } template -void Graph::CreateGraph(NET& model, const GraphContext::CPtr context) { +void Graph::CreateGraph(NET& model, const GraphContext::CPtr& context) { OV_ITT_SCOPE(FIRST_INFERENCE, itt::domains::intel_cpu_LT, "CreateGraph"); Init(model, context); @@ -70,7 +70,7 @@ void Graph::CreateGraph(NET& model, const GraphContext::CPtr context) { void Graph::CreateGraph(const std::vector& graphNodes, const std::vector& graphEdges, - const GraphContext::CPtr context, + const GraphContext::CPtr& context, std::string name) { if (IsReady()) ForgetGraphData(); @@ -85,7 +85,7 @@ void Graph::CreateGraph(const std::vector& graphNodes, std::size_t parameter_index = 0; std::size_t result_index = 0; - for (auto node : graphNodes) { + for (const auto& node : graphNodes) { if ("Parameter" == node->getTypeStr()) { inputNodesMap[parameter_index] = node; parameter_index++; @@ -100,7 +100,7 @@ void Graph::CreateGraph(const std::vector& graphNodes, Activate(); } -template void Graph::CreateGraph(const std::shared_ptr&, const GraphContext::CPtr); +template void Graph::CreateGraph(const std::shared_ptr&, const GraphContext::CPtr&); void Graph::Replicate(const std::shared_ptr& model, const std::vector& inputConfigs, @@ -116,8 +116,8 @@ void Graph::Replicate(const std::shared_ptr& model, // Will be stored as fake output separately. std::deque> unusedOutputs; - auto getParentOutputPort = [](const std::shared_ptr childOp, - const std::shared_ptr parentOp, + auto getParentOutputPort = [](const std::shared_ptr& childOp, + const std::shared_ptr& parentOp, const size_t childInputPort) -> int { for (size_t parentPort = 0; parentPort < parentOp->get_output_size(); parentPort++) { if (childOp->input(childInputPort).get_tensor_ptr() == parentOp->output(parentPort).get_tensor_ptr()) { @@ -128,7 +128,7 @@ void Graph::Replicate(const std::shared_ptr& model, return -1; }; - auto createNode = [&](std::shared_ptr op) -> NodePtr { + auto createNode = [&](const std::shared_ptr& op) -> NodePtr { // special handling for Parameters and Results if (op->get_type_info() == op::v0::Parameter::get_type_info_static()) { auto input_index = model->get_parameter_index(ov::as_type_ptr(op)); @@ -313,7 +313,7 @@ static std::tuple, std::vector> ExtractExecutableNo } void Graph::Init(const std::shared_ptr& model, - const GraphContext::CPtr context, + const GraphContext::CPtr& context, const std::vector& inputConfigs, const std::vector& outputConfigs) { if (IsReady()) @@ -640,7 +640,7 @@ static std::unordered_set getUniqueLayerNames(const std::vector uniqueLayerNames; uniqueLayerNames.reserve(graphNodes.size()); - for (auto node : graphNodes) { + for (const auto& node : graphNodes) { uniqueLayerNames.insert(node->getName()); } @@ -704,13 +704,13 @@ void Graph::ResolveComplexInplaceConflicts() { if (portChildEdges.size() > 1) { if (auto modifyingNode = edge->modifiedInPlace()) { auto execIndex = modifyingNode->getExecIndex(); - for (auto pEdgePeer : portChildEdges) { + for (const auto& pEdgePeer : portChildEdges) { if (pEdgePeer == edge) continue; std::vector vecConsumers; pEdgePeer->collectConsumers(vecConsumers); - for (auto node : vecConsumers) { + for (const auto& node : vecConsumers) { if (node->getExecIndex() >= execIndex || one_of(node->getType(), Type::MemoryOutput, Type::Output)) { return true; @@ -731,7 +731,7 @@ void Graph::ResolveComplexInplaceConflicts() { } } -static inline bool isConstOutput(EdgePtr edge) { +static inline bool isConstOutput(const EdgePtr& edge) { return edge->getParent()->isConstant() && !edge->getChild()->isConstant(); } @@ -1506,7 +1506,7 @@ void Graph::SortTopologically() { int execIndexCnt = -1; std::function visit; - visit = [&execIndexCnt, &sorted, &visit](const NodePtr node) { + visit = [&execIndexCnt, &sorted, &visit](const NodePtr& node) { if (node->execIndex >= 0) return; // already visited @@ -1563,7 +1563,6 @@ void Graph::GetPerfData(std::vector& perfMap) const { [&](std::vector& perfMap, const NodePtr& node) { ov::ProfilingInfo pc; pc.node_name = node->getName(); - // pc.execution_index = i++; uint64_t avg_time = node->PerfCounter().avg(); pc.cpu_time = pc.real_time = std::chrono::microseconds(avg_time); pc.status = avg_time > 0 ? ov::ProfilingInfo::Status::EXECUTED : ov::ProfilingInfo::Status::NOT_RUN; @@ -1571,11 +1570,11 @@ void Graph::GetPerfData(std::vector& perfMap) const { pc.node_type = node->typeStr; perfMap.emplace_back(pc); - for (auto& fusedNode : node->fusedWith) { + for (const auto& fusedNode : node->fusedWith) { getPerfMapFor(perfMap, fusedNode); } - for (auto& mergedWith : node->mergedWith) { + for (const auto& mergedWith : node->mergedWith) { getPerfMapFor(perfMap, mergedWith); } }; @@ -1604,7 +1603,7 @@ void Graph::RemoveEdge(const EdgePtr& edge) { graphEdges.erase(std::remove(graphEdges.begin(), graphEdges.end(), edge), graphEdges.end()); } -void Graph::AddNode(NodePtr node) { +void Graph::AddNode(const NodePtr& node) { assert(node); assert(std::find(graphNodes.begin(), graphNodes.end(), node) == graphNodes.end()); @@ -1716,8 +1715,8 @@ void Graph::RemoveDroppedEdges() { graphEdges.end()); } -NodePtr Graph::InsertReorder(EdgePtr edge, - std::string layerName, +NodePtr Graph::InsertReorder(const EdgePtr& edge, + const std::string& layerName, const MemoryDesc& inDesc, const MemoryDesc& outDesc, bool isOptimized, @@ -1751,7 +1750,7 @@ NodePtr Graph::InsertReorder(EdgePtr edge, return reorder; } -bool Graph::InsertNode(EdgePtr edge, NodePtr node, bool initNode) { +bool Graph::InsertNode(const EdgePtr& edge, const NodePtr& node, bool initNode) { auto oIndex = edge->getOutputNum(); auto iIndex = edge->getInputNum(); if (iIndex < 0 || oIndex < 0) @@ -1768,7 +1767,12 @@ bool Graph::InsertNode(EdgePtr edge, NodePtr node, bool initNode) { return InsertNode(edge->getParent(), edge->getChild(), node, iIndex, oIndex, initNode); } -bool Graph::InsertNode(NodePtr parent, NodePtr child, NodePtr node, int parentPort, int childPort, bool initNode) { +bool Graph::InsertNode(const NodePtr& parent, + const NodePtr& child, + const NodePtr& node, + int parentPort, + int childPort, + bool initNode) { CreateEdge(parent, node, parentPort, 0); CreateEdge(node, child, 0, childPort); AddNode(node); diff --git a/src/plugins/intel_cpu/src/graph.h b/src/plugins/intel_cpu/src/graph.h index 244995203ded2a..b28d2983104682 100644 --- a/src/plugins/intel_cpu/src/graph.h +++ b/src/plugins/intel_cpu/src/graph.h @@ -65,11 +65,11 @@ class Graph { } template - void CreateGraph(NET& model, const GraphContext::CPtr context); + void CreateGraph(NET& model, const GraphContext::CPtr& context); void CreateGraph(const std::vector& graphNodes, const std::vector& graphEdges, - const GraphContext::CPtr context, + const GraphContext::CPtr& context, std::string name); void PushInputData(const std::size_t& index, const ov::SoPtr& input); @@ -141,7 +141,7 @@ class Graph { void RemoveEdge(const EdgePtr& edge); void RemoveDroppedNodes(); void RemoveDroppedEdges(); - void AddNode(NodePtr node); + void AddNode(const NodePtr& node); void DropNode(const NodePtr& node); void DropDWConvNode(const NodePtr& node); @@ -166,8 +166,8 @@ class Graph { * pointer to the blob containing scales * @return pointer to the new Reorder node. */ - NodePtr InsertReorder(EdgePtr edge, - std::string layerName, + NodePtr InsertReorder(const EdgePtr& edge, + const std::string& layerName, const MemoryDesc& inDesc, const MemoryDesc& outDesc, bool isOptimized = false, @@ -186,7 +186,7 @@ class Graph { * parameter that determines whether the node needs to be initialized * @return true in case of success, false otherwise. */ - bool InsertNode(EdgePtr edge, NodePtr node, bool initNode = false); + bool InsertNode(const EdgePtr& edge, const NodePtr& node, bool initNode = false); /** * @brief Insert Node between two specified nodes. @@ -206,7 +206,12 @@ class Graph { * parameter that determines whether the node needs to be initialized * @return true in case of success, false otherwise. */ - bool InsertNode(NodePtr parent, NodePtr child, NodePtr node, int parentPort, int childPort, bool initNode = false); + bool InsertNode(const NodePtr& parent, + const NodePtr& child, + const NodePtr& node, + int parentPort, + int childPort, + bool initNode = false); std::shared_ptr dump() const; @@ -224,7 +229,7 @@ class Graph { * Init graph using \p model, \p context, \p inputConfigs and \p outputConfigs */ void Init(const std::shared_ptr& model, - const GraphContext::CPtr context, + const GraphContext::CPtr& context, const std::vector& inputConfigs = {}, const std::vector& outputConfigs = {}); diff --git a/src/plugins/intel_cpu/src/graph_context.cpp b/src/plugins/intel_cpu/src/graph_context.cpp index 0112392cb54b45..e7dd513fa2f790 100644 --- a/src/plugins/intel_cpu/src/graph_context.cpp +++ b/src/plugins/intel_cpu/src/graph_context.cpp @@ -3,38 +3,40 @@ // #include "graph_context.h" -#include "dnnl_types.h" +#include + +#include "config.h" #include "memory_control.hpp" #include "nodes/memory.hpp" namespace ov { namespace intel_cpu { -GraphContext::GraphContext(const Config& config, +GraphContext::GraphContext(Config config, WeightsSharing::Ptr w_cache, bool isGraphQuantized, ov::threading::IStreamsExecutor::Ptr streamExecutor, std::shared_ptr sub_memory_manager) - : config(config), - weightsCache(std::move(w_cache)), - isGraphQuantizedFlag(isGraphQuantized), - streamExecutor(streamExecutor), - subMemoryManager(std::move(sub_memory_manager)), - memoryStatesRegister(std::make_shared()), - networkMemoryControl(std::make_shared()) { - rtParamsCache = std::make_shared(config.rtCacheCapacity); - // primitive/executors can be shared across sub-stream - // but scratch pad cannot be shared. - numNumaNodes = 1; + : m_config(std::move(config)), + m_weightsCache(std::move(w_cache)), + m_rtParamsCache(std::make_shared(m_config.rtCacheCapacity)), + m_isGraphQuantizedFlag(isGraphQuantized), + m_streamExecutor(std::move(streamExecutor)), + m_subMemoryManager(std::move(sub_memory_manager)), + m_numNumaNodes(1), + m_memoryStatesRegister(std::make_shared()), + m_networkMemoryControl(std::make_shared()) { if (streamExecutor) { - cpuStreamExecutor = std::dynamic_pointer_cast(streamExecutor); - numaNodeId = cpuStreamExecutor ? cpuStreamExecutor->get_numa_node_id() : 0; + m_cpuStreamExecutor = std::dynamic_pointer_cast(streamExecutor); + m_numaNodeId = m_cpuStreamExecutor ? m_cpuStreamExecutor->get_numa_node_id() : 0; auto nNumaNodes = get_num_numa_nodes(); - if (numNumaNodes < nNumaNodes) - numNumaNodes = nNumaNodes; + if (m_numNumaNodes < nNumaNodes) + m_numNumaNodes = nNumaNodes; } - for (int i = 0; i < numNumaNodes; i++) { - rtScratchPads.push_back(std::make_shared(getEngine(), i)); + // primitive/executors can be shared across sub-stream + // but scratch pad cannot be shared. + for (int i = 0; i < m_numNumaNodes; i++) { + m_rtScratchPads.push_back(std::make_shared(getEngine(), i)); } } diff --git a/src/plugins/intel_cpu/src/graph_context.h b/src/plugins/intel_cpu/src/graph_context.h index 1b7a0f0578734d..8389bc389505fe 100644 --- a/src/plugins/intel_cpu/src/graph_context.h +++ b/src/plugins/intel_cpu/src/graph_context.h @@ -25,81 +25,81 @@ class GraphContext { typedef std::shared_ptr Ptr; typedef std::shared_ptr CPtr; - GraphContext(const Config& config, + GraphContext(Config config, WeightsSharing::Ptr w_cache, bool isGraphQuantized, ov::threading::IStreamsExecutor::Ptr streamExecutor = nullptr, std::shared_ptr sub_memory_manager = nullptr); const Config& getConfig() const { - return config; + return m_config; } WeightsSharing::Ptr getWeightsCache() const { - return weightsCache; + return m_weightsCache; } MultiCachePtr getParamsCache() const { - return rtParamsCache; + return m_rtParamsCache; } DnnlScratchPadPtr getScratchPad() const { - return rtScratchPads[numaNodeId]; + return m_rtScratchPads[m_numaNodeId]; } const std::vector& getScratchPads() const { - return rtScratchPads; + return m_rtScratchPads; } static const dnnl::engine& getEngine(); bool isGraphQuantized() const { - return isGraphQuantizedFlag; + return m_isGraphQuantizedFlag; } ov::threading::CPUStreamsExecutor::Ptr getCPUStreamExecutor() const { - return cpuStreamExecutor; + return m_cpuStreamExecutor; } std::shared_ptr getSubMemory() const { - return subMemoryManager; + return m_subMemoryManager; } int getNumNumaNodes() const { - return numNumaNodes; + return m_numNumaNodes; } const std::shared_ptr& getMemoryStatesRegister() const { - return memoryStatesRegister; + return m_memoryStatesRegister; } const std::shared_ptr& getNetworkMemoryControl() const { - return networkMemoryControl; + return m_networkMemoryControl; } private: - Config config; // network-level config + Config m_config; // network-level config - WeightsSharing::Ptr weightsCache; // per NUMA node caches for sharing weights data + WeightsSharing::Ptr m_weightsCache; // per NUMA node caches for sharing weights data - MultiCachePtr rtParamsCache; // primitive cache - DnnlScratchPadPtr rtScratchPad; // scratch pad + MultiCachePtr m_rtParamsCache; // primitive cache + DnnlScratchPadPtr m_rtScratchPad; // scratch pad - bool isGraphQuantizedFlag = false; + bool m_isGraphQuantizedFlag = false; - std::vector rtScratchPads; // scratch pad (each sub-stream has its own copy) + std::vector m_rtScratchPads; // scratch pad (each sub-stream has its own copy) - ov::threading::IStreamsExecutor::Ptr streamExecutor; // stream executor for current graph + ov::threading::IStreamsExecutor::Ptr m_streamExecutor; // stream executor for current graph - ov::threading::CPUStreamsExecutor::Ptr cpuStreamExecutor; // cpu stream executor for current graph + ov::threading::CPUStreamsExecutor::Ptr m_cpuStreamExecutor; // cpu stream executor for current graph - std::shared_ptr subMemoryManager; + std::shared_ptr m_subMemoryManager; - int numNumaNodes = 1; - int numaNodeId = 0; + int m_numNumaNodes = 1; + int m_numaNodeId = 0; - std::shared_ptr memoryStatesRegister; - std::shared_ptr networkMemoryControl; + std::shared_ptr m_memoryStatesRegister; + std::shared_ptr m_networkMemoryControl; }; } // namespace intel_cpu diff --git a/src/plugins/intel_cpu/src/graph_dumper.cpp b/src/plugins/intel_cpu/src/graph_dumper.cpp index 6efa78f38e1eb5..73c99a52156ad6 100644 --- a/src/plugins/intel_cpu/src/graph_dumper.cpp +++ b/src/plugins/intel_cpu/src/graph_dumper.cpp @@ -307,6 +307,7 @@ void summary_perf(const Graph& graph) { { std::cout << " perf_by_type:" << std::endl; std::vector> A; + A.reserve(perf_by_type.size()); for (auto& it : perf_by_type) A.push_back(it); sort(A.begin(), A.end(), [](std::pair& a, std::pair& b) { @@ -326,6 +327,7 @@ void summary_perf(const Graph& graph) { { std::cout << " perf_by_node:" << std::endl; std::vector> A; + A.reserve(perf_by_node.size()); for (auto& it : perf_by_node) A.push_back(it); sort(A.begin(), A.end(), [](std::pair& a, std::pair& b) { @@ -383,7 +385,7 @@ void average_counters(const Graph& graph) { return std::chrono::microseconds(value).count() / 1000.0; }; - auto printAverageCounter = [&toMs, &file](NodePtr node) { + auto printAverageCounter = [&toMs, &file](const NodePtr& node) { const uint64_t avg = node->PerfCounter().avg(); const std::string status = avg > 0 ? "EXECUTED" : "NOT_RUN"; const auto cpuTime = toMs(avg); diff --git a/src/plugins/intel_cpu/src/graph_optimizer.cpp b/src/plugins/intel_cpu/src/graph_optimizer.cpp index cb1324e7435703..95ba27f3fa0828 100644 --- a/src/plugins/intel_cpu/src/graph_optimizer.cpp +++ b/src/plugins/intel_cpu/src/graph_optimizer.cpp @@ -208,7 +208,7 @@ void GraphOptimizer::ApplyImplSpecificGraphOptimizations(Graph& graph) { void GraphOptimizer::FuseConvMatmulFCDeconvAndDQScales(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isDQScaleGraphPattern = [](NodePtr node) { + auto isDQScaleGraphPattern = [](const NodePtr& node) { if (node->getType() != Type::Eltwise || node->getAlgorithm() != Algorithm::EltwiseMultiply) { return false; } @@ -225,7 +225,7 @@ void GraphOptimizer::FuseConvMatmulFCDeconvAndDQScales(Graph& graph) { return (parentNode->getParentEdges().size() == 2); }; - auto scaleDimsCheck = [](NodePtr node, NodePtr scales) { + auto scaleDimsCheck = [](const NodePtr& node, const NodePtr& scales) { const auto nodeOutDims = node->getOutputShapeAtPort(0).getDims(); const auto channelAxis = node->getFusingAxis(); auto OC = nodeOutDims[channelAxis]; @@ -249,7 +249,7 @@ void GraphOptimizer::FuseConvMatmulFCDeconvAndDQScales(Graph& graph) { return true; }; - auto initializeDeQuantizedScales = [](NodePtr node, NodePtr scales) { + auto initializeDeQuantizedScales = [](const NodePtr& node, const NodePtr& scales) { auto scalesConstant = dynamic_cast(scales.get()); if (scalesConstant == nullptr) OPENVINO_THROW("Cannot cast to Input node"); @@ -458,7 +458,7 @@ void GraphOptimizer::FuseConvolutionMatMulDeconvAndBias(Graph& graph) { void GraphOptimizer::FuseDeconvolutionAndSimpleOperation(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableParentNode = [](NodePtr node) { + auto isSuitableParentNode = [](const NodePtr& node) { if (node->getType() != Type::Deconvolution || node->getChildEdges().size() != 1) return false; const auto deconv = std::dynamic_pointer_cast(node); @@ -771,13 +771,13 @@ void GraphOptimizer::FuseFCAndTransposeOnWeights(Graph& graph) { // reordering in FC node auto& graphNodes = graph.GetNodes(); - auto isSuitablePattern = [](NodePtr parent) { + auto isSuitablePattern = [](const NodePtr& parent) { bool res = true && parent->getType() == Type::Transpose && parent->getChildEdges().size() == 1 && parent->getChildEdgeAt(0)->getChild()->getType() == Type::FullyConnected && parent->isConstant(); return res; }; - for (auto parent : graphNodes) { + for (const auto& parent : graphNodes) { if (isSuitablePattern(parent)) { CPU_GRAPH_OPTIMIZER_SCOPE(FuseFCAndTransposeOnWeights); auto fcNode = std::dynamic_pointer_cast(parent->getChildEdgeAt(0)->getChild()); @@ -791,7 +791,7 @@ void GraphOptimizer::FuseFCAndTransposeOnWeights(Graph& graph) { void GraphOptimizer::FuseConvolutionAndZeroPoints(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableConvNode = [](NodePtr node) { + auto isSuitableConvNode = [](const NodePtr& node) { bool retVal = false; if (node->getType() == Type::Convolution) { if (auto convNode = std::dynamic_pointer_cast(node)) { @@ -805,7 +805,7 @@ void GraphOptimizer::FuseConvolutionAndZeroPoints(Graph& graph) { return retVal; }; - auto initializeInputZeroPoints = [](NodePtr node, NodePtr parent0, NodePtr parent1) { + auto initializeInputZeroPoints = [](const NodePtr& node, const NodePtr& parent0, const NodePtr& parent1) { auto* convNode = dynamic_cast(node.get()); if (convNode == nullptr) OPENVINO_THROW("Cannot get convolution node ", node->getName()); @@ -880,7 +880,7 @@ void GraphOptimizer::FuseConvolutionAndZeroPoints(Graph& graph) { return true; }; - auto initializeOutputCompensation = [](NodePtr node) { + auto initializeOutputCompensation = [](const NodePtr& node) { auto* convNode = dynamic_cast(node.get()); if (convNode == nullptr) OPENVINO_THROW("Cannot get convolution node ", node->getName()); @@ -969,7 +969,7 @@ void GraphOptimizer::FuseConvolutionAndZeroPoints(Graph& graph) { void GraphOptimizer::FuseFullyConnectedAndSimpleOperation(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableParentNode = [](NodePtr node) { + auto isSuitableParentNode = [](const NodePtr& node) { return node->getType() == Type::FullyConnected && node->getChildEdges().size() == 1; }; @@ -1058,7 +1058,7 @@ void GraphOptimizer::FuseConvolutionAndDWConvolution(Graph& graph) { return conv->getWeightDims()[weightRank - 1] == 1 && conv->getWeightDims()[weightRank - 2] == 1; }; - auto isSuitableParentConvolution = [&](NodePtr node) { + auto isSuitableParentConvolution = [&](const NodePtr& node) { if (node->isDropped()) return false; @@ -1214,7 +1214,7 @@ void GraphOptimizer::FuseConvolutionAndDWConvolution(Graph& graph) { void GraphOptimizer::FuseConvolutionAndSimpleOperationThroughMaxPool(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableParentNode = [](NodePtr node) { + auto isSuitableParentNode = [](const NodePtr& node) { return (node->getType() == Type::Convolution || node->getType() == Type::BinaryConvolution) && node->getChildEdges().size() == 1 && node->getOriginalOutputPrecisionAtPort(0) == ov::element::f32; }; @@ -1269,7 +1269,7 @@ void GraphOptimizer::FuseConvolutionAndSimpleOperationThroughMaxPool(Graph& grap void GraphOptimizer::FuseConvolutionAndSimpleOperation(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableParentNode = [](NodePtr node) { + auto isSuitableParentNode = [](const NodePtr& node) { return (node->getType() == Type::Convolution || node->getType() == Type::BinaryConvolution) && node->getChildEdges().size() == 1; }; @@ -1312,7 +1312,7 @@ void GraphOptimizer::FuseConvolutionAndSimpleOperation(Graph& graph) { void GraphOptimizer::FusePoolingAndFakeQuantize(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableParentNode = [](NodePtr node) { + auto isSuitableParentNode = [](const NodePtr& node) { if (node->getType() == Type::Pooling) { if (!one_of(node->getOriginalInputPrecisionAtPort(0), ov::element::u8, ov::element::i8)) return false; @@ -1321,7 +1321,7 @@ void GraphOptimizer::FusePoolingAndFakeQuantize(Graph& graph) { return false; }; - auto isSuitableChildNode = [](NodePtr node) { + auto isSuitableChildNode = [](const NodePtr& node) { return node->getType() == Type::FakeQuantize && node->getAlgorithm() != Algorithm::FQBinarization; }; @@ -1426,7 +1426,7 @@ void GraphOptimizer::FuseConvolutionSumAndConvolutionSumActivation(Graph& graph) auto& graphNodes = graph.GetNodes(); - auto isFusingSupported = [&](NodePtr conv, NodePtr child) { + auto isFusingSupported = [&](const NodePtr& conv, const NodePtr& child) { return child->getType() == Type::Eltwise && DnnlExtensionUtils::isUnarySupportedAsPostOp(child->getAlgorithm()); }; @@ -1449,7 +1449,7 @@ void GraphOptimizer::FuseConvolutionSumAndConvolutionSumActivation(Graph& graph) bool isSuitableParent2 = parent2->getType() == Type::Convolution || parent2->getType() == Type::BinaryConvolution; - auto canFuseSum = [](node::BinaryConvolution* binConv, NodePtr fuseCandidate) { + auto canFuseSum = [](node::BinaryConvolution* binConv, const NodePtr& fuseCandidate) { if (binConv->getImplType() == impl_desc_type::ref) return false; @@ -1549,7 +1549,7 @@ void GraphOptimizer::FuseConvolutionSumAndConvolutionSumActivation(Graph& graph) } if (peerNode->isConstant()) continue; - auto sum = graphNode; + const auto& sum = graphNode; if (mergedConv->isConstant() && !sum->isConstant()) continue; @@ -1661,7 +1661,7 @@ void GraphOptimizer::FuseConvolutionSumAndConvolutionSumActivation(Graph& graph) void GraphOptimizer::FuseMVNAndSimpleOperation(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableParentNode = [](NodePtr node) { + auto isSuitableParentNode = [](const NodePtr& node) { return (node->getType() == Type::MVN) && (node->getChildEdges().size() == 1); }; @@ -1701,11 +1701,11 @@ void GraphOptimizer::FuseMVNAndSimpleOperation(Graph& graph) { void GraphOptimizer::FuseInterpolateAndSimpleOperation(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableParentNode = [](NodePtr node) { + auto isSuitableParentNode = [](const NodePtr& node) { return node->getType() == Type::Interpolate && node->getChildEdges().size() == 1; }; - auto isSuitableChildNode = [&](NodePtr parentNode, NodePtr childNode) { + auto isSuitableChildNode = [&](const NodePtr& parentNode, const NodePtr& childNode) { // Avoid cycle dependencies for (auto& childParentEdge : childNode->getParentEdges()) { for (auto& parentParentEdge : parentNode->getParentEdges()) { @@ -1760,7 +1760,7 @@ void GraphOptimizer::FuseInterpolateAndSimpleOperation(Graph& graph) { void GraphOptimizer::FuseNormalizeL2AndSimpleOperation(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableParentNode = [](NodePtr node) { + auto isSuitableParentNode = [](const NodePtr& node) { return node->getType() == Type::NormalizeL2 && node->getChildEdges().size() == 1; }; @@ -1800,7 +1800,7 @@ void GraphOptimizer::FuseNormalizeL2AndSimpleOperation(Graph& graph) { void GraphOptimizer::FuseReduceAndSimpleOperation(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableParentNode = [](NodePtr node) { + auto isSuitableParentNode = [](const NodePtr& node) { return node->getType() == Type::Reduce && node->getChildEdges().size() == 1; }; @@ -1842,11 +1842,11 @@ void GraphOptimizer::FuseReduceAndSimpleOperation(Graph& graph) { void GraphOptimizer::FuseEltwiseAndSimple(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableParentNode = [](NodePtr node) { + auto isSuitableParentNode = [](const NodePtr& node) { return node->getType() == Type::Eltwise && node->getChildEdges().size() == 1; }; - auto isSuitableChildNode = [&](NodePtr parentNode, NodePtr childNode) { + auto isSuitableChildNode = [&](const NodePtr& parentNode, const NodePtr& childNode) { if (parentNode->isConstant() && !childNode->isConstant()) return false; for (auto& childParentEdge : childNode->getParentEdges()) { @@ -1972,7 +1972,7 @@ void GraphOptimizer::FuseEltwiseAndSimple(Graph& graph) { } void GraphOptimizer::ShareReorders(Graph& graph) { - auto getSuitableReorder = [](NodePtr node) -> Reorder* { + auto getSuitableReorder = [](const NodePtr& node) -> Reorder* { if (node->getType() != Type::Reorder) return nullptr; Reorder* reorder = dynamic_cast(node.get()); @@ -1981,7 +1981,7 @@ void GraphOptimizer::ShareReorders(Graph& graph) { // inplace children cannot be safely shared with each other auto reorderConsumers = reorder->getChildEdgesAtPort(0); - if (std::any_of(reorderConsumers.begin(), reorderConsumers.end(), [](EdgePtr e) { + if (std::any_of(reorderConsumers.begin(), reorderConsumers.end(), [](const EdgePtr& e) { return e->inPlace(Edge::LOOK_DOWN); })) return nullptr; @@ -2014,13 +2014,13 @@ void GraphOptimizer::ShareReorders(Graph& graph) { DEBUG_LOG(node->getName(), " is shared by ", siblingNode->getName()); // siblingReorder can share output with current reorder - for (auto pwEdge : siblingReorder->getParentEdges()) { + for (const auto& pwEdge : siblingReorder->getParentEdges()) { auto pEdge = pwEdge.lock(); if (pEdge) graph.RemoveEdge(pEdge); } - for (auto pwEdge : siblingReorder->getChildEdges()) { + for (const auto& pwEdge : siblingReorder->getChildEdges()) { auto pEdge = pwEdge.lock(); if (pEdge) { graph.RemoveEdge(pEdge); @@ -2079,16 +2079,16 @@ void GraphOptimizer::DropDoubleReorders(Graph& graph) { void GraphOptimizer::FuseClampAndFakeQuantize(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableClampNode = [](NodePtr node) { + auto isSuitableClampNode = [](const NodePtr& node) { return node->getType() == Type::Eltwise && node->getChildEdges().size() == 1 && node->getAlgorithm() == Algorithm::EltwiseClamp; }; - auto isSuitableFakeQuantizeNode = [](NodePtr node) { + auto isSuitableFakeQuantizeNode = [](const NodePtr& node) { return node->getType() == Type::FakeQuantize && node->getAlgorithm() != Algorithm::FQBinarization; }; - auto fuseClampAndFakeQuantizeNodes = [](NodePtr parent, NodePtr child) { + auto fuseClampAndFakeQuantizeNodes = [](const NodePtr& parent, const NodePtr& child) { auto* eltwiseNode = dynamic_cast(parent.get()); if (eltwiseNode == nullptr) OPENVINO_THROW("Cannot cast ", parent->getName(), " to Eltwise node"); @@ -2393,7 +2393,7 @@ void GraphOptimizer::mergeTransposeReshapeReorder(Graph& graph, // hold references to all children before dropping reorder_node std::vector> reorderChildren; - for (auto ccEdge : childNode->getChildEdgesAtPort(0)) + for (const auto& ccEdge : childNode->getChildEdgesAtPort(0)) reorderChildren.emplace_back(ccEdge->getChild(), ccEdge->getOutputNum()); // detach nodes from graph by remove all of their edges @@ -2503,9 +2503,9 @@ void GraphOptimizer::mergeTransposeReshapeReorder(Graph& graph, void GraphOptimizer::MergeTransposeAndReorder(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableTranspose = [](NodePtr node) { + auto isSuitableTranspose = [](const NodePtr& node) { // WA: to avoid broken memory pointer for conv + sum - auto prevNodeIsConvSum = [](NodePtr node) -> bool { + auto prevNodeIsConvSum = [](const NodePtr& node) -> bool { const auto parent = node->getParentEdgeAt(0)->getParent(); if (parent->getType() == Type::Convolution) { for (const auto& fusedNode : parent->getFusedWith()) { @@ -2526,7 +2526,7 @@ void GraphOptimizer::MergeTransposeAndReorder(Graph& graph) { && !prevNodeIsConvSum(node); }; - auto isSuitableReshape = [](NodePtr node) { + auto isSuitableReshape = [](const NodePtr& node) { if (node->getChildEdges().size() != 1 || node->getOutputShapeAtPort(0).isDynamic() || node->getInputShapeAtPort(0).isDynamic()) return false; @@ -2547,13 +2547,13 @@ void GraphOptimizer::MergeTransposeAndReorder(Graph& graph) { return mismatchCount == 1; }; - auto isSuitableReorder = [](NodePtr node) { + auto isSuitableReorder = [](const NodePtr& node) { return node->getType() == Type::Reorder && !node->isDynamicNode(); // TODO [DS]: enable for dynamic shapes when inPlace in the dynamic case is // available (CVS-74863) }; - auto updateOrder = [](const VectorDims& originalOrder, NodePtr reshape) { + auto updateOrder = [](const VectorDims& originalOrder, const NodePtr& reshape) { if (!reshape) return originalOrder; @@ -2653,11 +2653,11 @@ void GraphOptimizer::MergeTransposeAndReorder(Graph& graph) { void GraphOptimizer::MergeReorderAndTranspose(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableTranspose = [](NodePtr node) { + auto isSuitableTranspose = [](const NodePtr& node) { return node->getType() == Type::Transpose && node->getChildEdges().size() == 1 && !node->isDynamicNode(); }; - auto isSuitableReshape = [](NodePtr node) { + auto isSuitableReshape = [](const NodePtr& node) { if (node->getChildEdges().size() != 1 || node->getOutputShapeAtPort(0).isDynamic() || node->getInputShapeAtPort(0).isDynamic()) return false; @@ -2678,11 +2678,11 @@ void GraphOptimizer::MergeReorderAndTranspose(Graph& graph) { return mismatchCount == 1; }; - auto isSuitableReorder = [](NodePtr node) { + auto isSuitableReorder = [](const NodePtr& node) { return node->getType() == Type::Reorder && node->getChildEdges().size() == 1 && !node->isDynamicNode(); }; - auto updateOrder = [](const VectorDims& originalOrder, NodePtr reshape) { + auto updateOrder = [](const VectorDims& originalOrder, const NodePtr& reshape) { if (!reshape) return originalOrder; @@ -2780,7 +2780,7 @@ void GraphOptimizer::MergeReorderAndTranspose(Graph& graph) { void GraphOptimizer::reshapeRnnSeq(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableParentNode = [](NodePtr node) { + auto isSuitableParentNode = [](const NodePtr& node) { if (node->type != Type::RNNSeq) return false; auto rnnNode = std::dynamic_pointer_cast(node); @@ -2838,7 +2838,7 @@ So Convert is redundant." void GraphOptimizer::RemoveSameConvert(Graph& graph) { auto& graphNodes = graph.GetNodes(); - auto isSuitableParentNode = [](NodePtr parentNode) { + auto isSuitableParentNode = [](const NodePtr& parentNode) { return parentNode->getType() == Type::Convert && (parentNode->getOriginalOutputPrecisionAtPort(0) == parentNode->getOriginalInputPrecisionAtPort(0)); }; @@ -3148,7 +3148,7 @@ void GraphOptimizer::DropRedundantMemoryOutput(Graph& graph) { parentEdges.push_back(parentEdge); graph.CreateEdge(parent, memInputSingle, inputNum, parentEdge->getOutputNum()); } - for (auto parentEdge : parentEdges) { + for (const auto& parentEdge : parentEdges) { graph.RemoveEdge(parentEdge); } } diff --git a/src/plugins/intel_cpu/src/infer_request.cpp b/src/plugins/intel_cpu/src/infer_request.cpp index 023312ab5256d3..d3b0b4c534be2a 100644 --- a/src/plugins/intel_cpu/src/infer_request.cpp +++ b/src/plugins/intel_cpu/src/infer_request.cpp @@ -66,7 +66,7 @@ void SyncInferRequest::redefine_memory_for_input_nodes(Graph& graph) { void SyncInferRequest::update_external_tensor_ptrs() { // Update it due to batched_tensors case will update input tensor - for (auto input : m_input_ports_map) { + for (const auto& input : m_input_ports_map) { if (m_input_external_ptr.find(input.first) != m_input_external_ptr.end()) { auto tensor = get_tensor(input.second); m_input_external_ptr[input.first] = tensor; @@ -294,7 +294,7 @@ std::vector> SyncInferRequest::query_state() const if (m_asyncRequest->m_has_sub_infers) { auto requests = m_asyncRequest->getSubInferRequest(); std::vector> states; - for (auto request : requests) { + for (const auto& request : requests) { auto cur = request->query_state(); states.insert(states.end(), cur.begin(), cur.end()); } diff --git a/src/plugins/intel_cpu/src/memory_control.cpp b/src/plugins/intel_cpu/src/memory_control.cpp index 7b4e5e7ca0b973..757e3659c076d4 100644 --- a/src/plugins/intel_cpu/src/memory_control.cpp +++ b/src/plugins/intel_cpu/src/memory_control.cpp @@ -5,6 +5,7 @@ #include "memory_control.hpp" #include +#include #include "node.h" #include "openvino/runtime/memory_solver.hpp" @@ -188,7 +189,7 @@ class MemoryManageNonOverlapingSets : public IMemoryManager { } } } - m_boxes.emplace_back(std::move(box)); + m_boxes.emplace_back(box); } const MemoryControl::MemoryBlockMap& lastSolution() override { @@ -429,4 +430,4 @@ void NetworkMemoryControl::releaseMemory() { } } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc_utils.cpp b/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc_utils.cpp index 914a52b1b9f8d3..f946282b9ad194 100644 --- a/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc_utils.cpp +++ b/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc_utils.cpp @@ -115,7 +115,7 @@ std::shared_ptr MemoryDescUtils::makeEmptyDesc() { return emptyDesc; } -std::shared_ptr MemoryDescUtils::makeEmptyMemory(const GraphContext::CPtr context) { +std::shared_ptr MemoryDescUtils::makeEmptyMemory(const GraphContext::CPtr& context) { return std::make_shared(context->getEngine(), makeEmptyDesc(), nullptr); } diff --git a/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc_utils.h b/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc_utils.h index 8bdd46e1d909b6..e548b779fe2f3f 100644 --- a/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc_utils.h +++ b/src/plugins/intel_cpu/src/memory_desc/cpu_memory_desc_utils.h @@ -73,7 +73,7 @@ class MemoryDescUtils { * @return empty memory descriptor */ static std::shared_ptr makeEmptyDesc(); - static std::shared_ptr makeEmptyMemory(const GraphContext::CPtr context); + static std::shared_ptr makeEmptyMemory(const GraphContext::CPtr& context); /** * @brief Makes a static dummy shape where all undefined values are replaced with the smallest value between the diff --git a/src/plugins/intel_cpu/src/memory_desc/dnnl_blocked_memory_desc.cpp b/src/plugins/intel_cpu/src/memory_desc/dnnl_blocked_memory_desc.cpp index b9d8a1c555dd3f..69b070e165df8b 100644 --- a/src/plugins/intel_cpu/src/memory_desc/dnnl_blocked_memory_desc.cpp +++ b/src/plugins/intel_cpu/src/memory_desc/dnnl_blocked_memory_desc.cpp @@ -235,7 +235,7 @@ DnnlBlockedMemoryDesc::DnnlBlockedMemoryDesc(const Shape& shape, if (format == memory::format_tag::any || format == memory::format_tag::undef) OPENVINO_THROW("Unexpected: Can't create dnnl::desc with any or undef format"); - const auto dims = shape.getDims(); + const auto& dims = shape.getDims(); if (format == memory::format_tag::x && shape.getRank() == 0) { desc = dnnl::memory::desc(dnnl::memory::dims(1, 1), dataType, format); } else { @@ -456,22 +456,22 @@ static dnnl::memory::desc cloneDescWithNewDims(const dnnl::memory::desc& desc, auto mklDims = DnnlExtensionUtils::convertToDnnlDims(dims); const auto offsetPadding = desc.get()->offset0; - dnnl::memory::desc newMklDesc = desc; + dnnl::memory::desc clonedDesc(DnnlExtensionUtils::clone_desc(desc.get())); - array_copy(newMklDesc.get()->dims, mklDims.data(), mklDims.size()); + array_copy(clonedDesc.get()->dims, mklDims.data(), mklDims.size()); dnnl::memory::dims perm(convert_to_vector(order.data(), mklDims.size())); - auto innerBlks = newMklDesc.get_inner_blks(); - auto innerIdxs = newMklDesc.get_inner_idxs(); + auto innerBlks = clonedDesc.get_inner_blks(); + auto innerIdxs = clonedDesc.get_inner_idxs(); - dnnl::impl::memory_desc_t& newCdesc = *newMklDesc.get(); - auto retCode = dnnl::impl::fill_blocked(newCdesc, perm, innerBlks, innerIdxs); + auto retCode = dnnl::impl::fill_blocked(*clonedDesc.get(), perm, innerBlks, innerIdxs); if (retCode != dnnl::impl::status::success) { OPENVINO_THROW("Can not clone DnnlBlockedMemoryDesc with dims: ", dims2str(dims)); } // dnnl::impl::fill_blocked always set offset0 to 0 // so we need to restore actual value - newCdesc.offset0 = offsetPadding; - return newMklDesc; + clonedDesc.get()->offset0 = offsetPadding; + + return clonedDesc; } MemoryDescPtr DnnlBlockedMemoryDesc::cloneWithNewDimsImp(const VectorDims& dims) const { diff --git a/src/plugins/intel_cpu/src/memory_state.cpp b/src/plugins/intel_cpu/src/memory_state.cpp index 6db8c1705108cc..570cddffc7daa1 100644 --- a/src/plugins/intel_cpu/src/memory_state.cpp +++ b/src/plugins/intel_cpu/src/memory_state.cpp @@ -6,6 +6,8 @@ #include +#include + #include "cpu_memory.h" #include "cpu_tensor.h" #include "dnnl_extension_utils.h" @@ -21,9 +23,9 @@ using namespace ov::Extensions::Cpu::XARCH; namespace ov { namespace intel_cpu { -VariableStateBase::VariableStateBase(const std::string& name, const MemoryDescPtr& external_desc) +VariableStateBase::VariableStateBase(const std::string& name, MemoryDescPtr external_desc) : IVariableState{name}, - m_external_desc{external_desc} {} + m_external_desc{std::move(external_desc)} {} MemoryDescPtr VariableStateBase::to_static(const MemoryDescPtr& desc) { if (!desc->isDefined()) { @@ -165,12 +167,12 @@ MemoryPtr VariableStateDoubleBuffer::internal_state_mem() const { } VariableStateSingleBuffer::VariableStateSingleBuffer(const std::string& name, - const MemoryPtr& external_buffer, - const MemoryDescPtr& external_desc) - : VariableStateBase(name, external_desc) { - OPENVINO_ASSERT(external_buffer); - m_internal_mem = external_buffer; - m_internal_desc = m_internal_mem->getDescPtr(); + MemoryPtr external_buffer, + MemoryDescPtr external_desc) + : VariableStateBase(name, std::move(external_desc)), + m_internal_mem(std::move(external_buffer)), + m_internal_desc(m_internal_mem->getDescPtr()) { + OPENVINO_ASSERT(m_internal_mem); auto&& shape = m_internal_desc->getShape(); if (shape.isStatic()) { @@ -208,11 +210,11 @@ void VariableStateSingleBuffer::commit_impl() { } VariableStateKVcache::VariableStateKVcache(const std::string& name, - const MemoryDescPtr& external_desc, - const BlockedMemoryDescPtr& dense_internal_desc) - : VariableStateBase(name, external_desc), - m_dense_internal_desc(dense_internal_desc) { - auto&& shape = external_desc->getShape(); + MemoryDescPtr external_desc, + BlockedMemoryDescPtr dense_internal_desc) + : VariableStateBase(name, std::move(external_desc)), + m_dense_internal_desc(std::move(dense_internal_desc)) { + auto&& shape = get_external_desc()->getShape(); OPENVINO_ASSERT(shape.isDynamic(), "VariableStateKVcache is unexpectedly initalized with a static tensor"); } diff --git a/src/plugins/intel_cpu/src/memory_state.h b/src/plugins/intel_cpu/src/memory_state.h index 5af05f486650a7..d8de35618952d6 100644 --- a/src/plugins/intel_cpu/src/memory_state.h +++ b/src/plugins/intel_cpu/src/memory_state.h @@ -27,7 +27,7 @@ class IVariableState : public ov::IVariableState { class VariableStateBase : public IVariableState { public: - VariableStateBase(const std::string& name, const MemoryDescPtr& external_desc); + VariableStateBase(const std::string& name, MemoryDescPtr external_desc); // ov::IVariableState void set_state(const ov::SoPtr& state) override final; // NOLINT @@ -96,9 +96,7 @@ class VariableStateDoubleBuffer : public VariableStateBase { class VariableStateSingleBuffer : public VariableStateBase { public: - VariableStateSingleBuffer(const std::string& name, - const MemoryPtr& external_buffer, - const MemoryDescPtr& external_desc); + VariableStateSingleBuffer(const std::string& name, MemoryPtr external_buffer, MemoryDescPtr external_desc); MemoryPtr input_mem() override; MemoryPtr output_mem() override; @@ -111,15 +109,15 @@ class VariableStateSingleBuffer : public VariableStateBase { MemoryPtr internal_state_mem() const override; private: - MemoryDescPtr m_internal_desc; // mem desc required by the graph internal tensor MemoryPtr m_internal_mem; + MemoryDescPtr m_internal_desc; // mem desc required by the graph internal tensor }; class VariableStateKVcache : public VariableStateBase { public: VariableStateKVcache(const std::string& name, - const MemoryDescPtr& external_desc, - const BlockedMemoryDescPtr& dense_internal_desc); + MemoryDescPtr external_desc, + BlockedMemoryDescPtr dense_internal_desc); // ov::IVariableState ov::SoPtr get_state() const override; diff --git a/src/plugins/intel_cpu/src/node.cpp b/src/plugins/intel_cpu/src/node.cpp index d8616d879a2d43..13250bfabd2e10 100644 --- a/src/plugins/intel_cpu/src/node.cpp +++ b/src/plugins/intel_cpu/src/node.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include "cpu_types.h" @@ -48,15 +49,13 @@ Node::NodesFactory& Node::factory() { return factoryInstance; } -Node::Node(const std::shared_ptr& op, - const GraphContext::CPtr ctx, - const ShapeInferFactory& shapeInferFactory) +Node::Node(const std::shared_ptr& op, GraphContext::CPtr ctx, const ShapeInferFactory& shapeInferFactory) : selectedPrimitiveDescriptorIndex(-1), constant(ConstantType::NoConst), - context(ctx), + context(std::move(ctx)), algorithm(Algorithm::Default), fusingPort(-1), - engine(ctx->getEngine()), + engine(context->getEngine()), name(op->get_friendly_name()), typeStr(op->get_type_name()), type(TypeFromName(op->get_type_name())), @@ -177,7 +176,7 @@ Node::Node(const std::string& type, std::vector inputPrecisions, std::vector outputPrecisions, const std::string& name, - const GraphContext::CPtr ctx) + const GraphContext::CPtr& ctx) : inputShapes(std::move(inShapes)), outputShapes(std::move(outShapes)), selectedPrimitiveDescriptorIndex(-1), @@ -205,7 +204,7 @@ void Node::addEdge(const EdgePtr& edge) { } void Node::remove() { - auto drop = [](std::vector edges) { + auto drop = [](const std::vector& edges) { for (auto& edge : edges) { auto edgePtr = edge.lock(); if (!edgePtr) @@ -594,7 +593,7 @@ std::string Node::getPrimitiveDescriptorType() const { std::string str_type; - auto add_type = [&](std::string t) { + auto add_type = [&](const std::string& t) { if (!str_type.empty() && t.c_str()[0] != '_') str_type += "_"; str_type += t; @@ -798,7 +797,7 @@ void Node::updateDynamicParams() { } } -void Node::execute(const dnnl::stream strm, int numaId) { +void Node::execute(const dnnl::stream& strm, int numaId) { if (isDynamicNode()) { return executeDynamic(strm, numaId); } else { @@ -806,12 +805,12 @@ void Node::execute(const dnnl::stream strm, int numaId) { } } -void Node::executeStatic(const dnnl::stream strm, int numaId) { +void Node::executeStatic(const dnnl::stream& strm, int numaId) { toNumaNode(numaId); execute(strm); } -void Node::executeDynamic(dnnl::stream strm, int numaId) { +void Node::executeDynamic(const dnnl::stream& strm, int numaId) { if (isExecutable()) { toNumaNode(numaId); executeDynamicImpl(strm); @@ -1039,9 +1038,11 @@ void Node::initDescriptor(const NodeConfig& config) { descs.clear(); std::vector inDescs; + inDescs.reserve(config.inConfs.size()); for (const auto& inConf : config.inConfs) inDescs.emplace_back(inConf.getMemDesc()); std::vector outDescs; + outDescs.reserve(config.outConfs.size()); for (const auto& outConf : config.outConfs) outDescs.emplace_back(outConf.getMemDesc()); createDescriptor(inDescs, outDescs); @@ -1112,6 +1113,7 @@ void Node::prepareMemory(const std::vector& intDescs) { void Node::prepareMemory(dnnl::primitive_desc_iterator& itpd) { std::vector intDescs; + intDescs.reserve(internalBlobDesc.size()); for (auto& it : internalBlobDesc) intDescs.push_back(it(itpd, 0)); @@ -1255,11 +1257,11 @@ void Node::addOriginalLayer(const std::string& layerName) { void Node::cleanup() { internalBlobs.clear(); - for (auto it : fusedWith) { + for (const auto& it : fusedWith) { it->cleanup(); } - for (auto it : mergedWith) { + for (const auto& it : mergedWith) { it->cleanup(); } } @@ -1452,7 +1454,7 @@ void Node::appendPostOpArgs(const dnnl::primitive_attr& attr, } bool Node::isFusedWith(Type fusedNodeType) const { - for (auto fusedNode : fusedWith) { + for (const auto& fusedNode : fusedWith) { if (fusedNode->type == fusedNodeType) return true; } @@ -1532,7 +1534,7 @@ ov::element::Type Node::getRuntimePrecision() const { return runtimePrecision; } -Node* Node::NodesFactory::create(const std::shared_ptr& op, const GraphContext::CPtr context) { +Node* Node::NodesFactory::create(const std::shared_ptr& op, const GraphContext::CPtr& context) { // getExceptionDescWithoutStatus removes redundant information from the exception message. For instance, the // NotImplemented exception is generated in the form: full_path_to_src_file:line_number [ NOT_IMPLEMENTED ] reason. // An example for gather node: diff --git a/src/plugins/intel_cpu/src/node.h b/src/plugins/intel_cpu/src/node.h index 0fe0222a673045..60b6568562ec5c 100644 --- a/src/plugins/intel_cpu/src/node.h +++ b/src/plugins/intel_cpu/src/node.h @@ -12,6 +12,7 @@ #include #include #include +#include #include #include "cpu_memory.h" @@ -48,12 +49,12 @@ class PortConfigurator { public: PortConfigurator(ov::intel_cpu::LayoutType blockedDescType, ov::element::Type prc, - const Shape& shape, + Shape shape, bool constant = false, int inPlace = -1) : blockedDescCreator(getBlockedDescCreator(blockedDescType)), prc(prc), - shape(shape), + shape(std::move(shape)), constant(constant), inPlace(inPlace) {} @@ -93,7 +94,7 @@ class NodeDesc { NodeDesc(NodeConfig conf, impl_desc_type type, ExecutorFactoryLegacyPtr factory) : config(std::move(conf)), implementationType(type), - executorFactory(factory) {} + executorFactory(std::move(factory)) {} const NodeConfig& getConfig() const { return config; @@ -126,7 +127,7 @@ class NodeDesc { } void setExecutorFactory(ExecutorFactoryLegacyPtr factory) { - executorFactory = factory; + executorFactory = std::move(factory); } private: @@ -213,12 +214,12 @@ class Node { childEdges.push_back(edge); } - void removeParentEdge(const EdgePtr edge) { + void removeParentEdge(const EdgePtr& edge) { removeEdge(edge, parentEdges); updateConstantType(); } - void removeChildEdge(const EdgePtr edge) { + void removeChildEdge(const EdgePtr& edge) { removeEdge(edge, childEdges); } @@ -474,10 +475,10 @@ class Node { // @todo this supposed to be 'execute + executeImpl' instead of 'executeStatic + execute' // but this requires changes in all the nodes. Since moving to a numa node right before an execute // is a temprorary solution, do it this way for now. - void executeStatic(const dnnl::stream strm, int numaId = -1); + void executeStatic(const dnnl::stream& strm, int numaId = -1); void updateShapes(); void updateDynamicParams(); - void executeDynamic(dnnl::stream strm, int numaId = -1); + void executeDynamic(const dnnl::stream& strm, int numaId = -1); virtual void redefineOutputMemory(const std::vector& newShapes); void redefineOutputMemory(const size_t port, const VectorDims& new_output_shape); bool outputShapeDataDependency() const; @@ -720,14 +721,15 @@ class Node { std::string originalLayers; // contains names of the original layers separated by comma std::string parallelDomain; - Node(const std::shared_ptr& op, const GraphContext::CPtr ctx, const ShapeInferFactory& shapeInferFactory); + Node(const std::shared_ptr& op, GraphContext::CPtr ctx, const ShapeInferFactory& shapeInferFactory); + Node(const std::string& type, std::vector inputShapes, std::vector outputShapes, std::vector originalInputPrecisions, std::vector originalOutputPrecisions, const std::string& name, - const GraphContext::CPtr ctx); + const GraphContext::CPtr& ctx); int selectedPrimitiveDescriptorIndex = -1; @@ -808,10 +810,10 @@ class Node { std::vector shapeInferGeneric(const std::vector& inputDims) const; virtual IShapeInfer::Result shapeInfer() const; - void execute(dnnl::stream stream, int numaId); - virtual void execute(dnnl::stream strm) = 0; + void execute(const dnnl::stream& stream, int numaId); + virtual void execute(const dnnl::stream& strm) = 0; // TODO [DS] : make pure after all nodes support dynamic shapes - virtual void executeDynamicImpl(dnnl::stream strm) { + virtual void executeDynamicImpl(const dnnl::stream& strm) { OPENVINO_THROW_NOT_IMPLEMENTED("[DS] executeDynamicImpl not implemented for node with type: ", getTypeStr()); } @@ -847,7 +849,7 @@ class Node { static void removeEdge(const EdgePtr edge, std::vector& edges) { edges.erase(std::remove_if(edges.begin(), edges.end(), - [&edge](EdgeWeakPtr _edge) { + [&edge](const EdgeWeakPtr& _edge) { return _edge.lock() == edge; }), edges.end()); @@ -899,7 +901,7 @@ class Node::NodesFactory public: NodesFactory(); - Node* create(const std::shared_ptr& op, const GraphContext::CPtr context); + Node* create(const std::shared_ptr& op, const GraphContext::CPtr& context); }; template diff --git a/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp b/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp index 7b6f64d30d1403..274259a4e279ef 100644 --- a/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp +++ b/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp @@ -51,7 +51,7 @@ bool AdaptivePooling::isSupportedOperation(const std::shared_ptr return true; } -AdaptivePooling::AdaptivePooling(const std::shared_ptr& op, const GraphContext::CPtr context) +AdaptivePooling::AdaptivePooling(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, AdaptivePoolingShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -126,11 +126,11 @@ void AdaptivePooling::initSupportedPrimitiveDescriptors() { } } -void AdaptivePooling::executeDynamicImpl(dnnl::stream strm) { +void AdaptivePooling::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void AdaptivePooling::execute(dnnl::stream strm) { +void AdaptivePooling::execute(const dnnl::stream& strm) { auto inputPrec = getParentEdgeAt(0)->getMemory().getDataType(); auto outputPrec = getChildEdgeAt(0)->getMemory().getDataType(); if (!(inputPrec == dnnl_f32 && outputPrec == dnnl_f32)) diff --git a/src/plugins/intel_cpu/src/nodes/adaptive_pooling.h b/src/plugins/intel_cpu/src/nodes/adaptive_pooling.h index cc6969dd1b1793..0bae3a03b5c1ed 100644 --- a/src/plugins/intel_cpu/src/nodes/adaptive_pooling.h +++ b/src/plugins/intel_cpu/src/nodes/adaptive_pooling.h @@ -18,11 +18,11 @@ namespace node { class AdaptivePooling : public Node { public: - AdaptivePooling(const std::shared_ptr& op, const GraphContext::CPtr context); + AdaptivePooling(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; @@ -38,7 +38,7 @@ class AdaptivePooling : public Node { bool needPrepareParams() const override { return false; }; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; }; } // namespace node diff --git a/src/plugins/intel_cpu/src/nodes/batch_to_space.cpp b/src/plugins/intel_cpu/src/nodes/batch_to_space.cpp index 7a255c95b63108..deffe60668de01 100644 --- a/src/plugins/intel_cpu/src/nodes/batch_to_space.cpp +++ b/src/plugins/intel_cpu/src/nodes/batch_to_space.cpp @@ -30,7 +30,7 @@ bool BatchToSpace::isSupportedOperation(const std::shared_ptr& o return true; } -BatchToSpace::BatchToSpace(const std::shared_ptr& op, const GraphContext::CPtr context) +BatchToSpace::BatchToSpace(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -237,11 +237,11 @@ void BatchToSpace::batchToSpaceKernel() { }); } -void BatchToSpace::executeDynamicImpl(dnnl::stream strm) { +void BatchToSpace::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void BatchToSpace::execute(dnnl::stream strm) { +void BatchToSpace::execute(const dnnl::stream& strm) { switch (getParentEdgeAt(0)->getMemory().getDesc().getPrecision().size()) { case 1: batchToSpaceKernel::value_type>(); diff --git a/src/plugins/intel_cpu/src/nodes/batch_to_space.h b/src/plugins/intel_cpu/src/nodes/batch_to_space.h index 9c863296cc3c1d..4d13ad27789a5d 100644 --- a/src/plugins/intel_cpu/src/nodes/batch_to_space.h +++ b/src/plugins/intel_cpu/src/nodes/batch_to_space.h @@ -12,7 +12,7 @@ namespace node { class BatchToSpace : public Node { public: - BatchToSpace(const std::shared_ptr& op, const GraphContext::CPtr context); + BatchToSpace(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; @@ -22,7 +22,7 @@ class BatchToSpace : public Node { return !hasEmptyInputTensors() && !hasEmptyOutputTensors(); } - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override { @@ -31,7 +31,7 @@ class BatchToSpace : public Node { bool needShapeInfer() const override { return true; }; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/bin_conv.cpp b/src/plugins/intel_cpu/src/nodes/bin_conv.cpp index 0a1e255dd383f9..dab539575723f7 100644 --- a/src/plugins/intel_cpu/src/nodes/bin_conv.cpp +++ b/src/plugins/intel_cpu/src/nodes/bin_conv.cpp @@ -936,7 +936,7 @@ bool BinaryConvolution::isSupportedOperation(const std::shared_ptr& op, const GraphContext::CPtr context) +BinaryConvolution::BinaryConvolution(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (isSupportedOperation(op, errorMessage)) { @@ -1358,7 +1358,7 @@ void BinaryConvolution::executeReference(const uint8_t* src, }); } -void BinaryConvolution::execute(dnnl::stream strm) { +void BinaryConvolution::execute(const dnnl::stream& strm) { auto srcMemory = getSrcMemoryAtPort(0); auto weightsMemory = getSrcMemoryAtPort(1); auto dstMemory = getDstMemoryAtPort(0); diff --git a/src/plugins/intel_cpu/src/nodes/bin_conv.h b/src/plugins/intel_cpu/src/nodes/bin_conv.h index 825c264a5ba69b..8a03b9de292682 100644 --- a/src/plugins/intel_cpu/src/nodes/bin_conv.h +++ b/src/plugins/intel_cpu/src/nodes/bin_conv.h @@ -78,12 +78,12 @@ struct jit_uni_bin_conv_kernel { class BinaryConvolution : public Node { public: - BinaryConvolution(const std::shared_ptr& op, const GraphContext::CPtr context); + BinaryConvolution(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void createPrimitive() override; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool canBeInPlace() const override { return false; diff --git a/src/plugins/intel_cpu/src/nodes/broadcast.cpp b/src/plugins/intel_cpu/src/nodes/broadcast.cpp index 3c92c6e6e4f041..5d6dc9ebea5bbc 100644 --- a/src/plugins/intel_cpu/src/nodes/broadcast.cpp +++ b/src/plugins/intel_cpu/src/nodes/broadcast.cpp @@ -50,7 +50,7 @@ bool Broadcast::isSupportedOperation(const std::shared_ptr& op, return true; } -Broadcast::Broadcast(const std::shared_ptr& op, const GraphContext::CPtr context) +Broadcast::Broadcast(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -189,11 +189,11 @@ bool Broadcast::isExecutable() const { return !isInputTensorAtPortEmpty(0); } -void Broadcast::executeDynamicImpl(dnnl::stream strm) { +void Broadcast::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void Broadcast::execute(dnnl::stream strm) { +void Broadcast::execute(const dnnl::stream& strm) { if (optimizedCase) { optimizedExecute(getSrcMemoryAtPort(INPUT_DATA_IDX), getDstMemoryAtPort(0)); } else { @@ -201,7 +201,7 @@ void Broadcast::execute(dnnl::stream strm) { } } -void Broadcast::plainExecute(dnnl::stream strm) { +void Broadcast::plainExecute(const dnnl::stream& strm) { VectorDims srcDims = getParentEdgeAt(INPUT_DATA_IDX)->getMemory().getStaticDims(); const auto& dstDims = getChildEdgeAt(0)->getMemory().getStaticDims(); const auto& dataSrcRank = getParentEdgeAt(INPUT_DATA_IDX)->getMemory().getShape().getRank(); diff --git a/src/plugins/intel_cpu/src/nodes/broadcast.h b/src/plugins/intel_cpu/src/nodes/broadcast.h index 5645ec70a1f707..c6063ebd89fbf4 100644 --- a/src/plugins/intel_cpu/src/nodes/broadcast.h +++ b/src/plugins/intel_cpu/src/nodes/broadcast.h @@ -16,12 +16,12 @@ namespace node { class Broadcast : public Node, public TileBroadcastCommon { public: - Broadcast(const std::shared_ptr& op, const GraphContext::CPtr context); + Broadcast(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool created() const override; bool isExecutable() const override; @@ -33,7 +33,7 @@ class Broadcast : public Node, public TileBroadcastCommon { bool needShapeInfer() const override; private: - void plainExecute(dnnl::stream strm); + void plainExecute(const dnnl::stream& strm); enum AutoBroadcastType { NUMPY, EXPLICIT }; AutoBroadcastType broadcastType = NUMPY; diff --git a/src/plugins/intel_cpu/src/nodes/bucketize.cpp b/src/plugins/intel_cpu/src/nodes/bucketize.cpp index 115e397c4c990e..67f1c3ff482405 100644 --- a/src/plugins/intel_cpu/src/nodes/bucketize.cpp +++ b/src/plugins/intel_cpu/src/nodes/bucketize.cpp @@ -29,7 +29,7 @@ bool Bucketize::isSupportedOperation(const std::shared_ptr& op, return true; } -Bucketize::Bucketize(const std::shared_ptr& op, const GraphContext::CPtr context) +Bucketize::Bucketize(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, PassThroughShapeInferFactory()) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -85,7 +85,7 @@ inline constexpr uint32_t getElementsMask(ov::element::Type precision1, (static_cast(ov::element::Type_t(precision4)) << 24); } -void Bucketize::execute(dnnl::stream strm) { +void Bucketize::execute(const dnnl::stream& strm) { auto precision_mask = getElementsMask(input_precision, boundaries_precision, output_precision); switch (precision_mask) { diff --git a/src/plugins/intel_cpu/src/nodes/bucketize.h b/src/plugins/intel_cpu/src/nodes/bucketize.h index 5ad893ea0a9282..3481941aa0a405 100644 --- a/src/plugins/intel_cpu/src/nodes/bucketize.h +++ b/src/plugins/intel_cpu/src/nodes/bucketize.h @@ -12,13 +12,13 @@ namespace node { class Bucketize : public Node { public: - Bucketize(const std::shared_ptr& op, const GraphContext::CPtr context); + Bucketize(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.cpp b/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.cpp index 1803dc5c10b45e..93f5278b06a4a8 100644 --- a/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.cpp +++ b/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.cpp @@ -47,7 +47,7 @@ The functionality is equivalent to following python code: */ template struct CausalMaskPreprocess::ExecutorCausalMaskPreprocess : public CausalMaskPreprocess::Executor { - void execute(dnnl::stream strm, + void execute(const dnnl::stream& strm, intel_cpu::Node* pnode, const intel_cpu::CausalMaskPreprocessNode::Config& config) override { ov::intel_cpu::PlainTensor t_attention_mask(pnode->getSrcMemoryAtPort(0)); @@ -99,7 +99,7 @@ struct CausalMaskPreprocess::ExecutorCausalMaskPreprocess : public CausalMaskPre } }; -CausalMaskPreprocess::CausalMaskPreprocess(const std::shared_ptr& op, const GraphContext::CPtr context) +CausalMaskPreprocess::CausalMaskPreprocess(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, InternalDynShapeInferFactory()) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -158,7 +158,7 @@ void CausalMaskPreprocess::initSupportedPrimitiveDescriptors() { addSupportedPrimDesc(inPortConfigs, outPortConfigs, impl_desc_type::ref_any); } -void CausalMaskPreprocess::execute(dnnl::stream strm) { +void CausalMaskPreprocess::execute(const dnnl::stream& strm) { m_executor->execute(strm, this, m_config); } diff --git a/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.h b/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.h index 444f242b0597a7..b35de8e25fcae9 100644 --- a/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.h +++ b/src/plugins/intel_cpu/src/nodes/causal_mask_preprocess.h @@ -13,7 +13,7 @@ namespace node { class CausalMaskPreprocess : public Node { public: - CausalMaskPreprocess(const std::shared_ptr& op, const GraphContext::CPtr context); + CausalMaskPreprocess(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override {} bool created() const override { @@ -22,16 +22,16 @@ class CausalMaskPreprocess : public Node { bool needPrepareParams() const override { return false; }; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; private: struct Executor { - virtual void execute(dnnl::stream strm, + virtual void execute(const dnnl::stream& strm, intel_cpu::Node* pnode, const intel_cpu::CausalMaskPreprocessNode::Config& config) = 0; virtual ~Executor() = default; diff --git a/src/plugins/intel_cpu/src/nodes/col2im.cpp b/src/plugins/intel_cpu/src/nodes/col2im.cpp index 99fc3ed7d671df..58c1e36a9e308a 100644 --- a/src/plugins/intel_cpu/src/nodes/col2im.cpp +++ b/src/plugins/intel_cpu/src/nodes/col2im.cpp @@ -10,7 +10,7 @@ namespace ov { namespace intel_cpu { namespace node { -Col2Im::Col2Im(const std::shared_ptr& op, const GraphContext::CPtr context) +Col2Im::Col2Im(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -57,7 +57,7 @@ bool Col2Im::needPrepareParams() const { return false; } -void Col2Im::executeDynamicImpl(dnnl::stream strm) { +void Col2Im::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } @@ -89,7 +89,7 @@ struct Col2Im::Col2ImExecute { ctx.node.executeImpl(); } }; -void Col2Im::execute(dnnl::stream strm) { +void Col2Im::execute(const dnnl::stream& strm) { auto dataPrecision = getParentEdgeAt(0)->getMemory().getDesc().getPrecision(); auto indexPrecision = getParentEdgeAt(1)->getMemory().getDesc().getPrecision(); diff --git a/src/plugins/intel_cpu/src/nodes/col2im.h b/src/plugins/intel_cpu/src/nodes/col2im.h index 63a20a0cf74252..e841d4567d4b65 100644 --- a/src/plugins/intel_cpu/src/nodes/col2im.h +++ b/src/plugins/intel_cpu/src/nodes/col2im.h @@ -12,15 +12,15 @@ namespace node { class Col2Im : public Node { public: - Col2Im(const std::shared_ptr& op, const GraphContext::CPtr context); + Col2Im(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: template diff --git a/src/plugins/intel_cpu/src/nodes/color_convert.cpp b/src/plugins/intel_cpu/src/nodes/color_convert.cpp index 24e24c61280c61..dd6d5ede57b2bd 100644 --- a/src/plugins/intel_cpu/src/nodes/color_convert.cpp +++ b/src/plugins/intel_cpu/src/nodes/color_convert.cpp @@ -352,7 +352,7 @@ class SinglePlaneConvert : public RefConverter { public: using RefConverter::RefConverter; - void execute(dnnl::stream strm) override { + void execute(const dnnl::stream& strm) override { const auto& dims = inputDims(0); const size_t batch_size = dims[N_DIM]; @@ -372,7 +372,7 @@ class TwoPlaneConvert : public RefConverter { public: using RefConverter::RefConverter; - void execute(dnnl::stream strm) override { + void execute(const dnnl::stream& strm) override { const auto& dims = inputDims(0); const T* y = static_cast(input(0)); @@ -535,7 +535,7 @@ class SinglePlaneConvert : public Converter { jit_converter_create(); } - void execute(dnnl::stream strm) override { + void execute(const dnnl::stream& strm) override { const auto& kernel = jit_converter_get(); const auto& dims = inputDims(0); @@ -569,7 +569,7 @@ class TwoPlaneConvert : public Converter { jit_converter_create(); } - void execute(dnnl::stream strm) override { + void execute(const dnnl::stream& strm) override { const auto& kernel = jit_converter_get(); const auto& dims = inputDims(0); @@ -681,7 +681,7 @@ class SinglePlaneConvert : public RefConverter { public: using RefConverter::RefConverter; - void execute(dnnl::stream strm) override { + void execute(const dnnl::stream& strm) override { const auto& dims = inputDims(0); const size_t batch_size = dims[N_DIM]; @@ -702,7 +702,7 @@ class ThreePlaneConvert : public RefConverter { public: using RefConverter::RefConverter; - void execute(dnnl::stream strm) override { + void execute(const dnnl::stream& strm) override { const auto& dims = inputDims(0); const T* y = static_cast(input(0)); @@ -865,7 +865,7 @@ class SinglePlaneConvert : public Converter { jit_converter_create(); } - void execute(dnnl::stream strm) override { + void execute(const dnnl::stream& strm) override { const auto& kernel = jit_converter_get(); const auto& dims = inputDims(0); @@ -901,7 +901,7 @@ class ThreePlaneConvert : public Converter { jit_converter_create(); } - void execute(dnnl::stream strm) override { + void execute(const dnnl::stream& strm) override { const auto& kernel = jit_converter_get(); const auto& dims = inputDims(0); @@ -964,7 +964,7 @@ bool ColorConvert::isSupportedOperation(const std::shared_ptr& o return alg != Algorithm::Default; } -ColorConvert::ColorConvert(const std::shared_ptr& op, const GraphContext::CPtr context) +ColorConvert::ColorConvert(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, ColorConvertShapeInferFactory(op)) { std::string errorMessage; std::tie(algorithm, errorMessage) = getAlgorithmFor(op); @@ -1078,7 +1078,7 @@ void ColorConvert::createPrimitive() { } } -void ColorConvert::execute(dnnl::stream strm) { +void ColorConvert::execute(const dnnl::stream& strm) { if (!_impl) OPENVINO_THROW(getTypeStr() + " node with name '" + getName() + "' ", "has no any implemented converter"); _impl->execute(strm); @@ -1092,7 +1092,7 @@ bool ColorConvert::needPrepareParams() const { return false; } -void ColorConvert::executeDynamicImpl(dnnl::stream strm) { +void ColorConvert::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/color_convert.h b/src/plugins/intel_cpu/src/nodes/color_convert.h index c28c4c86b922ce..b3db883ec8ce18 100644 --- a/src/plugins/intel_cpu/src/nodes/color_convert.h +++ b/src/plugins/intel_cpu/src/nodes/color_convert.h @@ -17,17 +17,17 @@ namespace node { class ColorConvert : public Node { public: - ColorConvert(const std::shared_ptr& op, const GraphContext::CPtr context); + ColorConvert(const std::shared_ptr& op, const GraphContext::CPtr& context); class Converter; public: void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; @@ -70,7 +70,7 @@ class ColorConvert::Converter { const void* input(size_t idx) const; void* output(size_t idx) const; const VectorDims& inputDims(size_t idx) const; - virtual void execute(dnnl::stream strm) = 0; + virtual void execute(const dnnl::stream& strm) = 0; protected: Node* _node; diff --git a/src/plugins/intel_cpu/src/nodes/common/dnnl_executor.cpp b/src/plugins/intel_cpu/src/nodes/common/dnnl_executor.cpp index 7e18fd305f9fae..867f79d62a990b 100644 --- a/src/plugins/intel_cpu/src/nodes/common/dnnl_executor.cpp +++ b/src/plugins/intel_cpu/src/nodes/common/dnnl_executor.cpp @@ -25,11 +25,11 @@ DnnlExecutor::IntermReorder::IntermReorder(const dnnl::memory::desc& descSrc, m_reorder = dnnl::reorder(reorderPd); } -void DnnlExecutor::IntermReorder::exec(dnnl::memory& memSrc, dnnl::memory& memDst, dnnl::stream strm) { +void DnnlExecutor::IntermReorder::exec(dnnl::memory& memSrc, dnnl::memory& memDst, const dnnl::stream& strm) { m_reorder.execute(strm, memSrc, memDst); } -void DnnlExecutor::exec(const std::unordered_map& primArgs, dnnl::stream strm) { +void DnnlExecutor::exec(const std::unordered_map& primArgs, const dnnl::stream& strm) { if (inputReorders.empty() && outputReorders.empty()) { execPrim.execute(strm, primArgs); } else { @@ -37,7 +37,7 @@ void DnnlExecutor::exec(const std::unordered_map& primArgs, d } } -void DnnlExecutor::reorder_exec(std::unordered_map primArgs, dnnl::stream strm) { +void DnnlExecutor::reorder_exec(std::unordered_map primArgs, const dnnl::stream& strm) { for (auto& inReorder : inputReorders) { if (primArgs.count(inReorder.first)) { dnnl::memory memDst(inReorder.second.getDstDesc(), strm.get_engine()); diff --git a/src/plugins/intel_cpu/src/nodes/common/dnnl_executor.h b/src/plugins/intel_cpu/src/nodes/common/dnnl_executor.h index 780df7b86a1161..86e8ab526fa7fd 100644 --- a/src/plugins/intel_cpu/src/nodes/common/dnnl_executor.h +++ b/src/plugins/intel_cpu/src/nodes/common/dnnl_executor.h @@ -17,7 +17,7 @@ class DnnlExecutor { class IntermReorder { public: IntermReorder(const dnnl::memory::desc& descSrc, const dnnl::memory::desc& descDst, const dnnl::engine& engine); - void exec(dnnl::memory& memSrc, dnnl::memory& memDst, dnnl::stream strm); + void exec(dnnl::memory& memSrc, dnnl::memory& memDst, const dnnl::stream& strm); const dnnl::memory::desc& getSrcDesc() const { return m_descSrc; } @@ -33,7 +33,7 @@ class DnnlExecutor { public: explicit DnnlExecutor(const dnnl::primitive_desc& pd); - void exec(const std::unordered_map& primArgs, dnnl::stream strm); + void exec(const std::unordered_map& primArgs, const dnnl::stream& strm); bool needReordering() const; virtual ~DnnlExecutor() = default; dnnl::primitive getExecPrim() const; @@ -67,7 +67,7 @@ class DnnlExecutor { } protected: - virtual void reorder_exec(std::unordered_map primArgs, dnnl::stream strm); + virtual void reorder_exec(std::unordered_map primArgs, const dnnl::stream& strm); protected: dnnl::primitive execPrim; diff --git a/src/plugins/intel_cpu/src/nodes/common/fp16_utils.h b/src/plugins/intel_cpu/src/nodes/common/fp16_utils.h index e09330b239ccab..371d86da9a7b64 100644 --- a/src/plugins/intel_cpu/src/nodes/common/fp16_utils.h +++ b/src/plugins/intel_cpu/src/nodes/common/fp16_utils.h @@ -4,6 +4,8 @@ #pragma once +#include + namespace ov { namespace intel_cpu { diff --git a/src/plugins/intel_cpu/src/nodes/common/permute_kernel.h b/src/plugins/intel_cpu/src/nodes/common/permute_kernel.h index 986fd1cee5d794..ef4fc80f7dbb87 100644 --- a/src/plugins/intel_cpu/src/nodes/common/permute_kernel.h +++ b/src/plugins/intel_cpu/src/nodes/common/permute_kernel.h @@ -4,6 +4,8 @@ #pragma once +#include + #include "node.h" namespace ov { @@ -45,7 +47,7 @@ struct jit_uni_permute_kernel { ker_(args); } - explicit jit_uni_permute_kernel(jit_permute_config_params jcp_) : ker_(nullptr), jcp(jcp_) {} + explicit jit_uni_permute_kernel(jit_permute_config_params jcp_) : ker_(nullptr), jcp(std::move(jcp_)) {} virtual ~jit_uni_permute_kernel() {} virtual void create_ker() = 0; diff --git a/src/plugins/intel_cpu/src/nodes/common/reorder_prim.cpp b/src/plugins/intel_cpu/src/nodes/common/reorder_prim.cpp index dd07a721260aac..2ee4c0a23bbdab 100644 --- a/src/plugins/intel_cpu/src/nodes/common/reorder_prim.cpp +++ b/src/plugins/intel_cpu/src/nodes/common/reorder_prim.cpp @@ -41,7 +41,7 @@ bool ReorderKey::operator==(const ReorderKey& rhs) const { return retVal; } -dnnl::reorder getReorderPrim(MultiCachePtr cache, +dnnl::reorder getReorderPrim(const MultiCachePtr& cache, const dnnl::engine& engine, const dnnl::memory::desc& src, const dnnl::memory::desc& dest) { diff --git a/src/plugins/intel_cpu/src/nodes/common/reorder_prim.h b/src/plugins/intel_cpu/src/nodes/common/reorder_prim.h index 77beda029d3976..33e12b4045abf9 100644 --- a/src/plugins/intel_cpu/src/nodes/common/reorder_prim.h +++ b/src/plugins/intel_cpu/src/nodes/common/reorder_prim.h @@ -9,7 +9,7 @@ namespace ov { namespace intel_cpu { -dnnl::reorder getReorderPrim(MultiCachePtr cache, +dnnl::reorder getReorderPrim(const MultiCachePtr& cache, const dnnl::engine& engine, const dnnl::memory::desc& src, const dnnl::memory::desc& dest); diff --git a/src/plugins/intel_cpu/src/nodes/common/softmax.h b/src/plugins/intel_cpu/src/nodes/common/softmax.h index 8e7b7dcbca264d..f6376ea642060e 100644 --- a/src/plugins/intel_cpu/src/nodes/common/softmax.h +++ b/src/plugins/intel_cpu/src/nodes/common/softmax.h @@ -30,7 +30,7 @@ static inline void softmax_many_batches(const float* src_data, float* dst_data, float expSum = 0; for (int c = 0; c < C; c++) { - pdst[c * H * W + i] = exp(psrc[c * H * W + i] - max); + pdst[c * H * W + i] = std::exp(psrc[c * H * W + i] - max); expSum += pdst[c * H * W + i]; } diff --git a/src/plugins/intel_cpu/src/nodes/composite.cpp b/src/plugins/intel_cpu/src/nodes/composite.cpp index 4c86eb43eb3fdc..488275e0ac564c 100644 --- a/src/plugins/intel_cpu/src/nodes/composite.cpp +++ b/src/plugins/intel_cpu/src/nodes/composite.cpp @@ -94,12 +94,12 @@ void Composite::createPrimitive() { m_graph.Activate(inputMemory, outputMemory); } -void Composite::execute(dnnl::stream) { +void Composite::execute(const dnnl::stream&) { m_graph.Infer(); } -void Composite::executeDynamicImpl(dnnl::stream strm) { - execute(std::move(strm)); +void Composite::executeDynamicImpl(const dnnl::stream& strm) { + execute(strm); // since the shape inference is not performed for the composite node // a memory of the extra child edges, attached to the output ports diff --git a/src/plugins/intel_cpu/src/nodes/composite.h b/src/plugins/intel_cpu/src/nodes/composite.h index 9f18a2ba68b769..59fc3705497a18 100644 --- a/src/plugins/intel_cpu/src/nodes/composite.h +++ b/src/plugins/intel_cpu/src/nodes/composite.h @@ -38,8 +38,8 @@ class Composite : public Node { void getSupportedDescriptors() override{}; void selectOptimalPrimitiveDescriptor() override; void createPrimitive() override; - void execute(dnnl::stream) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream&) override; + void executeDynamicImpl(const dnnl::stream& strm) override; const Graph& graph() const { return m_graph; diff --git a/src/plugins/intel_cpu/src/nodes/concat.cpp b/src/plugins/intel_cpu/src/nodes/concat.cpp index fe6cb224a9d6cb..c82a187fdfdbbd 100644 --- a/src/plugins/intel_cpu/src/nodes/concat.cpp +++ b/src/plugins/intel_cpu/src/nodes/concat.cpp @@ -49,7 +49,7 @@ bool Concat::isSupportedOperation(const std::shared_ptr& op, std return true; } -Concat::Concat(const std::shared_ptr& op, const GraphContext::CPtr context) +Concat::Concat(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -493,7 +493,7 @@ void Concat::initOptimalPrimitiveDescriptor() { getSelectedPrimitiveDescriptor()->getConfig().outConfs.front().getMemDesc()->hasLayoutType(LayoutType::nspc); } -void Concat::execute(dnnl::stream strm) { +void Concat::execute(const dnnl::stream& strm) { if (isInPlace()) { return; } diff --git a/src/plugins/intel_cpu/src/nodes/concat.h b/src/plugins/intel_cpu/src/nodes/concat.h index eb24c753033153..6bbc215d80aad7 100644 --- a/src/plugins/intel_cpu/src/nodes/concat.h +++ b/src/plugins/intel_cpu/src/nodes/concat.h @@ -13,7 +13,7 @@ namespace node { class Concat : public Node { public: - Concat(const std::shared_ptr& op, const GraphContext::CPtr context); + Concat(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override; @@ -21,8 +21,8 @@ class Concat : public Node { void initOptimalPrimitiveDescriptor() override; void selectOptimalPrimitiveDescriptor() override; bool created() const override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override { + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } void resolveInPlaceEdges(Edge::LOOK look) override; diff --git a/src/plugins/intel_cpu/src/nodes/conv.cpp b/src/plugins/intel_cpu/src/nodes/conv.cpp index 770b53032791c8..3240599d00c819 100644 --- a/src/plugins/intel_cpu/src/nodes/conv.cpp +++ b/src/plugins/intel_cpu/src/nodes/conv.cpp @@ -116,7 +116,7 @@ bool ConvKey::operator==(const ConvKey& rhs) const { class Convolution::FusedSubgraph { public: - FusedSubgraph(const std::vector& opList, const Convolution& conv, const GraphContext::CPtr context) { + FusedSubgraph(const std::vector& opList, const Convolution& conv, const GraphContext::CPtr& context) { _graph = std::unique_ptr(new Graph()); std::unordered_set nodesSet; @@ -239,7 +239,7 @@ bool Convolution::isSupportedOperation(const std::shared_ptr& op return true; } -Convolution::Convolution(const std::shared_ptr& op, const GraphContext::CPtr context) +Convolution::Convolution(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)), withBiases(false), withSum(false), @@ -1398,17 +1398,17 @@ void Convolution::prepareParams() { dnnl::memory::desc(DnnlExtensionUtils::convertToDnnlDims(key.inp1->getShape().getStaticDims()), deriveWeightDataType(key.inp0->getDataType()), memory::format_tag::any); - auto createDnnlConvDesc = [](const dnnl::engine engine, + auto createDnnlConvDesc = [](const dnnl::engine& engine, const dnnl::memory::desc& srcDesc, const dnnl::memory::desc& wghDesc, const dnnl::memory::desc& dstDesc, - DnnlMemoryDescCPtr biasDescPtr, + const DnnlMemoryDescCPtr& biasDescPtr, const std::vector& stride, const std::vector& dilation, const std::vector& paddingL, const std::vector& paddingR, dnnl::algorithm alg, - const dnnl::primitive_attr attr) -> dnnl::primitive_desc { + const dnnl::primitive_attr& attr) -> dnnl::primitive_desc { dnnl::memory::desc dnnlBiasDesc; if (biasDescPtr) { dnnlBiasDesc = biasDescPtr->getDnnlDesc(); @@ -1585,7 +1585,7 @@ Convolution::ConvolutionSumExecutor::ConvolutionSumExecutor(const dnnl::primitiv } void Convolution::ConvolutionSumExecutor::reorder_exec(std::unordered_map primArgs, - dnnl::stream strm) { + const dnnl::stream& strm) { auto outputMem = primArgs.at(DNNL_ARG_DST); for (auto& inReorder : inputReorders) { if (primArgs.count(inReorder.first)) { @@ -1602,7 +1602,7 @@ void Convolution::ConvolutionSumExecutor::reorder_exec(std::unordered_mapexec(primArgs, strm); } -void Convolution::executeDynamicImpl(dnnl::stream strm) { +void Convolution::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); if (withSumBroadcast) { if (!subgraph) { diff --git a/src/plugins/intel_cpu/src/nodes/conv.h b/src/plugins/intel_cpu/src/nodes/conv.h index f40177abff89a1..80c98b2a7bca07 100644 --- a/src/plugins/intel_cpu/src/nodes/conv.h +++ b/src/plugins/intel_cpu/src/nodes/conv.h @@ -15,7 +15,7 @@ class Eltwise; class Convolution : public Node { public: - Convolution(const std::shared_ptr& op, const GraphContext::CPtr context); + Convolution(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override; @@ -108,12 +108,12 @@ class Convolution : public Node { bool constWeight); private: - void reorder_exec(std::unordered_map primArgs, dnnl::stream strm) override; + void reorder_exec(std::unordered_map primArgs, const dnnl::stream& strm) override; }; void prepareParams() override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; void addLegacyZeroPoints(dnnl::primitive_attr& attr); void addZeroPoints(dnnl::primitive_attr& attr); void setPostOps(dnnl::primitive_attr& attr, diff --git a/src/plugins/intel_cpu/src/nodes/convert.cpp b/src/plugins/intel_cpu/src/nodes/convert.cpp index 2684fe28d9b5f7..f82e6da109672b 100644 --- a/src/plugins/intel_cpu/src/nodes/convert.cpp +++ b/src/plugins/intel_cpu/src/nodes/convert.cpp @@ -36,7 +36,7 @@ bool Convert::isSupportedOperation(const std::shared_ptr& op, st return true; } -Convert::Convert(const std::shared_ptr& op, const GraphContext::CPtr context) +Convert::Convert(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, PassThroughShapeInferFactory()) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -51,7 +51,7 @@ Convert::Convert(const Shape& shape, const ov::element::Type& inPrc, const ov::element::Type& outPrc, const std::string& nodeName, - const GraphContext::CPtr context) + const GraphContext::CPtr& context) : Node("Convert", {shape}, {shape}, {inPrc}, {outPrc}, nodeName, context) { convertParams.origPrc = outPrc; @@ -169,11 +169,11 @@ void Convert::prepareParams() { selectedPD->setImplementationType(execPtr->implType()); } -void Convert::executeDynamicImpl(dnnl::stream strm) { +void Convert::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void Convert::execute(dnnl::stream strm) { +void Convert::execute(const dnnl::stream& strm) { auto& parentMem = getParentEdgeAt(0)->getMemory(); auto& childMem = getChildEdgeAt(0)->getMemory(); diff --git a/src/plugins/intel_cpu/src/nodes/convert.h b/src/plugins/intel_cpu/src/nodes/convert.h index 528e5adef6f3e1..52f56b7acd65a2 100644 --- a/src/plugins/intel_cpu/src/nodes/convert.h +++ b/src/plugins/intel_cpu/src/nodes/convert.h @@ -13,18 +13,18 @@ namespace node { class Convert : public Node { public: - Convert(const std::shared_ptr& op, const GraphContext::CPtr context); + Convert(const std::shared_ptr& op, const GraphContext::CPtr& context); Convert(const Shape& shape, const ov::element::Type& inPrc, const ov::element::Type& outPrc, const std::string& nodeName, - const GraphContext::CPtr context); + const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void prepareParams() override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool created() const override; bool canBeInPlace() const override { return false; diff --git a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cpp b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cpp index 60224ff49a8781..445309466b2125 100644 --- a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cpp +++ b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cpp @@ -28,7 +28,7 @@ bool CTCGreedyDecoder::isSupportedOperation(const std::shared_ptr& op, const GraphContext::CPtr context) +CTCGreedyDecoder::CTCGreedyDecoder(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -67,7 +67,7 @@ void CTCGreedyDecoder::initSupportedPrimitiveDescriptors() { impl_desc_type::ref_any); } -void CTCGreedyDecoder::execute(dnnl::stream strm) { +void CTCGreedyDecoder::execute(const dnnl::stream& strm) { const float* probabilities = getSrcDataAtPortAs(DATA_INDEX); const float* sequenceMask = getSrcDataAtPortAs(SEQUENCE_LENGTH_INDEX); float* outputSequences = getDstDataAtPortAs(0); @@ -165,7 +165,7 @@ bool CTCGreedyDecoder::created() const { return getType() == Type::CTCGreedyDecoder; } -void CTCGreedyDecoder::executeDynamicImpl(dnnl::stream strm) { +void CTCGreedyDecoder::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.h b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.h index 9121905eefdea7..dd7950f85a4205 100644 --- a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.h +++ b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.h @@ -12,13 +12,13 @@ namespace node { class CTCGreedyDecoder : public Node { public: - CTCGreedyDecoder(const std::shared_ptr& op, const GraphContext::CPtr context); + CTCGreedyDecoder(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool needPrepareParams() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.cpp b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.cpp index 11c6efb8da30d1..5f8713fd71ef3b 100644 --- a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.cpp +++ b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.cpp @@ -28,7 +28,7 @@ bool CTCGreedyDecoderSeqLen::isSupportedOperation(const std::shared_ptr& op, const GraphContext::CPtr context) +CTCGreedyDecoderSeqLen::CTCGreedyDecoderSeqLen(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -72,7 +72,7 @@ void CTCGreedyDecoderSeqLen::initSupportedPrimitiveDescriptors() { impl_desc_type::ref_any); } -void CTCGreedyDecoderSeqLen::execute(dnnl::stream strm) { +void CTCGreedyDecoderSeqLen::execute(const dnnl::stream& strm) { const float* probabilities = getSrcDataAtPortAs(DATA_INDEX); const int* sequenceLengths = getSrcDataAtPortAs(SEQUENCE_LENGTH_INDEX); int* decodedClasses = getDstDataAtPortAs(DECODED_CLASSES_INDEX); @@ -171,7 +171,7 @@ bool CTCGreedyDecoderSeqLen::created() const { return getType() == Type::CTCGreedyDecoderSeqLen; } -void CTCGreedyDecoderSeqLen::executeDynamicImpl(dnnl::stream strm) { +void CTCGreedyDecoderSeqLen::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.h b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.h index d730cebedac64f..d87de7b5973913 100644 --- a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.h +++ b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.h @@ -12,13 +12,13 @@ namespace node { class CTCGreedyDecoderSeqLen : public Node { public: - CTCGreedyDecoderSeqLen(const std::shared_ptr& op, const GraphContext::CPtr context); + CTCGreedyDecoderSeqLen(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool needPrepareParams() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/ctc_loss.cpp b/src/plugins/intel_cpu/src/nodes/ctc_loss.cpp index 20c080105af141..67a80745743528 100644 --- a/src/plugins/intel_cpu/src/nodes/ctc_loss.cpp +++ b/src/plugins/intel_cpu/src/nodes/ctc_loss.cpp @@ -26,7 +26,7 @@ bool CTCLoss::isSupportedOperation(const std::shared_ptr& op, st return true; } -CTCLoss::CTCLoss(const std::shared_ptr& op, const GraphContext::CPtr context) +CTCLoss::CTCLoss(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -55,11 +55,11 @@ void CTCLoss::initSupportedPrimitiveDescriptors() { addSupportedPrimDesc(inDataConf, {{LayoutType::ncsp, ov::element::f32}}, impl_desc_type::ref_any); } -void CTCLoss::executeDynamicImpl(dnnl::stream strm) { +void CTCLoss::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void CTCLoss::execute(dnnl::stream strm) { +void CTCLoss::execute(const dnnl::stream& strm) { int32_t returnCode = 0; const float* logits = getSrcDataAtPortAs(0); diff --git a/src/plugins/intel_cpu/src/nodes/ctc_loss.h b/src/plugins/intel_cpu/src/nodes/ctc_loss.h index 6c24b47b1bd457..ffe3703a975219 100644 --- a/src/plugins/intel_cpu/src/nodes/ctc_loss.h +++ b/src/plugins/intel_cpu/src/nodes/ctc_loss.h @@ -12,16 +12,16 @@ namespace node { class CTCLoss : public Node { public: - CTCLoss(const std::shared_ptr& op, const GraphContext::CPtr context); + CTCLoss(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool needPrepareParams() const override { return false; }; diff --git a/src/plugins/intel_cpu/src/nodes/cum_sum.cpp b/src/plugins/intel_cpu/src/nodes/cum_sum.cpp index bbda16f94a8e4b..bcedab54caeaeb 100644 --- a/src/plugins/intel_cpu/src/nodes/cum_sum.cpp +++ b/src/plugins/intel_cpu/src/nodes/cum_sum.cpp @@ -30,7 +30,7 @@ bool CumSum::isSupportedOperation(const std::shared_ptr& op, std return true; } -CumSum::CumSum(const std::shared_ptr& op, const GraphContext::CPtr context) +CumSum::CumSum(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -96,7 +96,7 @@ void CumSum::initSupportedPrimitiveDescriptors() { addSupportedPrimDesc(inDataConf, {{LayoutType::ncsp, dataPrecision}}, impl_desc_type::ref_any); } -void CumSum::execute(dnnl::stream strm) { +void CumSum::execute(const dnnl::stream& strm) { if (inputShapes.size() == numOfInputs) axis = getAxis(getParentEdgeAt(AXIS)->getMemory(), getParentEdgeAt(CUM_SUM_DATA)->getMemory()); @@ -269,7 +269,7 @@ bool CumSum::needPrepareParams() const { return false; } -void CumSum::executeDynamicImpl(dnnl::stream strm) { +void CumSum::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/cum_sum.h b/src/plugins/intel_cpu/src/nodes/cum_sum.h index 1b5070699c2729..1bf49f3d7a3861 100644 --- a/src/plugins/intel_cpu/src/nodes/cum_sum.h +++ b/src/plugins/intel_cpu/src/nodes/cum_sum.h @@ -12,15 +12,15 @@ namespace node { class CumSum : public Node { public: - CumSum(const std::shared_ptr& op, const GraphContext::CPtr context); + CumSum(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/deconv.cpp b/src/plugins/intel_cpu/src/nodes/deconv.cpp index a996249dc52acc..886497bd57cc29 100644 --- a/src/plugins/intel_cpu/src/nodes/deconv.cpp +++ b/src/plugins/intel_cpu/src/nodes/deconv.cpp @@ -164,7 +164,7 @@ bool Deconvolution::isSupportedOperation(const std::shared_ptr& return true; } -Deconvolution::Deconvolution(const std::shared_ptr& op, const GraphContext::CPtr context) +Deconvolution::Deconvolution(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, DeconfolutionShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) @@ -706,7 +706,7 @@ VectorDims Deconvolution::shapeInferInternal(const VectorDims& inDims, std::vect return std::move(result.dims.back()); } -void Deconvolution::execute(dnnl::stream strm) { +void Deconvolution::execute(const dnnl::stream& strm) { if (useACL) { std::vector srcMemory; for (size_t i = 0; i < getOriginalInputsNumber(); i++) { diff --git a/src/plugins/intel_cpu/src/nodes/deconv.h b/src/plugins/intel_cpu/src/nodes/deconv.h index a9efed8806abde..4a045f86e6d281 100644 --- a/src/plugins/intel_cpu/src/nodes/deconv.h +++ b/src/plugins/intel_cpu/src/nodes/deconv.h @@ -14,7 +14,7 @@ namespace node { class Deconvolution : public Node { public: - Deconvolution(const std::shared_ptr& op, const GraphContext::CPtr context); + Deconvolution(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; @@ -45,8 +45,8 @@ class Deconvolution : public Node { } void prepareParams() override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override { + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } bool needShapeInfer() const override; diff --git a/src/plugins/intel_cpu/src/nodes/def_conv.cpp b/src/plugins/intel_cpu/src/nodes/def_conv.cpp index 4c44e8b5539e1b..df2c08a5b9e75b 100644 --- a/src/plugins/intel_cpu/src/nodes/def_conv.cpp +++ b/src/plugins/intel_cpu/src/nodes/def_conv.cpp @@ -768,7 +768,7 @@ bool DefConvKey::operator==(const DefConvKey& rhs) const { } // namespace -DeformableConvolution::DeformableConvolution(const std::shared_ptr& op, const GraphContext::CPtr context) +DeformableConvolution::DeformableConvolution(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -1288,7 +1288,7 @@ void DeformableConvolution::prepareParams() { } } -void DeformableConvolution::executeDynamicImpl(dnnl::stream strm) { +void DeformableConvolution::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } @@ -1329,7 +1329,7 @@ void DeformableConvolution::DefConvJitExecutor::exec(const float* src, }); } -void DeformableConvolution::execute(dnnl::stream strm) { +void DeformableConvolution::execute(const dnnl::stream& strm) { const size_t inputsNumber = getOriginalInputsNumber(); auto& srcMemory0 = getParentEdgeAt(0)->getMemory(); diff --git a/src/plugins/intel_cpu/src/nodes/def_conv.h b/src/plugins/intel_cpu/src/nodes/def_conv.h index 066ac7c0e61007..2cd120a83d67bd 100644 --- a/src/plugins/intel_cpu/src/nodes/def_conv.h +++ b/src/plugins/intel_cpu/src/nodes/def_conv.h @@ -72,12 +72,12 @@ struct jit_uni_def_conv_kernel { class DeformableConvolution : public Node { public: - DeformableConvolution(const std::shared_ptr& op, const GraphContext::CPtr context); + DeformableConvolution(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool canBeInPlace() const override { return false; @@ -103,7 +103,7 @@ class DeformableConvolution : public Node { void prepareParams() override; void updatePadding(); - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static constexpr size_t DATA_ID = 0; static constexpr size_t OFF_ID = 1; static constexpr size_t WEI_ID = 2; diff --git a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp b/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp index bb9e3eac5f03db..bf0823885ebc71 100644 --- a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp +++ b/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp @@ -66,7 +66,7 @@ bool DepthToSpace::isSupportedOperation(const std::shared_ptr& o return true; } -DepthToSpace::DepthToSpace(const std::shared_ptr& op, const GraphContext::CPtr context) +DepthToSpace::DepthToSpace(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -303,7 +303,7 @@ void DepthToSpace::DepthToSpaceExecutor::exec(const MemoryPtr& srcMemPtr, const permuteKernel->execute(srcData, dstData, MB); } -void DepthToSpace::execute(dnnl::stream strm) { +void DepthToSpace::execute(const dnnl::stream& strm) { if (!execPtr) { THROW_ERROR("doesn't have a compiled executor."); } @@ -312,7 +312,7 @@ void DepthToSpace::execute(dnnl::stream strm) { execPtr->exec(getSrcMemoryAtPort(0), getDstMemoryAtPort(0), MB); } -void DepthToSpace::executeDynamicImpl(dnnl::stream strm) { +void DepthToSpace::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/depth_to_space.h b/src/plugins/intel_cpu/src/nodes/depth_to_space.h index 0e12218f1a5e7f..151dbd7d3cc29f 100644 --- a/src/plugins/intel_cpu/src/nodes/depth_to_space.h +++ b/src/plugins/intel_cpu/src/nodes/depth_to_space.h @@ -13,13 +13,13 @@ namespace node { class DepthToSpace : public Node { public: - DepthToSpace(const std::shared_ptr& op, const GraphContext::CPtr context); + DepthToSpace(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; void prepareParams() override; @@ -38,7 +38,7 @@ class DepthToSpace : public Node { }; protected: - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: DepthToSpaceAttrs attrs; diff --git a/src/plugins/intel_cpu/src/nodes/detection_output.cpp b/src/plugins/intel_cpu/src/nodes/detection_output.cpp index 416f47a7c0f8a9..a730bd2943dc61 100644 --- a/src/plugins/intel_cpu/src/nodes/detection_output.cpp +++ b/src/plugins/intel_cpu/src/nodes/detection_output.cpp @@ -48,7 +48,7 @@ bool DetectionOutput::isSupportedOperation(const std::shared_ptr return true; } -DetectionOutput::DetectionOutput(const std::shared_ptr& op, const GraphContext::CPtr context) +DetectionOutput::DetectionOutput(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -161,11 +161,11 @@ struct ConfidenceComparatorDO { const float* confData; }; -void DetectionOutput::executeDynamicImpl(dnnl::stream strm) { +void DetectionOutput::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void DetectionOutput::execute(dnnl::stream strm) { +void DetectionOutput::execute(const dnnl::stream& strm) { float* dstData = getDstDataAtPortAs(0); const float* locData = getSrcDataAtPortAs(ID_LOC); diff --git a/src/plugins/intel_cpu/src/nodes/detection_output.h b/src/plugins/intel_cpu/src/nodes/detection_output.h index e5ed8951d63c7f..3ce09c8935dd9d 100644 --- a/src/plugins/intel_cpu/src/nodes/detection_output.h +++ b/src/plugins/intel_cpu/src/nodes/detection_output.h @@ -13,18 +13,18 @@ namespace node { class DetectionOutput : public Node { public: - DetectionOutput(const std::shared_ptr& op, const GraphContext::CPtr context); + DetectionOutput(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; protected: void prepareParams() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: static const int ID_LOC = 0; diff --git a/src/plugins/intel_cpu/src/nodes/dft.cpp b/src/plugins/intel_cpu/src/nodes/dft.cpp index 5042a5e0abba7e..1d18e1b64d28a1 100644 --- a/src/plugins/intel_cpu/src/nodes/dft.cpp +++ b/src/plugins/intel_cpu/src/nodes/dft.cpp @@ -42,7 +42,7 @@ bool DFT::isSupportedOperation(const std::shared_ptr& op, std::s return true; } -DFT::DFT(const std::shared_ptr& op, const GraphContext::CPtr context) +DFT::DFT(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -245,7 +245,7 @@ void copyDataToOutputWithSignalSize(const float* input, } // namespace -void DFT::execute(dnnl::stream strm) { +void DFT::execute(const dnnl::stream& strm) { const auto& outputShape = getChildEdgeAt(0)->getMemory().getStaticDims(); const auto inputDataEdge = getParentEdgeAt(DATA_INDEX); diff --git a/src/plugins/intel_cpu/src/nodes/dft.h b/src/plugins/intel_cpu/src/nodes/dft.h index 7d7cabcf4585e0..072d59995d5881 100644 --- a/src/plugins/intel_cpu/src/nodes/dft.h +++ b/src/plugins/intel_cpu/src/nodes/dft.h @@ -13,12 +13,12 @@ namespace node { class DFT : public Node { public: - DFT(const std::shared_ptr& op, const GraphContext::CPtr context); + DFT(const std::shared_ptr& op, const GraphContext::CPtr& context); ~DFT() override = default; void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; void prepareParams() override; diff --git a/src/plugins/intel_cpu/src/nodes/eltwise.cpp b/src/plugins/intel_cpu/src/nodes/eltwise.cpp index 55e265a2008dcb..c13f22b0d9b76a 100644 --- a/src/plugins/intel_cpu/src/nodes/eltwise.cpp +++ b/src/plugins/intel_cpu/src/nodes/eltwise.cpp @@ -1771,7 +1771,7 @@ class EltwiseRefBaseExecutor : public Eltwise::IEltwiseExecutor { EltwiseRefBaseExecutor(const EltwiseData& opData, const VectorDims& outBlkDims, const std::vector& inpDims) - : _opData(std::move(opData)), + : _opData(opData), _inpDims(inpDims) { if (inpDims.empty()) { OPENVINO_THROW("Can not make Eltwise executor from empty input dims array"); @@ -2219,7 +2219,7 @@ bool Eltwise::isSupportedOperation(const std::shared_ptr& op, st return true; } -Eltwise::Eltwise(const std::shared_ptr& op, const GraphContext::CPtr context) +Eltwise::Eltwise(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, EltwiseShapeInferFactory()), broadcastingPolicy(Undefined) { std::string errorMessage; @@ -2969,7 +2969,7 @@ void Eltwise::selectOptimalPrimitiveDescriptor() { selectPreferPrimitiveDescriptor(getImplPriority(), true); } -void Eltwise::execute(dnnl::stream strm) { +void Eltwise::execute(const dnnl::stream& strm) { if (execPtr) { jit_eltwise_call_args_ptrs args_ptrs = {}; VectorDims dims_out = @@ -3003,7 +3003,7 @@ void Eltwise::execute(dnnl::stream strm) { } } -void Eltwise::executeDynamicImpl(dnnl::stream strm) { +void Eltwise::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/eltwise.h b/src/plugins/intel_cpu/src/nodes/eltwise.h index 21333c7b0aa91a..b8e544eb49fd88 100644 --- a/src/plugins/intel_cpu/src/nodes/eltwise.h +++ b/src/plugins/intel_cpu/src/nodes/eltwise.h @@ -8,6 +8,7 @@ #include #include +#include #include #include "dnnl_postops_composer_legacy.h" @@ -60,7 +61,7 @@ struct jit_uni_eltwise_kernel { ker_(const_args, indexes); } - explicit jit_uni_eltwise_kernel(const jit_eltwise_params& jep) : ker_(nullptr), jep_(jep) {} + explicit jit_uni_eltwise_kernel(jit_eltwise_params jep) : ker_(nullptr), jep_(std::move(jep)) {} virtual ~jit_uni_eltwise_kernel() {} virtual void create_ker() = 0; @@ -86,12 +87,12 @@ class Eltwise : public Node { using executorPtr = std::shared_ptr; public: - Eltwise(const std::shared_ptr& op, const GraphContext::CPtr context); + Eltwise(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void selectOptimalPrimitiveDescriptor() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool canBeInPlace() const override; bool canFuseParent(const NodePtr& parentNode) const; @@ -140,7 +141,7 @@ class Eltwise : public Node { void prepareParams() override; void createPrimitive() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; enum BroadcastingPolicy { PerChannel, diff --git a/src/plugins/intel_cpu/src/nodes/embedding_bag.cpp b/src/plugins/intel_cpu/src/nodes/embedding_bag.cpp index 5ac1330d1630bf..7727df6a32e5c4 100644 --- a/src/plugins/intel_cpu/src/nodes/embedding_bag.cpp +++ b/src/plugins/intel_cpu/src/nodes/embedding_bag.cpp @@ -24,8 +24,8 @@ EmbeddingBag::EmbeddingBag(const std::shared_ptr& op, size_t defaultIndexIdx) : INDICES_IDX(indicesIdx), PER_SAMPLE_WEIGHTS_IDX(perSampleWeightsIdx), - DEFAULT_INDEX_IDX(defaultIndexIdx) { - _layerName = op->get_friendly_name(); + DEFAULT_INDEX_IDX(defaultIndexIdx), + _layerName(op->get_friendly_name()) { std::string logPrefix = std::string("Layer EmbeddingBag with name '") + _layerName + "' "; if (op->get_input_size() < requiredInputNum || op->get_output_size() != 1) OPENVINO_THROW(logPrefix, "has incorrect number of input or output edges!"); diff --git a/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cpp b/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cpp index 202af505d4784b..00be05c6cb43b8 100644 --- a/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cpp +++ b/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cpp @@ -31,7 +31,7 @@ bool EmbeddingBagOffset::isSupportedOperation(const std::shared_ptr& op, const GraphContext::CPtr context) +EmbeddingBagOffset::EmbeddingBagOffset(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)), EmbeddingBag(op, 3lu, 1lu, 4lu, 3lu) { std::string errorMessage; @@ -148,7 +148,7 @@ void EmbeddingBagOffset::getIndices(size_t embIndex, weightsIdx = offsetsData_[embIndex]; } -void EmbeddingBagOffset::executeDynamicImpl(dnnl::stream strm) { +void EmbeddingBagOffset::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } @@ -156,7 +156,7 @@ bool EmbeddingBagOffset::isExecutable() const { return !isInputTensorAtPortEmpty(0); } -void EmbeddingBagOffset::execute(dnnl::stream strm) { +void EmbeddingBagOffset::execute(const dnnl::stream& strm) { const auto* srcData = getSrcDataAtPortAs(0); const uint8_t* weightsData = nullptr; if (_withWeights) diff --git a/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.h b/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.h index b8a5891209dd44..c9bef8a9e28eab 100644 --- a/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.h +++ b/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.h @@ -13,11 +13,11 @@ namespace node { class EmbeddingBagOffset : public Node, public EmbeddingBag { public: - EmbeddingBagOffset(const std::shared_ptr& op, const GraphContext::CPtr context); + EmbeddingBagOffset(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool isExecutable() const override; @@ -25,7 +25,7 @@ class EmbeddingBagOffset : public Node, public EmbeddingBag { protected: void prepareParams() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: void initFromInputs() override; diff --git a/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cpp b/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cpp index 2e4725f8c28c8d..2f56e2f7b3c3a4 100644 --- a/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cpp +++ b/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cpp @@ -31,7 +31,7 @@ bool EmbeddingBagPacked::isSupportedOperation(const std::shared_ptr& op, const GraphContext::CPtr context) +EmbeddingBagPacked::EmbeddingBagPacked(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)), EmbeddingBag(op, 2lu, 1lu, 2lu, 3lu) { std::string errorMessage; @@ -116,7 +116,7 @@ void EmbeddingBagPacked::getIndices(size_t embIndex, weightsIdx = embIndex * _indicesPerBag; } -void EmbeddingBagPacked::executeDynamicImpl(dnnl::stream strm) { +void EmbeddingBagPacked::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } @@ -124,7 +124,7 @@ bool EmbeddingBagPacked::isExecutable() const { return !isInputTensorAtPortEmpty(0); } -void EmbeddingBagPacked::execute(dnnl::stream strm) { +void EmbeddingBagPacked::execute(const dnnl::stream& strm) { const auto* srcData = getSrcDataAtPortAs(0); const uint8_t* weightsData = nullptr; if (_withWeights) diff --git a/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.h b/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.h index 4a3c2288c36748..a979917f2570c5 100644 --- a/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.h +++ b/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.h @@ -13,11 +13,11 @@ namespace node { class EmbeddingBagPacked : public Node, public EmbeddingBag { public: - EmbeddingBagPacked(const std::shared_ptr& op, const GraphContext::CPtr context); + EmbeddingBagPacked(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool isExecutable() const override; @@ -25,7 +25,7 @@ class EmbeddingBagPacked : public Node, public EmbeddingBag { protected: void prepareParams() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: void initFromInputs() override; diff --git a/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cpp b/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cpp index ad233da95ae51e..4d9ff3af48b163 100644 --- a/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cpp +++ b/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cpp @@ -28,7 +28,7 @@ bool EmbeddingSegmentsSum::isSupportedOperation(const std::shared_ptr& op, const GraphContext::CPtr context) +EmbeddingSegmentsSum::EmbeddingSegmentsSum(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)), EmbeddingBag(op, 4lu, 1lu, 5lu, 4lu) { std::string errorMessage; @@ -145,7 +145,7 @@ bool EmbeddingSegmentsSum::needShapeInfer() const { return false; } -void EmbeddingSegmentsSum::executeDynamicImpl(dnnl::stream strm) { +void EmbeddingSegmentsSum::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } @@ -153,7 +153,7 @@ bool EmbeddingSegmentsSum::isExecutable() const { return !isInputTensorAtPortEmpty(0); } -void EmbeddingSegmentsSum::execute(dnnl::stream strm) { +void EmbeddingSegmentsSum::execute(const dnnl::stream& strm) { const auto* srcData = getSrcDataAtPortAs(0); const uint8_t* weightsData = nullptr; if (_withWeights) diff --git a/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.h b/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.h index 5a6ec7d38785f8..4e172655ef5472 100644 --- a/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.h +++ b/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.h @@ -13,11 +13,11 @@ namespace node { class EmbeddingSegmentsSum : public Node, public EmbeddingBag { public: - EmbeddingSegmentsSum(const std::shared_ptr& op, const GraphContext::CPtr context); + EmbeddingSegmentsSum(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool isExecutable() const override; @@ -26,7 +26,7 @@ class EmbeddingSegmentsSum : public Node, public EmbeddingBag { protected: void prepareParams() override; bool needShapeInfer() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: void initFromInputs() override; diff --git a/src/plugins/intel_cpu/src/nodes/executors/aarch64/jit_eltwise.cpp b/src/plugins/intel_cpu/src/nodes/executors/aarch64/jit_eltwise.cpp index e3df2b83e574e2..d5b893b67bf2b1 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/aarch64/jit_eltwise.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/aarch64/jit_eltwise.cpp @@ -4,6 +4,7 @@ #include "jit_eltwise.hpp" +#include #include namespace ov { @@ -107,7 +108,7 @@ bool JitEltwiseExecutor::isSupported(const Algorithm& algorithm, return true; } -JitEltwiseExecutor::JitEltwiseExecutor(const ExecutorContext::CPtr context) : EltwiseExecutor(context) {} +JitEltwiseExecutor::JitEltwiseExecutor(ExecutorContext::CPtr context) : EltwiseExecutor(std::move(context)) {} bool JitEltwiseExecutor::init(const EltwiseAttrs& eltwiseAttrs, const std::vector& srcDescs, diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_deconv.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_deconv.cpp index cd5e935b41a2d5..ff818830ba8c5a 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_deconv.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_deconv.cpp @@ -91,7 +91,7 @@ ACLDeconvTensorInfo getACLDeconvTensorInfo(const DeconvAttrs& deconvAttrs, return ACLDeconvTensorInfo{srcTensorInfo, weiTensorInfo, biasTensorInfo, dstTensorInfo, deconv_info}; } -AclDeconvExecutor::AclDeconvExecutor(const ExecutorContext::CPtr context) : DeconvExecutor(context) {} +AclDeconvExecutor::AclDeconvExecutor(ExecutorContext::CPtr context) : DeconvExecutor(std::move(context)) {} bool AclDeconvExecutor::init(const DeconvAttrs& deconvAttrs, const std::vector& srcDescs, diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_eltwise.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_eltwise.cpp index 26d387c7659dc5..7a8e431b606227 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_eltwise.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_eltwise.cpp @@ -196,7 +196,7 @@ bool AclEltwiseExecutorBuilder::isSupported(const EltwiseAttrs& eltwiseAttrs, return true; } -AclEltwiseExecutor::AclEltwiseExecutor(const ExecutorContext::CPtr context) : EltwiseExecutor(context) {} +AclEltwiseExecutor::AclEltwiseExecutor(ExecutorContext::CPtr context) : EltwiseExecutor(std::move(context)) {} bool AclEltwiseExecutor::init(const EltwiseAttrs& eltwiseAttrs, const std::vector& srcDescs, diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.cpp index e4dbb1a3a37940..5878d41609e2f4 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.cpp @@ -67,7 +67,7 @@ static void initFCAttrs(const FCAttrs& attrs, ACLFullyConnectedExecutor::ACLFullyConnectedExecutor(const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context) { + const ExecutorContext::CPtr& context) { initFCAttrs(attrs, aclTensorAttrs, aclfcAttrs, memory, fullyConnectedLayerInfo, postOps); packedWeights = acl_fc_executor::prepareWeightMemory(memory, context, diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.hpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.hpp index 6c1a2f0576e283..fc475eac12d4f4 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected.hpp @@ -16,7 +16,7 @@ class ACLFullyConnectedExecutor : public ACLCommonExecutor { ACLFullyConnectedExecutor(const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context); + const ExecutorContext::CPtr& context); static bool supports(const FCConfig& config); diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected_utils.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected_utils.cpp index 0c3e208381497f..9237b231d8fa5b 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected_utils.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected_utils.cpp @@ -52,8 +52,8 @@ VectorDims acl_fc_executor::makeDummyOutputDims(const VectorDims& inShape, return outputShape; } -DnnlMemoryDescPtr acl_fc_executor::makeTransposedWeightDescriptor(const DnnlMemoryDescPtr srcDesc, - const DnnlMemoryDescPtr dstDesc) { +DnnlMemoryDescPtr acl_fc_executor::makeTransposedWeightDescriptor(const DnnlMemoryDescPtr& srcDesc, + const DnnlMemoryDescPtr& dstDesc) { const auto& weiDesc = srcDesc->getDnnlDesc(); dnnl::memory::dims wgtDims2D = reshapeDownToRank<2>(weiDesc.get_dims()); const auto reorderedWeiDesc = dnnl::memory::desc{wgtDims2D, weiDesc.get_data_type(), dnnl::memory::format_tag::ba}; @@ -62,8 +62,8 @@ DnnlMemoryDescPtr acl_fc_executor::makeTransposedWeightDescriptor(const DnnlMemo return DnnlExtensionUtils::makeDescriptor(transposedWeiDesc); } -ov::optional acl_fc_executor::convertWeightPrecision(MemoryPtr input, - MemoryPtr output, +ov::optional acl_fc_executor::convertWeightPrecision(const MemoryPtr& input, + const MemoryPtr& output, ov::element::Type weightPrecision) { MemoryArgs memoryArgs; memoryArgs[ARG_SRC] = input; @@ -93,9 +93,9 @@ ov::optional acl_fc_executor::convertWeightPrecision(MemoryPtr input, tmpBuff.data())); } -ov::optional acl_fc_executor::reorderDataFallback(MemoryPtr input, - MemoryPtr output, - ExecutorContext::CPtr context) { +ov::optional acl_fc_executor::reorderDataFallback(const MemoryPtr& input, + const MemoryPtr& output, + const ExecutorContext::CPtr& context) { if (output->getDataType() == input->getDataType()) { return {}; } @@ -109,27 +109,27 @@ ov::optional acl_fc_executor::reorderDataFallback(MemoryPtr input, if (reorderWithoutConvert && parse_impl_name(reorderWithoutConvert.get_primitive_desc()->impl()->name()) != ref_any) { - auto convertOutput = convertWeightPrecision(input, output, inPrc); - if (!convertOutput) { + auto convertOutputOpt = convertWeightPrecision(input, output, inPrc); + if (!convertOutputOpt) { return {}; } - input = *convertOutput; + auto convertOutput = *convertOutputOpt; if (reorderWithoutConvert) { dnnl::stream loc_stream(output->getPrimitive().get_engine(), dnnl::stream::flags::in_order); reorderWithoutConvert.execute( loc_stream, - {{DNNL_ARG_FROM, input->getPrimitive()}, {DNNL_ARG_TO, output->getPrimitive()}}); + {{DNNL_ARG_FROM, convertOutput->getPrimitive()}, {DNNL_ARG_TO, output->getPrimitive()}}); return ov::optional(output); } } return {}; } -MemoryPtr acl_fc_executor::reorderData(DnnlMemoryDescPtr srcWeightDesc, - DnnlMemoryDescPtr dstWeightDesc, - MemoryCPtr weightsMem, - ExecutorContext::CPtr context) { +MemoryPtr acl_fc_executor::reorderData(const DnnlMemoryDescPtr& srcWeightDesc, + const DnnlMemoryDescPtr& dstWeightDesc, + const MemoryCPtr& weightsMem, + const ExecutorContext::CPtr& context) { MemoryPtr input = std::make_shared(context->getEngine(), srcWeightDesc, weightsMem->getData()); MemoryPtr output = std::make_shared(context->getEngine(), dstWeightDesc); if (!input->getDesc().isDefined() || !output->getDesc().isDefined()) @@ -203,7 +203,7 @@ MemoryPtr acl_fc_executor::reorderWeights(const MemoryArgs& memory, } MemoryPtr acl_fc_executor::prepareWeightMemory(const MemoryArgs& memory, - const ExecutorContext::CPtr context, + const ExecutorContext::CPtr& context, const FCAttrs& attrs, ACLFCAttrs& aclfcAttrs, const PostOps& postOps, @@ -364,4 +364,4 @@ ACLFunction acl_fc_executor::ACLWeightFormatGenerator::configureFunction(const A } } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected_utils.hpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected_utils.hpp index 686042f6067433..7573a4af1e80ff 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected_utils.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_fullyconnected_utils.hpp @@ -22,16 +22,20 @@ VectorDims makeDummyInputDims(const Shape& inShape, const Shape& wShape); VectorDims makeDummyOutputDims(const VectorDims& inShape, const VectorDims& wShape, const size_t out_rank); -DnnlMemoryDescPtr makeTransposedWeightDescriptor(const DnnlMemoryDescPtr srcDesc, const DnnlMemoryDescPtr dstDesc); +DnnlMemoryDescPtr makeTransposedWeightDescriptor(const DnnlMemoryDescPtr& srcDesc, const DnnlMemoryDescPtr& dstDesc); -ov::optional convertWeightPrecision(MemoryPtr input, MemoryPtr output, ov::element::Type weightPrecision); +ov::optional convertWeightPrecision(const MemoryPtr& input, + const MemoryPtr& output, + ov::element::Type weightPrecision); -ov::optional reorderDataFallback(MemoryPtr input, MemoryPtr output, ExecutorContext::CPtr context); +ov::optional reorderDataFallback(const MemoryPtr& input, + const MemoryPtr& output, + const ExecutorContext::CPtr& context); -MemoryPtr reorderData(DnnlMemoryDescPtr srcWeightDesc, - DnnlMemoryDescPtr dstWeightDesc, - MemoryCPtr weightsMem, - ExecutorContext::CPtr context); +MemoryPtr reorderData(const DnnlMemoryDescPtr& srcWeightDesc, + const DnnlMemoryDescPtr& dstWeightDesc, + const MemoryCPtr& weightsMem, + const ExecutorContext::CPtr& context); MemoryPtr reorderWeights(const MemoryArgs& memory, const ExecutorContext::CPtr context, @@ -40,7 +44,7 @@ MemoryPtr reorderWeights(const MemoryArgs& memory, DnnlMemoryDescPtr dnnlDstDesc); MemoryPtr prepareWeightMemory(const MemoryArgs& memory, - const ExecutorContext::CPtr context, + const ExecutorContext::CPtr& context, const FCAttrs& attrs, ACLFCAttrs& aclfcAttrs, const PostOps& postOps, @@ -78,4 +82,4 @@ class ACLWeightFormatGenerator : public ACLCommonExecutor { } // namespace acl_fc_executor } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_lowp_fullyconnected.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_lowp_fullyconnected.cpp index 1604c4fff2f585..63a486985e3a51 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_lowp_fullyconnected.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_lowp_fullyconnected.cpp @@ -100,12 +100,11 @@ arm_compute::Status ACLLowpFullyConnectedExecutor::validateTensorsInfo(const ACL auto& tensor_info_weights = aclMemoryInfos[ACLArgs::ACL_WEI]; tensor_info_weights->set_quantization_info(arm_compute::QuantizationInfo(1.f)); - const auto matMulValid = - arm_compute::NEGEMMLowpMatrixMultiplyCore::validate(aclMemoryInfos[ACLArgs::ACL_SRC_0].get(), - aclMemoryInfos[ACLArgs::ACL_WEI].get(), - aclMemoryInfos[ACLArgs::ACL_BIAS].get(), - aclMemoryInfos[ACLArgs::ACL_DST].get(), - gemmInfo); + auto matMulValid = arm_compute::NEGEMMLowpMatrixMultiplyCore::validate(aclMemoryInfos[ACLArgs::ACL_SRC_0].get(), + aclMemoryInfos[ACLArgs::ACL_WEI].get(), + aclMemoryInfos[ACLArgs::ACL_BIAS].get(), + aclMemoryInfos[ACLArgs::ACL_DST].get(), + gemmInfo); return matMulValid; } diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_mvn.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_mvn.cpp index 290cd3c9dbcce9..7c4223bfcf63fd 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_mvn.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_mvn.cpp @@ -9,7 +9,7 @@ namespace intel_cpu { using namespace arm_compute; -AclMVNExecutor::AclMVNExecutor(const ExecutorContext::CPtr context) : MVNExecutor(context) {} +AclMVNExecutor::AclMVNExecutor(ExecutorContext::CPtr context) : MVNExecutor(std::move(context)) {} bool AclMVNExecutor::init(const MVNAttrs& mvnAttrs, const std::vector& srcDescs, diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_pooling.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_pooling.cpp index 2e4aed30d7b33e..b581d696817eb2 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_pooling.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_pooling.cpp @@ -11,7 +11,7 @@ namespace intel_cpu { using namespace arm_compute; -AclPoolingExecutor::AclPoolingExecutor(const ExecutorContext::CPtr context) : PoolingExecutor(context) {} +AclPoolingExecutor::AclPoolingExecutor(ExecutorContext::CPtr context) : PoolingExecutor(std::move(context)) {} bool AclPoolingExecutor::isSupported(const TensorInfo& srcTensorInfo, const TensorInfo& dstTensorInfo, diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_reduce.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_reduce.cpp index 5973027a0376cb..29b08f54409a38 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_reduce.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_reduce.cpp @@ -24,7 +24,7 @@ static arm_compute::ReductionOperation getAclReductionOperationByAlgorithm(Algor } } -AclReduceExecutor::AclReduceExecutor(const ExecutorContext::CPtr context) : ReduceExecutor(context) {} +AclReduceExecutor::AclReduceExecutor(ExecutorContext::CPtr context) : ReduceExecutor(std::move(context)) {} bool AclReduceExecutor::init(const ReduceAttrs& reduceAttrs, const std::vector& srcDescs, diff --git a/src/plugins/intel_cpu/src/nodes/executors/common/ref_transpose.cpp b/src/plugins/intel_cpu/src/nodes/executors/common/ref_transpose.cpp index 10a440a1b4a01e..7281f3db98f4c0 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/common/ref_transpose.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/common/ref_transpose.cpp @@ -30,7 +30,7 @@ static inline void parallel_step(size_t nDims, const VectorDims& dims, VectorDim void RefTransposeExecutor::referenceExecute(const uint8_t* src_data, uint8_t* dst_data, - jit_permute_config_params jcp, + const jit_permute_config_params& jcp, const int mb) { VectorDims dst_dims = jcp.dst_block_dims; const VectorDims dst_strides = jcp.dst_strides; diff --git a/src/plugins/intel_cpu/src/nodes/executors/common/ref_transpose.hpp b/src/plugins/intel_cpu/src/nodes/executors/common/ref_transpose.hpp index c67906f2443e6c..0513aa473494fc 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/common/ref_transpose.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/common/ref_transpose.hpp @@ -13,7 +13,7 @@ class RefTransposeExecutor : public TransposeExecutor { using TransposeExecutor::TransposeExecutor; static void referenceExecute(const uint8_t* src_data, uint8_t* dst_data, - jit_permute_config_params jcp, + const jit_permute_config_params& jcp, const int mb); bool init(const TransposeParams& transposeParams, const std::vector& srcDescs, diff --git a/src/plugins/intel_cpu/src/nodes/executors/convert.cpp b/src/plugins/intel_cpu/src/nodes/executors/convert.cpp index 32141d53b10ee5..cf11633e662e07 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/convert.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/convert.cpp @@ -4,5 +4,7 @@ #include "convert.hpp" -ov::intel_cpu::ConvertExecutor::ConvertExecutor(const ov::intel_cpu::ExecutorContext::CPtr context) - : convertContext(context) {} \ No newline at end of file +#include + +ov::intel_cpu::ConvertExecutor::ConvertExecutor(ov::intel_cpu::ExecutorContext::CPtr context) + : convertContext(std::move(context)) {} diff --git a/src/plugins/intel_cpu/src/nodes/executors/convert.hpp b/src/plugins/intel_cpu/src/nodes/executors/convert.hpp index dcb0bdde2ce219..85cd64e26c643c 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/convert.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/convert.hpp @@ -20,7 +20,7 @@ struct ConvertParams { class ConvertExecutor : public Executor { public: - explicit ConvertExecutor(const ExecutorContext::CPtr context); + explicit ConvertExecutor(ExecutorContext::CPtr context); virtual bool init(const ConvertParams& convertParams, const MemoryDescPtr& srcDesc, const MemoryDescPtr& dstDesc, diff --git a/src/plugins/intel_cpu/src/nodes/executors/convert_list.hpp b/src/plugins/intel_cpu/src/nodes/executors/convert_list.hpp index 9ea47f916d859f..8f91b939816db8 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/convert_list.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/convert_list.hpp @@ -29,7 +29,7 @@ class ConvertExecutorFactory : public ExecutorFactoryLegacy { ConvertExecutorFactory(const ConvertParams& convertParams, const MemoryDescPtr& srcDesc, const MemoryDescPtr& dstDesc, - const ExecutorContext::CPtr context) + const ExecutorContext::CPtr& context) : ExecutorFactoryLegacy(context) { for (auto& desc : getConvertExecutorsList()) { if (desc.builder->isSupported(convertParams, srcDesc, dstDesc)) { diff --git a/src/plugins/intel_cpu/src/nodes/executors/deconv.hpp b/src/plugins/intel_cpu/src/nodes/executors/deconv.hpp index 11920c0ab35b49..44731d0648d039 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/deconv.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/deconv.hpp @@ -4,6 +4,8 @@ #pragma once +#include + #include "common/primitive_hashing_utils.hpp" #include "cpu_memory.h" #include "executor.hpp" @@ -29,7 +31,7 @@ struct DeconvAttrs { class DeconvExecutor { public: - explicit DeconvExecutor(const ExecutorContext::CPtr context) : context(context) {} + explicit DeconvExecutor(ExecutorContext::CPtr context) : context(std::move(context)) {} virtual bool init(const DeconvAttrs& deconvAttrs, const std::vector& srcDescs, diff --git a/src/plugins/intel_cpu/src/nodes/executors/deconv_list.hpp b/src/plugins/intel_cpu/src/nodes/executors/deconv_list.hpp index fd114094303808..45e71acd476bb6 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/deconv_list.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/deconv_list.hpp @@ -28,7 +28,7 @@ class DeconvExecutorFactory : public ExecutorFactoryLegacy { DeconvExecutorFactory(const DeconvAttrs& deconvAttrs, const std::vector& srcDescs, const std::vector& dstDescs, - const ExecutorContext::CPtr context) + const ExecutorContext::CPtr& context) : ExecutorFactoryLegacy(context) { for (auto& desc : getDeconvExecutorsList()) { if (desc.builder->isSupported(deconvAttrs, srcDescs, dstDescs)) { diff --git a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.cpp b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.cpp index 61aca683a37687..4aef57ac484926 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.cpp @@ -145,7 +145,7 @@ static primitive_desc createPrimitiveDesc(const dnnl::engine& engine, static DnnlPrimitiveAttrs createPrimitiveAttrs(const ConvAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - ExecutorContext::CPtr context) { + const ExecutorContext::CPtr& context) { const auto& srcDesc = memory.at(ARG_SRC)->getDescPtr(); const auto& weiDesc = memory.at(ARG_WEI)->getDescPtr(); const auto& dstDesc = memory.at(ARG_DST)->getDescPtr(); @@ -165,7 +165,7 @@ static DnnlPrimitiveAttrs createPrimitiveAttrs(const ConvAttrs& attrs, DnnlShapeAgnosticDataPtr DnnlConvolutionPrimitive::createShapeAgnosticData(const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context, + const ExecutorContext::CPtr& context, const bool cacheWeights) { DEBUG_LOG("Creating shape agnostic data"); ConvAttrs convAttrs{attrs.withBias}; @@ -203,8 +203,8 @@ std::shared_ptr DnnlConvolutionPrimitive::create( return primitive; } -DnnlMemoryDescPtr DnnlConvolutionPrimitive::makeTransposedWeightDescriptor(const DnnlMemoryDescPtr srcDesc, - const DnnlMemoryDescPtr dstDesc, +DnnlMemoryDescPtr DnnlConvolutionPrimitive::makeTransposedWeightDescriptor(const DnnlMemoryDescPtr& srcDesc, + const DnnlMemoryDescPtr& dstDesc, bool weightsNonTransposed) { return DnnlFCPrimitive::makeTransposedWeightDescriptor(srcDesc, dstDesc, weightsNonTransposed); } diff --git a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.hpp b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.hpp index 79501782922fd5..c342f5106c221d 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.hpp @@ -61,15 +61,15 @@ class DnnlConvolutionPrimitive { return m_implType; } - static DnnlMemoryDescPtr makeTransposedWeightDescriptor(const DnnlMemoryDescPtr srcDesc, - const DnnlMemoryDescPtr dstDesc, + static DnnlMemoryDescPtr makeTransposedWeightDescriptor(const DnnlMemoryDescPtr& srcDesc, + const DnnlMemoryDescPtr& dstDesc, bool weightsNonTransposed); // create shape agnostic data using FC attributes (1x1 Convolution as FC executor) static DnnlShapeAgnosticDataPtr createShapeAgnosticData(const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context, + const ExecutorContext::CPtr& context, const bool cacheWeights); static std::shared_ptr create(const MemoryArgs& memory, diff --git a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected.hpp b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected.hpp index db5c8bed2e43e1..a4aeac36a4eedb 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected.hpp @@ -6,6 +6,7 @@ #include #include +#include #include "cpu_memory.h" #include "memory_desc/cpu_memory_desc_utils.h" @@ -24,7 +25,7 @@ class DefaultInstantiator { std::shared_ptr operator()(const MemoryArgs& memory, const Attrs& attrs, const ExecutorContext::CPtr context, - const std::shared_ptr shapeAgnosticData) { + const std::shared_ptr& shapeAgnosticData) { return ExecutorT::create(memory, attrs, context, shapeAgnosticData); } }; @@ -39,10 +40,10 @@ class DnnlFCExecutor : public Executor { DnnlFCExecutor(const Attrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context, + ExecutorContext::CPtr context, const bool cacheWeights) : m_attrs(attrs), - m_context(context), + m_context(std::move(context)), m_shapeAgnosticData(Primitive::createShapeAgnosticData(m_attrs, postOps, memory, m_context, cacheWeights)), m_primArgs(m_shapeAgnosticData->primAttrs.dnnlArgs) {} bool update(const MemoryArgs& memory) override { @@ -91,7 +92,7 @@ class DnnlFCExecutor : public Executor { } private: - void updateSrcMemory(const DnnlMemoryDescPtr& memDesc, const PrimitivePtr primitive, const MemoryPtr memory) { + void updateSrcMemory(const DnnlMemoryDescPtr& memDesc, const PrimitivePtr primitive, const MemoryPtr& memory) { const auto& primMemDesc = primitive->srcDesc(); if (memDesc->isCompatible(*primMemDesc)) { m_primArgs[DNNL_ARG_SRC] = memory->getPrimitive(); @@ -103,7 +104,7 @@ class DnnlFCExecutor : public Executor { } } - void updateDstMemory(const DnnlMemoryDescPtr& memDesc, const PrimitivePtr primitive, const MemoryPtr memory) { + void updateDstMemory(const DnnlMemoryDescPtr& memDesc, const PrimitivePtr primitive, const MemoryPtr& memory) { const auto& primMemDesc = primitive->dstDesc(); if (memDesc->isCompatible(*primMemDesc)) { m_primArgs[DNNL_ARG_DST] = memory->getPrimitive(); @@ -118,7 +119,7 @@ class DnnlFCExecutor : public Executor { void updateWeightsMemory(DnnlMemoryDescPtr originalMemDesc, const PrimitivePtr currentPrimitive, const PrimitivePtr newPrimitive, - const MemoryPtr memory) { + const MemoryPtr& memory) { const auto newPrimMemDesc = newPrimitive->weightsDesc(); if (currentPrimitive && currentPrimitive->weightsDesc()->isCompatible(*newPrimMemDesc)) return; @@ -130,7 +131,7 @@ class DnnlFCExecutor : public Executor { m_primArgs[DNNL_ARG_WEIGHTS] = weiMemory->getPrimitive(); } - void updateBiasMemory(const MemoryPtr memory) { + void updateBiasMemory(const MemoryPtr& memory) { m_primArgs[DNNL_ARG_BIAS] = memory->getPrimitive(); } diff --git a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected_primitive.cpp b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected_primitive.cpp index 8ae2d2784193af..8c1894f43552f1 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected_primitive.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected_primitive.cpp @@ -109,8 +109,8 @@ std::shared_ptr DnnlFCPrimitive::create(const MemoryArgs& memor return primitive; } -DnnlMemoryDescPtr DnnlFCPrimitive::makeTransposedWeightDescriptor(const DnnlMemoryDescPtr srcDesc, - const DnnlMemoryDescPtr dstDesc, +DnnlMemoryDescPtr DnnlFCPrimitive::makeTransposedWeightDescriptor(const DnnlMemoryDescPtr& srcDesc, + const DnnlMemoryDescPtr& dstDesc, bool weightsNonTransposed) { if (!weightsNonTransposed) return srcDesc; @@ -143,8 +143,8 @@ bool DnnlFCPrimitive::useWeightsDecompressionImpl(const ov::element::Type inputT } static bool useDynamicQuantizationImpl(size_t dqGroupSize, - const MemoryDescPtr srcDesc, - const MemoryDescPtr weightsDesc, + const MemoryDescPtr& srcDesc, + const MemoryDescPtr& weightsDesc, const MemoryArgs& memory, bool needTranspose) { if (dqGroupSize == 0) @@ -207,7 +207,7 @@ static bool useDynamicQuantizationImpl(size_t dqGroupSize, static DnnlPrimitiveAttrs createPrimitiveAttrs(const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - ExecutorContext::CPtr context, + const ExecutorContext::CPtr& context, bool useDynamicQuantization) { const auto& srcDesc = memory.at(ARG_SRC)->getDescPtr(); const auto& weiDesc = memory.at(ARG_WEI)->getDescPtr(); @@ -376,7 +376,7 @@ static VectorDims makeDummyOutputDims(const VectorDims& inShape, const VectorDim DnnlShapeAgnosticDataPtr DnnlFCPrimitive::createShapeAgnosticData(const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context, + const ExecutorContext::CPtr& context, const bool cacheWeights) { DEBUG_LOG("Creating shape agnostic data"); auto srcDesc = memory.at(ARG_SRC)->getDescPtr(); @@ -439,7 +439,7 @@ DnnlShapeAgnosticDataPtr DnnlFCPrimitive::createShapeAgnosticData(const FCAttrs& return std::make_shared(postOpData); } -static impl_desc_type implTypeFromPrimDesc(const dnnl::primitive_desc primDesc) { +static impl_desc_type implTypeFromPrimDesc(const dnnl::primitive_desc& primDesc) { const auto implType = parse_impl_name(primDesc.impl_info_str()); if (implType == ov::intel_cpu::brgemm_avx512_amx && primDesc.weights_desc().get_format_kind() == memory::format_kind::sparsed) { diff --git a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected_primitive.hpp b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected_primitive.hpp index 21247f149ca69f..9afcfac56b14e9 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected_primitive.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_fullyconnected_primitive.hpp @@ -58,15 +58,15 @@ class DnnlFCPrimitive { static DnnlShapeAgnosticDataPtr createShapeAgnosticData(const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context, + const ExecutorContext::CPtr& context, const bool cacheWeights); static bool useWeightsDecompressionImpl(const ov::element::Type inputType, const ov::element::Type weightsType, const Config::ModelType modelType); - static DnnlMemoryDescPtr makeTransposedWeightDescriptor(const DnnlMemoryDescPtr srcDesc, - const DnnlMemoryDescPtr dstDesc, + static DnnlMemoryDescPtr makeTransposedWeightDescriptor(const DnnlMemoryDescPtr& srcDesc, + const DnnlMemoryDescPtr& dstDesc, bool weightsNonTransposed); static std::shared_ptr create(const MemoryArgs& memory, diff --git a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.cpp b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.cpp index 9ffe4731689d43..1b51487fb4cebf 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.cpp @@ -117,8 +117,8 @@ std::shared_ptr DnnlMatMulPrimitive::create(const MemoryArg return primitive; } -DnnlMemoryDescPtr DnnlMatMulPrimitive::makeTransposedWeightDescriptor(const DnnlMemoryDescPtr srcDesc, - const DnnlMemoryDescPtr dstDesc, +DnnlMemoryDescPtr DnnlMatMulPrimitive::makeTransposedWeightDescriptor(const DnnlMemoryDescPtr& srcDesc, + const DnnlMemoryDescPtr& dstDesc, bool weightsNonTransposed) { const auto& weiDesc = srcDesc->getDnnlDesc(); auto wDims = weiDesc.get_dims(); @@ -136,7 +136,7 @@ DnnlMemoryDescPtr DnnlMatMulPrimitive::makeTransposedWeightDescriptor(const Dnnl static DnnlPrimitiveAttrs createPrimitiveAttrs(const MatMulAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - ExecutorContext::CPtr context, + const ExecutorContext::CPtr& context, bool useWeightsDecompression, bool weightsNonTransposed) { const auto& srcDesc = memory.at(ARG_SRC)->getDescPtr(); @@ -288,7 +288,7 @@ bool DnnlMatMulPrimitive::useWeightsDecompressionImpl(const ov::element::Type in DnnlShapeAgnosticDataPtr DnnlMatMulPrimitive::createShapeAgnosticData(const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context, + const ExecutorContext::CPtr& context, const bool cacheWeights) { DEBUG_LOG("Creating shape agnostic data"); auto srcDesc = memory.at(ARG_SRC)->getDescPtr(); @@ -339,7 +339,7 @@ DnnlShapeAgnosticDataPtr DnnlMatMulPrimitive::createShapeAgnosticData(const FCAt return std::make_shared(postOpData); } -static impl_desc_type implTypeFromPrimDesc(const dnnl::primitive_desc primDesc) { +static impl_desc_type implTypeFromPrimDesc(const dnnl::primitive_desc& primDesc) { const auto implType = parse_impl_name(primDesc.impl_info_str()); if (implType == ov::intel_cpu::brgemm_avx512_amx && primDesc.weights_desc().get_format_kind() == memory::format_kind::sparsed) { diff --git a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.hpp b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.hpp index 5491b62a154687..38ceb9922eff70 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_matmul_primitive.hpp @@ -58,11 +58,11 @@ class DnnlMatMulPrimitive { static DnnlShapeAgnosticDataPtr createShapeAgnosticData(const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context, + const ExecutorContext::CPtr& context, const bool cacheWeights); - static DnnlMemoryDescPtr makeTransposedWeightDescriptor(const DnnlMemoryDescPtr srcDesc, - const DnnlMemoryDescPtr dstDesc, + static DnnlMemoryDescPtr makeTransposedWeightDescriptor(const DnnlMemoryDescPtr& srcDesc, + const DnnlMemoryDescPtr& dstDesc, bool weightsNonTransposed); static std::shared_ptr create(const MemoryArgs& memory, diff --git a/src/plugins/intel_cpu/src/nodes/executors/eltwise.cpp b/src/plugins/intel_cpu/src/nodes/executors/eltwise.cpp index 8e7c470984b4f2..31ffd979662f8c 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/eltwise.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/eltwise.cpp @@ -4,10 +4,12 @@ #include "eltwise.hpp" +#include + namespace ov { namespace intel_cpu { -EltwiseExecutor::EltwiseExecutor(const ExecutorContext::CPtr context) : context(context) {} +EltwiseExecutor::EltwiseExecutor(ExecutorContext::CPtr context) : context(std::move(context)) {} } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/nodes/executors/eltwise.hpp b/src/plugins/intel_cpu/src/nodes/executors/eltwise.hpp index b33c0eca10dae7..95ff85bb8bf851 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/eltwise.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/eltwise.hpp @@ -4,6 +4,8 @@ #pragma once +#include + #include "cpu_memory.h" #include "executor.hpp" #include "onednn/iml_type_mapper.h" @@ -49,15 +51,9 @@ enum class EltwisePostOpType { Undefined, Eltwise, Dnnl }; class EltwisePostOp { public: - EltwisePostOp(EltwiseAttrs eltwise) { - type = EltwisePostOpType::Eltwise; - this->eltwise = eltwise; - } + EltwisePostOp(EltwiseAttrs eltwise) : eltwise(eltwise), type(EltwisePostOpType::Eltwise) {} - EltwisePostOp(dnnl::post_ops dnnlPostOps) { - type = EltwisePostOpType::Dnnl; - this->dnnlPostOps = dnnlPostOps; - } + EltwisePostOp(dnnl::post_ops dnnlPostOps) : dnnlPostOps(std::move(dnnlPostOps)), type(EltwisePostOpType::Dnnl) {} ~EltwisePostOp() = default; @@ -87,7 +83,7 @@ class EltwisePostOp { class EltwiseExecutor { public: - EltwiseExecutor(const ExecutorContext::CPtr context); + EltwiseExecutor(ExecutorContext::CPtr context); virtual bool init(const EltwiseAttrs& eltwiseAttrs, const std::vector& srcDescs, const std::vector& dstDescs, @@ -121,4 +117,4 @@ using EltwiseExecutorBuilderPtr = std::shared_ptr; using EltwiseExecutorBuilderCPtr = std::shared_ptr; } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/nodes/executors/eltwise_list.hpp b/src/plugins/intel_cpu/src/nodes/executors/eltwise_list.hpp index ac5c27c0ad36dc..f970d79c3ed1b2 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/eltwise_list.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/eltwise_list.hpp @@ -32,7 +32,7 @@ class EltwiseExecutorFactory : public ExecutorFactoryLegacy { EltwiseExecutorFactory(const EltwiseAttrs& eltwiseAttrs, const std::vector& srcDescs, const std::vector& dstDescs, - const ExecutorContext::CPtr context) + const ExecutorContext::CPtr& context) : ExecutorFactoryLegacy(context) { for (auto& desc : getEltwiseExecutorsList()) { if (desc.builder->isSupported(eltwiseAttrs, srcDescs, dstDescs)) { diff --git a/src/plugins/intel_cpu/src/nodes/executors/executor.hpp b/src/plugins/intel_cpu/src/nodes/executors/executor.hpp index 16a419c95d5efc..1d0e4c877ff8e5 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/executor.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/executor.hpp @@ -5,6 +5,7 @@ #pragma once #include +#include #include "cache/multi_cache.h" #include "cpu_memory.h" @@ -86,14 +87,14 @@ class ExecutorContext { using Ptr = std::shared_ptr; using CPtr = std::shared_ptr; - ExecutorContext(const GraphContext::CPtr graphContext, - const std::vector& implPriorities, + ExecutorContext(const GraphContext::CPtr& graphContext, + std::vector implPriorities, std::shared_ptr> privateWeighCache = nullptr) : runtimeCache(graphContext->getParamsCache()), scratchPads(graphContext->getScratchPads()), weightsCache(graphContext->getWeightsCache()), engine(graphContext->getEngine()), - implPriorities(implPriorities), + implPriorities(std::move(implPriorities)), privateWeighCache(std::move(privateWeighCache)), numNumaNodes(graphContext->getNumNumaNodes()) { auto cpuStreamsExecutor = graphContext->getCPUStreamExecutor(); @@ -142,7 +143,7 @@ class ExecutorContext { class ExecutorFactoryLegacy { public: - ExecutorFactoryLegacy(const ExecutorContext::CPtr context) : context(context) {} + ExecutorFactoryLegacy(ExecutorContext::CPtr context) : context(std::move(context)) {} virtual ~ExecutorFactoryLegacy() = default; const ExecutorContext::CPtr context; diff --git a/src/plugins/intel_cpu/src/nodes/executors/executor_factory.hpp b/src/plugins/intel_cpu/src/nodes/executors/executor_factory.hpp index 3130bc2d646ff3..0b44a870ddb692 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/executor_factory.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/executor_factory.hpp @@ -6,6 +6,7 @@ #include #include +#include #include "executor.hpp" #include "nodes/executors/executor_config.hpp" @@ -27,12 +28,12 @@ class ExecutorFactory { ExecutorFactory(const Attrs& attrs, const PostOps& postOps, - const ExecutorContext::CPtr context, + ExecutorContext::CPtr context, const MemoryDescArgs& descriptors, const std::string& implementationPriority = {}) : m_attrs(attrs), m_postOps(postOps), - m_context(context), + m_context(std::move(context)), m_suitableImplementations(filter(m_attrs, m_postOps, descriptors, implementationPriority)) {} /** diff --git a/src/plugins/intel_cpu/src/nodes/executors/executor_implementation.hpp b/src/plugins/intel_cpu/src/nodes/executors/executor_implementation.hpp index 07a58b0fa6cfa7..375016038f2b68 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/executor_implementation.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/executor_implementation.hpp @@ -25,7 +25,7 @@ class ExecutorImplementation { using CreateFunction = std::function; + const ExecutorContext::CPtr& context)>; ExecutorImplementation(const char* name, const ExecutorType type, diff --git a/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp b/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp index f2cf5a7c9102b7..792aacf54a118a 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp @@ -254,7 +254,7 @@ const std::vector>& getImplementations() { [](const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context) { + const ExecutorContext::CPtr& context) { return std::make_shared(attrs, postOps, memory, context); }) OV_CPU_INSTANCE_X64( @@ -322,13 +322,13 @@ const std::vector>& getImplementations() { [](const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - ExecutorContext::CPtr context) -> std::shared_ptr { + const ExecutorContext::CPtr& context) -> std::shared_ptr { struct ConvolutionInstantiator { std::shared_ptr operator()( const MemoryArgs& memory, const FCAttrs& attrs, - const ExecutorContext::CPtr context, - std::shared_ptr shareAgnosticData) const { + const ExecutorContext::CPtr& context, + const std::shared_ptr& shareAgnosticData) const { ConvAttrs convAttrs{attrs.withBias}; auto primitive = DefaultInstantiator{}( @@ -380,7 +380,7 @@ const std::vector>& getImplementations() { [](const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context) { + const ExecutorContext::CPtr& context) { return std::make_shared(attrs, postOps, memory, context); }) OV_CPU_INSTANCE_ACL( @@ -412,7 +412,7 @@ const std::vector>& getImplementations() { [](const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context) { + const ExecutorContext::CPtr& context) { return std::make_shared(attrs, postOps, memory, context); }) OV_CPU_INSTANCE_SHL( @@ -441,7 +441,7 @@ const std::vector>& getImplementations() { [](const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context) { + const ExecutorContext::CPtr& context) { return std::make_shared(attrs, postOps, memory, context); } ) @@ -475,13 +475,13 @@ const std::vector>& getImplementations() { [](const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - ExecutorContext::CPtr context) -> std::shared_ptr { + const ExecutorContext::CPtr& context) -> std::shared_ptr { struct MatMulInstantiator { std::shared_ptr operator()( const MemoryArgs& memory, const FCAttrs& attrs, - const ExecutorContext::CPtr context, - std::shared_ptr shareAgnosticData) const { + const ExecutorContext::CPtr& context, + const std::shared_ptr& shareAgnosticData) const { MatMulAttrs matMulAttrs{false, false}; auto primitive = @@ -523,7 +523,10 @@ const std::vector>& getImplementations() { return true; }, // create - [](const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, ExecutorContext::CPtr context) { + [](const FCAttrs& attrs, + const PostOps& postOps, + const MemoryArgs& memory, + const ExecutorContext::CPtr& context) { return std::make_shared>(attrs, postOps, memory, diff --git a/src/plugins/intel_cpu/src/nodes/executors/graph_emitter.hpp b/src/plugins/intel_cpu/src/nodes/executors/graph_emitter.hpp index 347ac4c981f4f1..2f1ca6600bbd14 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/graph_emitter.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/graph_emitter.hpp @@ -5,6 +5,7 @@ #pragma once #include +#include #include "graph.h" #include "node.h" @@ -26,13 +27,13 @@ class GraphEmitter { const Attrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context, + ExecutorContext::CPtr context, const std::string& name, ensureAttrsStrategy ensureAttrs = {}) : descs(descs), attrs(attrs), postOps(postOps), - context(context), + context(std::move(context)), name(name), ensureAttrs(std::move(ensureAttrs)) { OPENVINO_THROW("Graph emitter is not implemented yet!"); @@ -41,7 +42,7 @@ class GraphEmitter { GraphEmitter& createGraph(const MemoryDescArgs& descs, const Attrs& attrs, const PostOps& postOps, - const ExecutorContext::CPtr context) { + const ExecutorContext::CPtr& context) { OPENVINO_THROW("Not implemented yet!"); return *this; } diff --git a/src/plugins/intel_cpu/src/nodes/executors/interpolate.hpp b/src/plugins/intel_cpu/src/nodes/executors/interpolate.hpp index 152f8aa9c42dc8..b8b89fdf717996 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/interpolate.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/interpolate.hpp @@ -4,6 +4,8 @@ #pragma once +#include + #include "node.h" #define MAX_INPUT_INTERPOLATE 8 @@ -102,7 +104,7 @@ class InterpolateExecutor { static constexpr size_t SCALES_ID = 2; static constexpr size_t AXES_ID = 3; static constexpr int CUBIC_GRID_LEN = 4; - InterpolateExecutor(const ExecutorContext::CPtr context) : _context(context) {} + InterpolateExecutor(ExecutorContext::CPtr context) : _context(std::move(context)) {} virtual bool init(const InterpolateAttrs& interpolateAttrs, const std::vector& srcDescs, diff --git a/src/plugins/intel_cpu/src/nodes/executors/interpolate_list.hpp b/src/plugins/intel_cpu/src/nodes/executors/interpolate_list.hpp index a0c1fc240731fb..360dae8e16c432 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/interpolate_list.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/interpolate_list.hpp @@ -28,7 +28,7 @@ class InterpolateExecutorFactory : public ExecutorFactoryLegacy { InterpolateExecutorFactory(const InterpolateAttrs& InterpolateAttrs, const std::vector& srcDescs, const std::vector& dstDescs, - const ExecutorContext::CPtr context) + const ExecutorContext::CPtr& context) : ExecutorFactoryLegacy(context) { for (auto& desc : getInterpolateExecutorsList()) { if (desc.builder->isSupported(InterpolateAttrs, srcDescs, dstDescs)) { diff --git a/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.cpp b/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.cpp index 7e50c8086789a0..03daeba24c65d8 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.cpp @@ -99,7 +99,7 @@ bool MlasGemmExecutor::supports(const FCConfig& config) { MlasGemmExecutor::MlasGemmExecutor(const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context) + const ExecutorContext::CPtr& context) : m_attrs(attrs), m_memoryArgs(memory), packedWeights(prepareWeightMemory(memory.at(ARG_WEI), context, !attrs.weightsNonTransposed)), diff --git a/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.hpp b/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.hpp index 4fe48b66c7c1ff..42be857ba9dead 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.hpp @@ -18,7 +18,7 @@ class MlasGemmExecutor : public Executor { MlasGemmExecutor(const FCAttrs& attrs, const PostOps& postOps, const MemoryArgs& memory, - const ExecutorContext::CPtr context); + const ExecutorContext::CPtr& context); void execute(const MemoryArgs& memory) override; diff --git a/src/plugins/intel_cpu/src/nodes/executors/mvn.cpp b/src/plugins/intel_cpu/src/nodes/executors/mvn.cpp index eec9d2a8947975..2c66b9ce56af14 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/mvn.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/mvn.cpp @@ -4,10 +4,12 @@ #include "mvn.hpp" +#include + namespace ov { namespace intel_cpu { -MVNExecutor::MVNExecutor(const ExecutorContext::CPtr context) : context(context) {} +MVNExecutor::MVNExecutor(ExecutorContext::CPtr context) : context(std::move(context)) {} VectorDims MVNExecutor::transformTo5DCase(const VectorDims& shape, bool initAcrossChannels) { switch (shape.size()) { @@ -41,4 +43,4 @@ VectorDims MVNExecutor::transformTo5DCase(const VectorDims& shape, bool initAcro } } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/nodes/executors/mvn.hpp b/src/plugins/intel_cpu/src/nodes/executors/mvn.hpp index da51b5d1ef67e9..2b08dc2a320b5d 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/mvn.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/mvn.hpp @@ -29,7 +29,7 @@ struct MVNAttrs { class MVNExecutor { public: - MVNExecutor(const ExecutorContext::CPtr context); + MVNExecutor(ExecutorContext::CPtr context); virtual bool init(const MVNAttrs& mvnAttrs, const std::vector& srcDescs, const std::vector& dstDescs, diff --git a/src/plugins/intel_cpu/src/nodes/executors/mvn_list.hpp b/src/plugins/intel_cpu/src/nodes/executors/mvn_list.hpp index 82f8e868ac2d81..59d0447965a803 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/mvn_list.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/mvn_list.hpp @@ -28,7 +28,7 @@ class MVNExecutorFactory : public ExecutorFactoryLegacy { MVNExecutorFactory(const MVNAttrs& mvnAttrs, const std::vector& srcDescs, const std::vector& dstDescs, - const ExecutorContext::CPtr context) + const ExecutorContext::CPtr& context) : ExecutorFactoryLegacy(context) { for (auto& desc : getMVNExecutorsList()) { if (desc.builder->isSupported(mvnAttrs, srcDescs, dstDescs)) { diff --git a/src/plugins/intel_cpu/src/nodes/executors/pooling.cpp b/src/plugins/intel_cpu/src/nodes/executors/pooling.cpp index 95448640e3b125..cd45dbc375d8e9 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/pooling.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/pooling.cpp @@ -4,10 +4,12 @@ #include "pooling.hpp" +#include + namespace ov { namespace intel_cpu { -PoolingExecutor::PoolingExecutor(const ExecutorContext::CPtr context) : context(context) {} +PoolingExecutor::PoolingExecutor(ExecutorContext::CPtr context) : context(std::move(context)) {} } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/nodes/executors/pooling.hpp b/src/plugins/intel_cpu/src/nodes/executors/pooling.hpp index e826d3a37250db..325ae17f161c93 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/pooling.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/pooling.hpp @@ -40,7 +40,7 @@ struct PoolingAttrs { class PoolingExecutor { public: - PoolingExecutor(const ExecutorContext::CPtr context); + PoolingExecutor(ExecutorContext::CPtr context); virtual bool init(const PoolingAttrs& poolingAttrs, const std::vector& srcDescs, const std::vector& dstDescs, @@ -74,4 +74,4 @@ using PoolingExecutorBuilderPtr = std::shared_ptr; using PoolingExecutorBuilderCPtr = std::shared_ptr; } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/nodes/executors/pooling_list.hpp b/src/plugins/intel_cpu/src/nodes/executors/pooling_list.hpp index 1c051ae7d2959d..1cf34912e2293f 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/pooling_list.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/pooling_list.hpp @@ -25,7 +25,7 @@ class PoolingExecutorFactory : public ExecutorFactoryLegacy { PoolingExecutorFactory(const PoolingAttrs& poolingAttrs, const std::vector& srcDescs, const std::vector& dstDescs, - const ExecutorContext::CPtr context) + const ExecutorContext::CPtr& context) : ExecutorFactoryLegacy(context) { for (auto& desc : getPoolingExecutorsList()) { if (desc.builder->isSupported(poolingAttrs, srcDescs, dstDescs)) { diff --git a/src/plugins/intel_cpu/src/nodes/executors/reduce.cpp b/src/plugins/intel_cpu/src/nodes/executors/reduce.cpp index 6039813d8fdd28..54b70fb46d03cd 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/reduce.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/reduce.cpp @@ -4,10 +4,12 @@ #include "reduce.hpp" +#include + namespace ov { namespace intel_cpu { -ReduceExecutor::ReduceExecutor(const ExecutorContext::CPtr context) : context(context) {} +ReduceExecutor::ReduceExecutor(ExecutorContext::CPtr context) : context(std::move(context)) {} } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/nodes/executors/reduce.hpp b/src/plugins/intel_cpu/src/nodes/executors/reduce.hpp index 21b730a197df3a..52b4b1921ec0c1 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/reduce.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/reduce.hpp @@ -20,7 +20,7 @@ struct ReduceAttrs { class ReduceExecutor { public: - ReduceExecutor(const ExecutorContext::CPtr context); + ReduceExecutor(ExecutorContext::CPtr context); virtual bool init(const ReduceAttrs& reduceAttrs, const std::vector& srcDescs, const std::vector& dstDescs, @@ -54,4 +54,4 @@ using ReduceExecutorBuilderPtr = std::shared_ptr; using ReduceExecutorBuilderCPtr = std::shared_ptr; } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/nodes/executors/reduce_list.hpp b/src/plugins/intel_cpu/src/nodes/executors/reduce_list.hpp index faffdebc947c02..8246d497e684ee 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/reduce_list.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/reduce_list.hpp @@ -28,7 +28,7 @@ class ReduceExecutorFactory : public ExecutorFactoryLegacy { ReduceExecutorFactory(const ReduceAttrs& reduceAttrs, const std::vector& srcDescs, const std::vector& dstDescs, - const ExecutorContext::CPtr context) + const ExecutorContext::CPtr& context) : ExecutorFactoryLegacy(context) { for (auto& desc : getReduceExecutorsList()) { if (desc.builder->isSupported(reduceAttrs, srcDescs, dstDescs)) { diff --git a/src/plugins/intel_cpu/src/nodes/executors/subgraph.cpp b/src/plugins/intel_cpu/src/nodes/executors/subgraph.cpp index 002561158041c4..14b929633db8c6 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/subgraph.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/subgraph.cpp @@ -4,6 +4,8 @@ #include "nodes/executors/subgraph.hpp" +#include + #include "common/primitive_hashing_utils.hpp" #include "openvino/core/parallel.hpp" @@ -59,13 +61,13 @@ SubgraphCodeGenerator::SubgraphCodeGenerator(const std::shared_ptr& snippet_config, const std::shared_ptr& snippet_attrs, const std::shared_ptr& snippet, - const std::vector& start_offset_in, - const std::vector& start_offset_out, + std::vector start_offset_in, + std::vector start_offset_out, const BufferScratchpadAllocator& allocator, const ov::intel_cpu::MultiCacheWeakPtr& kernel_cache) : m_schedule(snippet->get()), - m_start_offset_in(start_offset_in), - m_start_offset_out(start_offset_out) { + m_start_offset_in(std::move(start_offset_in)), + m_start_offset_out(std::move(start_offset_out)) { OPENVINO_ASSERT(m_schedule, "Schedule is empty!"); OPENVINO_ASSERT(snippet_config, "Runtime Config is empty!"); init_parallel_domain(snippet_config, m_parallel_exec_domain); diff --git a/src/plugins/intel_cpu/src/nodes/executors/subgraph.hpp b/src/plugins/intel_cpu/src/nodes/executors/subgraph.hpp index 6af828099a3f9b..f731a507e61c2e 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/subgraph.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/subgraph.hpp @@ -46,8 +46,8 @@ class SubgraphBaseExecutor { SubgraphBaseExecutor(const std::shared_ptr& snippet_config, const std::shared_ptr& snippet_attrs, const std::shared_ptr& snippet, - const std::vector& start_offset_in, - const std::vector& start_offset_out, + std::vector start_offset_in, + std::vector start_offset_out, const BufferScratchpadAllocator& allocator, const ov::intel_cpu::MultiCacheWeakPtr& kernel_cache); virtual ~SubgraphBaseExecutor() = default; @@ -124,10 +124,10 @@ class SubgraphStaticBaseExecutor { // Specialized dynamic executor based on shape agnostic kernel for the specific input shapes class SubgraphDynamicSpecializedBaseExecutor { public: - SubgraphDynamicSpecializedBaseExecutor(const std::shared_ptr& snippet_config) { - m_buffer_offsets = snippet_config->buffer_cluster_offsets; - m_data_offsets = snippet_config->io_data_offsets; - m_loop_args = snippet_config->loop_args; + SubgraphDynamicSpecializedBaseExecutor(const std::shared_ptr& snippet_config) + : m_buffer_offsets(snippet_config->buffer_cluster_offsets), + m_data_offsets(snippet_config->io_data_offsets), + m_loop_args(snippet_config->loop_args) { m_reset_exec_table_state = snippet_config->kernel_executor_table->get_state_reset(); } virtual ~SubgraphDynamicSpecializedBaseExecutor() = default; diff --git a/src/plugins/intel_cpu/src/nodes/executors/transpose.cpp b/src/plugins/intel_cpu/src/nodes/executors/transpose.cpp index b63e32e39ebf8d..ddf4cf20034d92 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/transpose.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/transpose.cpp @@ -4,6 +4,7 @@ #include "transpose.hpp" +#include #include #include "openvino/core/parallel.hpp" @@ -11,7 +12,7 @@ namespace ov { namespace intel_cpu { -TransposeExecutor::TransposeExecutor(const ExecutorContext::CPtr context) : context(context) {} +TransposeExecutor::TransposeExecutor(ExecutorContext::CPtr context) : context(std::move(context)) {} jit_permute_config_params TransposeExecutor::prepareParams(const PermuteParams& params) { jit_permute_config_params jcp = {}; @@ -131,4 +132,4 @@ jit_permute_config_params TransposeExecutor::prepareParams(const PermuteParams& } } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/nodes/executors/transpose.hpp b/src/plugins/intel_cpu/src/nodes/executors/transpose.hpp index 99e0b0a2742a78..6e569e62b65a19 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/transpose.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/transpose.hpp @@ -19,7 +19,7 @@ struct TransposeParams { class TransposeExecutor : public Executor { public: static jit_permute_config_params prepareParams(const PermuteParams& params); - explicit TransposeExecutor(const ExecutorContext::CPtr context); + explicit TransposeExecutor(ExecutorContext::CPtr context); virtual bool init(const TransposeParams& transposeParams, const std::vector& srcDescs, const std::vector& dstDescs, diff --git a/src/plugins/intel_cpu/src/nodes/executors/transpose_list.hpp b/src/plugins/intel_cpu/src/nodes/executors/transpose_list.hpp index c81769fd1d0539..305c8c4662122c 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/transpose_list.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/transpose_list.hpp @@ -32,7 +32,7 @@ class TransposeExecutorFactory : public ExecutorFactoryLegacy { TransposeExecutorFactory(const TransposeParams& transposeParams, const std::vector& srcDescs, const std::vector& dstDescs, - const ExecutorContext::CPtr context) + const ExecutorContext::CPtr& context) : ExecutorFactoryLegacy(context) { for (auto& desc : getTransposeExecutorsList()) { if (desc.builder->isSupported(transposeParams, srcDescs, dstDescs)) { diff --git a/src/plugins/intel_cpu/src/nodes/executors/variable_executor.hpp b/src/plugins/intel_cpu/src/nodes/executors/variable_executor.hpp index 3688bc6cc60873..8b777c782aeba8 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/variable_executor.hpp +++ b/src/plugins/intel_cpu/src/nodes/executors/variable_executor.hpp @@ -4,6 +4,8 @@ #pragma once +#include + #include "executor.hpp" #include "executor_config.hpp" #include "executor_implementation.hpp" @@ -25,11 +27,11 @@ class VariableExecutor : public Executor { VariableExecutor(const MemoryArgs& memory, const Attrs& attrs, const PostOps& postOps, - const ExecutorContext::CPtr context, + ExecutorContext::CPtr context, std::vector suitableImplementations) : m_attrs(attrs), m_postOps(postOps), - m_context(context), + m_context(std::move(context)), m_suitableImplementations(std::move(suitableImplementations)), m_implementationRequiresFallback( cacheFallbackStatus(m_suitableImplementations, diff --git a/src/plugins/intel_cpu/src/nodes/executors/x64/subgraph.cpp b/src/plugins/intel_cpu/src/nodes/executors/x64/subgraph.cpp index 8b3466c9c22c5a..0bb6bfaf6d1e26 100644 --- a/src/plugins/intel_cpu/src/nodes/executors/x64/subgraph.cpp +++ b/src/plugins/intel_cpu/src/nodes/executors/x64/subgraph.cpp @@ -76,10 +76,9 @@ SubgraphExecutor::SubgraphExecutor(const std::shared_ptr& snip start_offset_in, start_offset_out, allocator, - kernel_cache) { - m_repacking_impl_type = snippet_config->repacking_impl_type; - m_repacked_inputs = snippet_config->repacked_inputs; - + kernel_cache), + m_repacked_inputs(snippet_config->repacked_inputs), + m_repacking_impl_type(snippet_config->repacking_impl_type) { auto external_buffer_size = std::accumulate(m_repacked_inputs.begin(), m_repacked_inputs.end(), diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.cpp index 072ba42284eff9..7e46da40ddeded 100644 --- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.cpp +++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.cpp @@ -5,6 +5,7 @@ #include "openvino/op/experimental_detectron_detection_output.hpp" #include +#include #include #include "experimental_detectron_detection_output.h" @@ -15,13 +16,12 @@ namespace intel_cpu { namespace node { struct Indexer { - const std::vector dims_; + std::vector dims_; int total_{1}; - explicit Indexer(const std::vector& dims) : dims_(dims) { - total_ = 1; - for (size_t i = 0; i < dims_.size(); ++i) { - total_ *= dims_[i]; + explicit Indexer(std::vector dims) : dims_(std::move(dims)), total_(1) { + for (const auto dim : dims_) { + total_ *= dim; } } @@ -246,7 +246,7 @@ bool ExperimentalDetectronDetectionOutput::isSupportedOperation(const std::share } ExperimentalDetectronDetectionOutput::ExperimentalDetectronDetectionOutput(const std::shared_ptr& op, - const GraphContext::CPtr context) + const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -281,7 +281,7 @@ void ExperimentalDetectronDetectionOutput::initSupportedPrimitiveDescriptors() { impl_desc_type::ref_any); } -void ExperimentalDetectronDetectionOutput::execute(dnnl::stream strm) { +void ExperimentalDetectronDetectionOutput::execute(const dnnl::stream& strm) { const int rois_num = getParentEdgeAt(INPUT_ROIS)->getMemory().getStaticDims()[0]; assert(classes_num_ == static_cast(getParentEdgeAt(INPUT_SCORES)->getMemory().getStaticDims()[1])); assert(4 * classes_num_ == static_cast(getParentEdgeAt(INPUT_DELTAS)->getMemory().getStaticDims()[1])); diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.h b/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.h index 1eebcc308ca420..3b6605f73dc94b 100644 --- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.h +++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.h @@ -12,16 +12,16 @@ namespace node { class ExperimentalDetectronDetectionOutput : public Node { public: - ExperimentalDetectronDetectionOutput(const std::shared_ptr& op, const GraphContext::CPtr context); + ExperimentalDetectronDetectionOutput(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needShapeInfer() const override; bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.cpp index f0e8bb1b847fc3..7f613b39ac3e9f 100644 --- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.cpp +++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.cpp @@ -304,7 +304,7 @@ bool ExperimentalDetectronGenerateProposalsSingleImage::isSupportedOperation(con ExperimentalDetectronGenerateProposalsSingleImage::ExperimentalDetectronGenerateProposalsSingleImage( const std::shared_ptr& op, - const GraphContext::CPtr context) + const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -336,7 +336,7 @@ void ExperimentalDetectronGenerateProposalsSingleImage::initSupportedPrimitiveDe impl_desc_type::ref_any); } -void ExperimentalDetectronGenerateProposalsSingleImage::execute(dnnl::stream strm) { +void ExperimentalDetectronGenerateProposalsSingleImage::execute(const dnnl::stream& strm) { try { if (inputShapes.size() != 4 || outputShapes.size() != 2) { OPENVINO_THROW("Incorrect number of input or output edges!"); diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.h b/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.h index 4b6a809c156958..66c8ad489ee915 100644 --- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.h +++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.h @@ -13,16 +13,16 @@ namespace node { class ExperimentalDetectronGenerateProposalsSingleImage : public Node { public: ExperimentalDetectronGenerateProposalsSingleImage(const std::shared_ptr& op, - const GraphContext::CPtr context); + const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needShapeInfer() const override; bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cpp index 873750b5a13d4a..298f369930238f 100644 --- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cpp +++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cpp @@ -28,7 +28,7 @@ bool ExperimentalDetectronPriorGridGenerator::isSupportedOperation(const std::sh } ExperimentalDetectronPriorGridGenerator::ExperimentalDetectronPriorGridGenerator(const std::shared_ptr& op, - const GraphContext::CPtr context) + const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -57,7 +57,7 @@ void ExperimentalDetectronPriorGridGenerator::initSupportedPrimitiveDescriptors( impl_desc_type::ref_any); } -void ExperimentalDetectronPriorGridGenerator::execute(dnnl::stream strm) { +void ExperimentalDetectronPriorGridGenerator::execute(const dnnl::stream& strm) { const int num_priors_ = getParentEdgeAt(INPUT_PRIORS)->getMemory().getStaticDims()[0]; assert(getParentEdgeAt(INPUT_PRIORS)->getMemory().getStaticDims()[1] == 4); diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.h b/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.h index 37b0d81300c483..c8c1343ef05219 100644 --- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.h +++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.h @@ -12,15 +12,15 @@ namespace node { class ExperimentalDetectronPriorGridGenerator : public Node { public: - ExperimentalDetectronPriorGridGenerator(const std::shared_ptr& op, const GraphContext::CPtr context); + ExperimentalDetectronPriorGridGenerator(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.cpp index 7a5b8eae3bd688..a22ecad308c52f 100644 --- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.cpp +++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.cpp @@ -5,6 +5,7 @@ #include "experimental_detectron_roifeatureextractor.h" #include +#include #include #include #include @@ -165,9 +166,11 @@ void ROIAlignForward_cpu_kernel(const int nthreads, T bin_size_w = static_cast(roi_width) / static_cast(pooled_width); // We use roi_bin_grid to sample the grid and mimic integral - int roi_bin_grid_h = - (sampling_ratio > 0) ? sampling_ratio : static_cast(ceil(roi_height / pooled_height)); // e.g., = 2 - int roi_bin_grid_w = (sampling_ratio > 0) ? sampling_ratio : static_cast(ceil(roi_width / pooled_width)); + int roi_bin_grid_h = (sampling_ratio > 0) + ? sampling_ratio + : static_cast(std::ceil(roi_height / pooled_height)); // e.g., = 2 + int roi_bin_grid_w = + (sampling_ratio > 0) ? sampling_ratio : static_cast(std::ceil(roi_width / pooled_width)); // We do average (integral) pooling inside a bin const T count = static_cast(roi_bin_grid_h * roi_bin_grid_w); // e.g. = 4 @@ -283,7 +286,7 @@ bool ExperimentalDetectronROIFeatureExtractor::isSupportedOperation(const std::s } ExperimentalDetectronROIFeatureExtractor::ExperimentalDetectronROIFeatureExtractor(const std::shared_ptr& op, - const GraphContext::CPtr context) + const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -314,7 +317,7 @@ void ExperimentalDetectronROIFeatureExtractor::initSupportedPrimitiveDescriptors impl_desc_type::ref_any); } -void ExperimentalDetectronROIFeatureExtractor::execute(dnnl::stream strm) { +void ExperimentalDetectronROIFeatureExtractor::execute(const dnnl::stream& strm) { const int levels_num = inputShapes.size() - INPUT_FEATURES_START; const int num_rois = getParentEdgeAt(INPUT_ROIS)->getMemory().getStaticDims()[0]; const int channels_num = getParentEdgeAt(INPUT_FEATURES_START)->getMemory().getStaticDims()[1]; diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.h b/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.h index 78a82182fef4e3..e8b7c84bd7d87b 100644 --- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.h +++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.h @@ -12,17 +12,17 @@ namespace node { class ExperimentalDetectronROIFeatureExtractor : public Node { public: - ExperimentalDetectronROIFeatureExtractor(const std::shared_ptr& op, const GraphContext::CPtr context); + ExperimentalDetectronROIFeatureExtractor(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override { return false; }; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); }; diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.cpp index 096e5bebf2f5fb..0fdad9f3c050fc 100644 --- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.cpp +++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.cpp @@ -31,7 +31,7 @@ bool ExperimentalDetectronTopKROIs::isSupportedOperation(const std::shared_ptr& op, - const GraphContext::CPtr context) + const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -62,7 +62,7 @@ void ExperimentalDetectronTopKROIs::initSupportedPrimitiveDescriptors() { impl_desc_type::ref_any); } -void ExperimentalDetectronTopKROIs::execute(dnnl::stream strm) { +void ExperimentalDetectronTopKROIs::execute(const dnnl::stream& strm) { const int input_rois_num = getParentEdgeAt(INPUT_ROIS)->getMemory().getStaticDims()[0]; const int top_rois_num = (std::min)(max_rois_num_, input_rois_num); diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.h b/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.h index 5e328d224d458b..029fa579f78e87 100644 --- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.h +++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_topkrois.h @@ -12,11 +12,11 @@ namespace node { class ExperimentalDetectronTopKROIs : public Node { public: - ExperimentalDetectronTopKROIs(const std::shared_ptr& op, const GraphContext::CPtr context); + ExperimentalDetectronTopKROIs(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needShapeInfer() const override { @@ -25,7 +25,7 @@ class ExperimentalDetectronTopKROIs : public Node { bool needPrepareParams() const override { return false; }; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); }; diff --git a/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp b/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp index 534f5a518ad11e..7fbe1c3449bfd0 100644 --- a/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp +++ b/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp @@ -357,7 +357,7 @@ bool ExtractImagePatchesKey::operator==(const ExtractImagePatchesKey& rhs) const } } // namespace -ExtractImagePatches::ExtractImagePatches(const std::shared_ptr& op, const GraphContext::CPtr context) +ExtractImagePatches::ExtractImagePatches(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -447,7 +447,7 @@ void ExtractImagePatches::initSupportedPrimitiveDescriptors() { addSupportedPrimDesc({{LayoutType::ncsp, precision}}, {{LayoutType::ncsp, precision}}, impl_desc_type::ref_any); } -void ExtractImagePatches::execute(dnnl::stream strm) { +void ExtractImagePatches::execute(const dnnl::stream& strm) { if (execPtr) { auto src = getSrcDataAtPort(0); auto dst = getDstDataAtPort(0); @@ -459,7 +459,7 @@ void ExtractImagePatches::execute(dnnl::stream strm) { } } -void ExtractImagePatches::executeDynamicImpl(dnnl::stream strm) { +void ExtractImagePatches::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/extract_image_patches.h b/src/plugins/intel_cpu/src/nodes/extract_image_patches.h index f4f3ecc50901aa..49c788086afc41 100644 --- a/src/plugins/intel_cpu/src/nodes/extract_image_patches.h +++ b/src/plugins/intel_cpu/src/nodes/extract_image_patches.h @@ -43,14 +43,14 @@ struct jit_uni_extract_image_patches_kernel { class ExtractImagePatches : public Node { public: - ExtractImagePatches(const std::shared_ptr& op, const GraphContext::CPtr context); + ExtractImagePatches(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; void prepareParams() override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/eye.cpp b/src/plugins/intel_cpu/src/nodes/eye.cpp index 57fbdd66d0308f..873d07673c8990 100644 --- a/src/plugins/intel_cpu/src/nodes/eye.cpp +++ b/src/plugins/intel_cpu/src/nodes/eye.cpp @@ -4,6 +4,7 @@ #include "eye.h" +#include #include #include "openvino/core/parallel.hpp" @@ -33,7 +34,7 @@ bool Eye::isSupportedOperation(const std::shared_ptr& op, std::s namespace { class EyeShapeInferFactory : public ShapeInferFactory { public: - EyeShapeInferFactory(std::shared_ptr op) : m_op(op) {} + EyeShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override { return (m_op->get_input_size() == 4) ? make_shape_inference(m_op) : make_shape_inference(m_op, PortMask(Eye::ROWS_NUM, Eye::COLS_NUM)); @@ -44,7 +45,7 @@ class EyeShapeInferFactory : public ShapeInferFactory { }; } // namespace -Eye::Eye(const std::shared_ptr& op, const GraphContext::CPtr context) +Eye::Eye(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, EyeShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -71,7 +72,7 @@ struct Eye::EyeExecute { } }; -void Eye::execute(dnnl::stream strm) { +void Eye::execute(const dnnl::stream& strm) { auto outputPrec = getChildEdgeAt(0)->getMemory().getDesc().getPrecision(); OV_SWITCH(intel_cpu, EyeExecute, diff --git a/src/plugins/intel_cpu/src/nodes/eye.h b/src/plugins/intel_cpu/src/nodes/eye.h index 52f78e7cc33711..7bc20113a3af14 100644 --- a/src/plugins/intel_cpu/src/nodes/eye.h +++ b/src/plugins/intel_cpu/src/nodes/eye.h @@ -24,11 +24,11 @@ class Eye : public Node { static constexpr size_t BATCH_SHAPE = 3lu; public: - Eye(const std::shared_ptr& op, const GraphContext::CPtr context); + Eye(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override { return false; @@ -36,7 +36,7 @@ class Eye : public Node { bool needShapeInfer() const override { return true; }; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp b/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp index e7105f4f016bc7..f08657b7cc2f88 100644 --- a/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp +++ b/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp @@ -1056,7 +1056,7 @@ struct FakeQuantKey { }; } // namespace -FakeQuantize::FakeQuantize(const std::shared_ptr& op, const GraphContext::CPtr context) +FakeQuantize::FakeQuantize(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, PassThroughShapeInferFactory()) { std::string errorMessage; if (isSupportedOperation(op, errorMessage)) { @@ -1911,11 +1911,11 @@ void FakeQuantize::executeQuantization(const std::unique_ptrgetImplementationType() != impl_desc_type::ref) { execPtr->exec(*this); } else { diff --git a/src/plugins/intel_cpu/src/nodes/fake_quantize.h b/src/plugins/intel_cpu/src/nodes/fake_quantize.h index 4f985df4cdae41..950c598dfdb51d 100644 --- a/src/plugins/intel_cpu/src/nodes/fake_quantize.h +++ b/src/plugins/intel_cpu/src/nodes/fake_quantize.h @@ -66,13 +66,13 @@ struct jit_uni_quantize_kernel { class FakeQuantize : public Node { public: - FakeQuantize(const std::shared_ptr& op, const GraphContext::CPtr context); + FakeQuantize(const std::shared_ptr& op, const GraphContext::CPtr& context); void initSupportedPrimitiveDescriptors() override; void getSupportedDescriptors() override; bool created() const override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; size_t getAxis() const { return axis; diff --git a/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp b/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp index decbea94be8dd6..bf215a9522a595 100644 --- a/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp +++ b/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp @@ -155,7 +155,7 @@ bool FullyConnected::isSupportedCompressedOperation(const std::shared_ptrgetCPUStreamExecutor()) { if (!context->getCPUStreamExecutor()->get_rank().empty()) { // init tp_cfg.w_rank and tp_cfg.w_size @@ -167,7 +167,7 @@ void FullyConnected::initTensorParallelConfig(const GraphContext::CPtr context) } } -FullyConnected::FullyConnected(const std::shared_ptr& op, const GraphContext::CPtr context) +FullyConnected::FullyConnected(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, FCShapeInferFactory(op)) { std::string errorMessage; initTensorParallelConfig(context); @@ -356,7 +356,7 @@ void FullyConnected::execTensorParallelSync() { } } -void FullyConnected::execute(dnnl::stream strm) { +void FullyConnected::execute(const dnnl::stream& strm) { initTensorParallelSync(); executor->execute(memory); @@ -364,7 +364,7 @@ void FullyConnected::execute(dnnl::stream strm) { execTensorParallelSync(); } -void FullyConnected::executeDynamicImpl(dnnl::stream strm) { +void FullyConnected::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } @@ -579,14 +579,13 @@ void FullyConnected::needSplitMemoryForTensorParallel() { // wgt // split N direction tp_cfg.cached_splited_weight = - attrs.weightsNonTransposed - ? split_vertical(context->getEngine(), std::move(wgt), 0, tp_cfg.w_rank, tp_cfg.w_size) - : split_horizontal(context->getEngine(), std::move(wgt), 0, tp_cfg.w_rank, tp_cfg.w_size); + attrs.weightsNonTransposed ? split_vertical(context->getEngine(), wgt, 0, tp_cfg.w_rank, tp_cfg.w_size) + : split_horizontal(context->getEngine(), wgt, 0, tp_cfg.w_rank, tp_cfg.w_size); memory[ARG_WEI] = tp_cfg.cached_splited_weight; // bias if (attrs.withBias) { auto bias = getSrcMemoryAtPort(BIAS); - auto select_bias = split_horizontal(context->getEngine(), std::move(bias), 0, tp_cfg.w_rank, tp_cfg.w_size); + auto select_bias = split_horizontal(context->getEngine(), bias, 0, tp_cfg.w_rank, tp_cfg.w_size); tp_cfg.cached_splited_bias = std::move(select_bias); } else { tp_cfg.cached_splited_bias = MemoryDescUtils::makeEmptyMemory(context); @@ -594,8 +593,7 @@ void FullyConnected::needSplitMemoryForTensorParallel() { memory[ARG_BIAS] = tp_cfg.cached_splited_bias; // dst memory[ARG_DST] = getDstMemoryAtPort(0); - tp_cfg.cached_dst = - split_horizontal(context->getEngine(), std::move(dst), -1, tp_cfg.w_rank, tp_cfg.w_size, false); + tp_cfg.cached_dst = split_horizontal(context->getEngine(), dst, -1, tp_cfg.w_rank, tp_cfg.w_size, false); memory[ARG_DST | ARG_ATTR_SCALES] = split_horizontal(context->getEngine(), memory[ARG_DST | ARG_ATTR_SCALES], 0, tp_cfg.w_rank, tp_cfg.w_size); diff --git a/src/plugins/intel_cpu/src/nodes/fullyconnected.h b/src/plugins/intel_cpu/src/nodes/fullyconnected.h index 0338b9906a59c1..46d7c7dc1f041a 100644 --- a/src/plugins/intel_cpu/src/nodes/fullyconnected.h +++ b/src/plugins/intel_cpu/src/nodes/fullyconnected.h @@ -39,10 +39,10 @@ struct FCTensorParallelConfig { class FullyConnected : public Node { public: - FullyConnected(const std::shared_ptr& op, const GraphContext::CPtr context); + FullyConnected(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool canBeInPlace() const override { @@ -80,7 +80,7 @@ class FullyConnected : public Node { } void prepareParams() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool canBeExecutedInInt8() const override; void keepWeightsNonTransposed(bool weightsNonTransposed) { this->attrs.weightsNonTransposed = weightsNonTransposed; @@ -111,7 +111,7 @@ class FullyConnected : public Node { void fuseDecompressionConstant(const MemoryCPtr& memory, MemoryCPtr& decompressionValuesPtr); - void initTensorParallelConfig(const GraphContext::CPtr context); + void initTensorParallelConfig(const GraphContext::CPtr& context); void needUpdateTensorParalelConfig(); void needPrepareParamsForTensorParallel(); void initTensorParallelSync(); diff --git a/src/plugins/intel_cpu/src/nodes/gather.cpp b/src/plugins/intel_cpu/src/nodes/gather.cpp index 337d425465e564..e72901d7d43e62 100644 --- a/src/plugins/intel_cpu/src/nodes/gather.cpp +++ b/src/plugins/intel_cpu/src/nodes/gather.cpp @@ -58,7 +58,7 @@ bool Gather::isSupportedOperation(const std::shared_ptr& op, std return true; } -Gather::Gather(const std::shared_ptr& op, const GraphContext::CPtr context) +Gather::Gather(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, GatherShapeInferFactory(op)), batchDims(0) { std::string errorMessage; @@ -409,7 +409,7 @@ void Gather::prepareParams() { #endif } -void Gather::execute(dnnl::stream strm) { +void Gather::execute(const dnnl::stream& strm) { if (isInPlace()) { return; } @@ -477,7 +477,7 @@ void Gather::execute(dnnl::stream strm) { execReference(); } -void Gather::executeDynamicImpl(dnnl::stream strm) { +void Gather::executeDynamicImpl(const dnnl::stream& strm) { if (isInPlace()) { return; } diff --git a/src/plugins/intel_cpu/src/nodes/gather.h b/src/plugins/intel_cpu/src/nodes/gather.h index 58255411c3d032..9f780b822cd497 100644 --- a/src/plugins/intel_cpu/src/nodes/gather.h +++ b/src/plugins/intel_cpu/src/nodes/gather.h @@ -18,12 +18,12 @@ namespace node { class Gather : public Node { public: - Gather(const std::shared_ptr& op, const GraphContext::CPtr context); + Gather(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool isExecutable() const override; void resolveInPlaceEdges(Edge::LOOK look) override; @@ -56,7 +56,7 @@ class Gather : public Node { void execCompressed4Bit(); protected: - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool needPrepareParams() const override; void prepareParams() override; diff --git a/src/plugins/intel_cpu/src/nodes/gather_elements.cpp b/src/plugins/intel_cpu/src/nodes/gather_elements.cpp index 61dbe2f635ed4b..7a494d184ce9c1 100644 --- a/src/plugins/intel_cpu/src/nodes/gather_elements.cpp +++ b/src/plugins/intel_cpu/src/nodes/gather_elements.cpp @@ -31,7 +31,7 @@ bool GatherElements::isSupportedOperation(const std::shared_ptr& return true; } -GatherElements::GatherElements(const std::shared_ptr& op, const GraphContext::CPtr context) +GatherElements::GatherElements(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -93,7 +93,7 @@ void GatherElements::initSupportedPrimitiveDescriptors() { impl_desc_type::ref_any); } -void GatherElements::executeDynamicImpl(dnnl::stream strm) { +void GatherElements::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } @@ -130,7 +130,7 @@ void GatherElements::directExecution() { parallel_nt(0, threadBody); } -void GatherElements::execute(dnnl::stream strm) { +void GatherElements::execute(const dnnl::stream& strm) { switch (dataTypeSize_) { case sizeof(element_type_traits::value_type): return directExecution::value_type>(); diff --git a/src/plugins/intel_cpu/src/nodes/gather_elements.h b/src/plugins/intel_cpu/src/nodes/gather_elements.h index c627dfb4b364ad..bd05f624cb17cd 100644 --- a/src/plugins/intel_cpu/src/nodes/gather_elements.h +++ b/src/plugins/intel_cpu/src/nodes/gather_elements.h @@ -12,17 +12,17 @@ namespace node { class GatherElements : public Node { public: - GatherElements(const std::shared_ptr& op, const GraphContext::CPtr context); + GatherElements(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; protected: - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; void prepareParams() override; private: diff --git a/src/plugins/intel_cpu/src/nodes/gather_nd.cpp b/src/plugins/intel_cpu/src/nodes/gather_nd.cpp index dc9891eb8388eb..1124bec41632b8 100644 --- a/src/plugins/intel_cpu/src/nodes/gather_nd.cpp +++ b/src/plugins/intel_cpu/src/nodes/gather_nd.cpp @@ -35,7 +35,7 @@ bool GatherND::isSupportedOperation(const std::shared_ptr& op, s return true; } -GatherND::GatherND(const std::shared_ptr& op, const GraphContext::CPtr context) +GatherND::GatherND(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -109,26 +109,24 @@ void GatherND::prepareParams() { } GatherND::GatherNDExecutor::GatherNDExecutor(const GatherNDAttributes& attrs) - : sliceRank(attrs.sliceRank), - dataSize(attrs.dataSize) { - batchSize = std::accumulate(attrs.srcDims.begin(), + : batchSize(std::accumulate(attrs.srcDims.begin(), attrs.srcDims.begin() + attrs.batchDims, size_t(1), - std::multiplies()); - dataLength = std::accumulate(attrs.srcDims.begin() + sliceRank + attrs.batchDims, + std::multiplies())), + dataSize(attrs.dataSize), + sliceRank(attrs.sliceRank), + dataLength(std::accumulate(attrs.srcDims.begin() + sliceRank + attrs.batchDims, attrs.srcDims.end(), size_t(1), - std::multiplies()); - cycles = attrs.dstElementCount / (dataLength * batchSize); - workAmount = batchSize * cycles; - - srcBatchStride = std::accumulate(attrs.srcDims.begin() + attrs.batchDims, + std::multiplies())), + cycles(attrs.dstElementCount / (dataLength * batchSize)), + workAmount(batchSize * cycles), + srcBatchStride(std::accumulate(attrs.srcDims.begin() + attrs.batchDims, attrs.srcDims.end(), size_t(1), - std::multiplies()); - idxBatchStride = cycles * sliceRank; - dstBatchStride = cycles * dataLength; - + std::multiplies())), + idxBatchStride(cycles * sliceRank), + dstBatchStride(cycles * dataLength) { srcShifts.resize(attrs.sliceRank, 0); for (size_t i = 0; i < attrs.sliceRank; i++) srcShifts[i] = attrs.srcStrides[i + attrs.batchDims] * (dataLength > 1 ? dataSize : 1); @@ -141,7 +139,7 @@ GatherND::GatherNDExecutor::GatherNDExecutor(const GatherNDAttributes& attrs) } } -void GatherND::execute(dnnl::stream strm) { +void GatherND::execute(const dnnl::stream& strm) { if (!execPtr) THROW_ERROR("has not compiled executor."); @@ -246,7 +244,7 @@ void GatherND::GatherNDExecutor::gatherElementwise(const MemoryPtr& srcMemPtr, }); } -void GatherND::executeDynamicImpl(dnnl::stream strm) { +void GatherND::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/gather_nd.h b/src/plugins/intel_cpu/src/nodes/gather_nd.h index 73d7d704610edf..42d5be140325b0 100644 --- a/src/plugins/intel_cpu/src/nodes/gather_nd.h +++ b/src/plugins/intel_cpu/src/nodes/gather_nd.h @@ -12,17 +12,17 @@ namespace node { class GatherND : public Node { public: - GatherND(const std::shared_ptr& op, const GraphContext::CPtr context); + GatherND(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; protected: - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; void prepareParams() override; private: @@ -47,11 +47,11 @@ class GatherND : public Node { void gatherBlocks(const MemoryPtr& srcMemPtr, const MemoryPtr& idxMemPtr, const MemoryPtr& dstMemPtr); size_t batchSize = 1lu; - size_t cycles = 1lu; - size_t dataLength = 1lu; + size_t dataSize = 1lu; size_t sliceRank = 0lu; + size_t dataLength = 1lu; + size_t cycles = 1lu; size_t workAmount = 0lu; - size_t dataSize = 1lu; size_t srcBatchStride = 1lu; size_t idxBatchStride = 1lu; diff --git a/src/plugins/intel_cpu/src/nodes/gather_tree.cpp b/src/plugins/intel_cpu/src/nodes/gather_tree.cpp index da868ec9c78a34..12b0754d0fb869 100644 --- a/src/plugins/intel_cpu/src/nodes/gather_tree.cpp +++ b/src/plugins/intel_cpu/src/nodes/gather_tree.cpp @@ -29,7 +29,7 @@ bool GatherTree::isSupportedOperation(const std::shared_ptr& op, return true; } -GatherTree::GatherTree(const std::shared_ptr& op, const GraphContext::CPtr context) +GatherTree::GatherTree(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -74,7 +74,7 @@ void GatherTree::initSupportedPrimitiveDescriptors() { impl_desc_type::ref_any); } -void GatherTree::execute(dnnl::stream strm) { +void GatherTree::execute(const dnnl::stream& strm) { if (!execPtr) THROW_CPU_NODE_ERR("has not compiled executor."); @@ -117,7 +117,7 @@ void GatherTree::prepareParams() { execPtr = std::make_shared(stepIdxDims, parentIdxDims, maxSeqLenDims, dstDims); } -void GatherTree::executeDynamicImpl(dnnl::stream strm) { +void GatherTree::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/gather_tree.h b/src/plugins/intel_cpu/src/nodes/gather_tree.h index 3a9368083e3d10..c0d4547c5075d1 100644 --- a/src/plugins/intel_cpu/src/nodes/gather_tree.h +++ b/src/plugins/intel_cpu/src/nodes/gather_tree.h @@ -12,15 +12,15 @@ namespace node { class GatherTree : public Node { public: - GatherTree(const std::shared_ptr& op, const GraphContext::CPtr context); + GatherTree(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; void prepareParams() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/generate_proposals.cpp b/src/plugins/intel_cpu/src/nodes/generate_proposals.cpp index 5d73122f6a640c..64965b4e61a138 100644 --- a/src/plugins/intel_cpu/src/nodes/generate_proposals.cpp +++ b/src/plugins/intel_cpu/src/nodes/generate_proposals.cpp @@ -304,7 +304,7 @@ bool GenerateProposals::isSupportedOperation(const std::shared_ptr& op, const GraphContext::CPtr context) +GenerateProposals::GenerateProposals(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, InternalDynShapeInferFactory()) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -338,11 +338,11 @@ void GenerateProposals::initSupportedPrimitiveDescriptors() { impl_desc_type::ref_any); } -void GenerateProposals::executeDynamicImpl(dnnl::stream strm) { +void GenerateProposals::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void GenerateProposals::execute(dnnl::stream strm) { +void GenerateProposals::execute(const dnnl::stream& strm) { try { if (inputShapes.size() != 4 || outputShapes.size() != 3) { OPENVINO_THROW("Incorrect number of input or output edges!"); diff --git a/src/plugins/intel_cpu/src/nodes/generate_proposals.h b/src/plugins/intel_cpu/src/nodes/generate_proposals.h index 3f300d8a45f33c..9556be81c6d308 100644 --- a/src/plugins/intel_cpu/src/nodes/generate_proposals.h +++ b/src/plugins/intel_cpu/src/nodes/generate_proposals.h @@ -12,16 +12,16 @@ namespace node { class GenerateProposals : public Node { public: - GenerateProposals(const std::shared_ptr& op, const GraphContext::CPtr context); + GenerateProposals(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needShapeInfer() const override; bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; private: diff --git a/src/plugins/intel_cpu/src/nodes/grid_sample.cpp b/src/plugins/intel_cpu/src/nodes/grid_sample.cpp index 6f29c52ffdc4b6..0e25c64acfe534 100644 --- a/src/plugins/intel_cpu/src/nodes/grid_sample.cpp +++ b/src/plugins/intel_cpu/src/nodes/grid_sample.cpp @@ -39,7 +39,7 @@ bool GridSample::isSupportedOperation(const std::shared_ptr& op, #if defined(OPENVINO_ARCH_X86_64) -GridSample::GridSample(const std::shared_ptr& op, const GraphContext::CPtr context) +GridSample::GridSample(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -265,7 +265,7 @@ void GridSample::prepareParams() { }); } -void GridSample::execute(dnnl::stream strm) { +void GridSample::execute(const dnnl::stream& strm) { const void* srcData = getSrcDataAtPort(IN_DATA); const uint8_t* gridData = getSrcDataAtPortAs(IN_GRID); uint8_t* dstData = getDstDataAtPortAs(0); @@ -308,7 +308,7 @@ void GridSample::execute(dnnl::stream strm) { parallel_nt(m_threads_num, threadBody); } -void GridSample::executeDynamicImpl(dnnl::stream strm) { +void GridSample::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/grid_sample.hpp b/src/plugins/intel_cpu/src/nodes/grid_sample.hpp index e09507061241c1..ad8f7dea590413 100644 --- a/src/plugins/intel_cpu/src/nodes/grid_sample.hpp +++ b/src/plugins/intel_cpu/src/nodes/grid_sample.hpp @@ -14,13 +14,13 @@ namespace node { class GridSample : public Node { public: - GridSample(const std::shared_ptr& op, const GraphContext::CPtr context); + GridSample(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; struct threadExecParams { @@ -50,7 +50,7 @@ class GridSample : public Node { }; protected: - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; void prepareParams() override; private: diff --git a/src/plugins/intel_cpu/src/nodes/grn.cpp b/src/plugins/intel_cpu/src/nodes/grn.cpp index f3a22bd7f496e4..8a58ee5ef2cdcf 100644 --- a/src/plugins/intel_cpu/src/nodes/grn.cpp +++ b/src/plugins/intel_cpu/src/nodes/grn.cpp @@ -26,7 +26,7 @@ bool GRN::isSupportedOperation(const std::shared_ptr& op, std::s return true; } -GRN::GRN(const std::shared_ptr& op, const GraphContext::CPtr context) +GRN::GRN(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -86,11 +86,11 @@ void GRN::prepareParams() { W = static_cast(dataDims[3]); } -void GRN::executeDynamicImpl(dnnl::stream strm) { - execute(std::move(strm)); +void GRN::executeDynamicImpl(const dnnl::stream& strm) { + execute(strm); } -void GRN::execute(dnnl::stream strm) { +void GRN::execute(const dnnl::stream& strm) { const float* src_data = getSrcDataAtPortAs(0); float* dst_data = getDstDataAtPortAs(0); diff --git a/src/plugins/intel_cpu/src/nodes/grn.h b/src/plugins/intel_cpu/src/nodes/grn.h index 11ff05e5fb4910..02074dd8cf9188 100644 --- a/src/plugins/intel_cpu/src/nodes/grn.h +++ b/src/plugins/intel_cpu/src/nodes/grn.h @@ -12,15 +12,15 @@ namespace node { class GRN : public Node { public: - GRN(const std::shared_ptr& op, const GraphContext::CPtr context); + GRN(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; void prepareParams() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/if.cpp b/src/plugins/intel_cpu/src/nodes/if.cpp index 8cbae1e62b1731..683eb3c35a9b85 100644 --- a/src/plugins/intel_cpu/src/nodes/if.cpp +++ b/src/plugins/intel_cpu/src/nodes/if.cpp @@ -5,6 +5,7 @@ #include "if.h" #include +#include #include #include "common/cpu_memcpy.h" @@ -17,10 +18,10 @@ namespace ov { namespace intel_cpu { namespace node { -If::PortMapHelper::PortMapHelper(const MemoryPtr& from, const std::deque& to, const dnnl::engine& eng) - : srcMemPtr(from), - dstMemPtrs(to) { - size = 0; +If::PortMapHelper::PortMapHelper(MemoryPtr from, std::deque to, const dnnl::engine& eng) + : srcMemPtr(std::move(from)), + dstMemPtrs(std::move(to)), + size(0) { if (srcMemPtr->getDesc().isDefined()) size = srcMemPtr->getShape().getElementsCount(); @@ -30,7 +31,7 @@ If::PortMapHelper::PortMapHelper(const MemoryPtr& from, const std::deque& op, std::st return true; } -If::If(const std::shared_ptr& op, const GraphContext::CPtr context) +If::If(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, InternalDynShapeInferFactory()), ovOp(op) { std::string errorMessage; @@ -238,12 +239,12 @@ void If::prepareAfterMappers(const bool isThen, const dnnl::engine& eng) { std::deque If::getToMemories(const Node* node, const size_t port) const { std::deque memories; - for (auto edge : node->getChildEdgesAtPort(port)) + for (const auto& edge : node->getChildEdgesAtPort(port)) memories.push_back(edge->getMemoryPtr()); return memories; } -void If::execute(dnnl::stream strm) { +void If::execute(const dnnl::stream& strm) { const bool condition = static_cast((getSrcDataAtPortAs(0))[0]); auto& beforeMappers = condition ? beforeThenMappers : beforeElseMappers; @@ -258,7 +259,7 @@ void If::execute(dnnl::stream strm) { mapper->execute(strm); } -void If::executeDynamicImpl(dnnl::stream strm) { +void If::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/if.h b/src/plugins/intel_cpu/src/nodes/if.h index be715d88146411..829734142722e1 100644 --- a/src/plugins/intel_cpu/src/nodes/if.h +++ b/src/plugins/intel_cpu/src/nodes/if.h @@ -17,20 +17,20 @@ namespace node { class If : public Node { public: - If(const std::shared_ptr& op, const GraphContext::CPtr context); + If(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void initSupportedPrimitiveDescriptors() override; void getSupportedDescriptors() override; void createPrimitive() override; bool created() const override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool isExecutable() const override { return true; } protected: - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool needPrepareParams() const override { return false; }; @@ -51,9 +51,9 @@ class If : public Node { class PortMapHelper { public: - PortMapHelper(const MemoryPtr& from, const std::deque& to, const dnnl::engine& eng); + PortMapHelper(MemoryPtr from, std::deque to, const dnnl::engine& eng); ~PortMapHelper() = default; - void execute(dnnl::stream& strm); + void execute(const dnnl::stream& strm); private: void redefineTo(); diff --git a/src/plugins/intel_cpu/src/nodes/input.cpp b/src/plugins/intel_cpu/src/nodes/input.cpp index 595246405b4900..f812da7ca01159 100644 --- a/src/plugins/intel_cpu/src/nodes/input.cpp +++ b/src/plugins/intel_cpu/src/nodes/input.cpp @@ -220,7 +220,7 @@ jit_has_subnormals_base::fn_t jit_has_subnormals_function() { } // namespace #endif -Input::Input(const std::shared_ptr& op, const GraphContext::CPtr context) +Input::Input(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, PassThroughShapeInferFactory()) { if (!one_of(op->get_type_info(), op::v0::Parameter::get_type_info_static(), @@ -404,7 +404,7 @@ Input::Input(const Shape& shape, const ov::element::Type& prc, const std::string& name, const std::string& type, - const GraphContext::CPtr context) + const GraphContext::CPtr& context) : Node(type, createInputShapes(shape, TypeFromName(type)), createOutputShapes(shape, TypeFromName(type)), @@ -419,22 +419,26 @@ Input::Input(const Shape& shape, } } -Input::Input(MemoryDescPtr memDesc, const std::string& name, const std::string& type, const GraphContext::CPtr context) +Input::Input(const MemoryDescPtr& memDesc, + const std::string& name, + const std::string& type, + const GraphContext::CPtr& context) : Input(memDesc->getShape(), memDesc->getPrecision(), name, type, context) { - extMemDesc = memDesc; + extMemDesc = memDesc; // NOLINT(cppcoreguidelines-prefer-member-initializer) fixed in clang-tidy-18 } -Input::Input(const std::shared_ptr& op, const GraphContext::CPtr context, InputConfig config) +Input::Input(const std::shared_ptr& op, const GraphContext::CPtr& context, const InputConfig& config) : Input(op, context) { - extMemDesc = config.desc; - m_isInPlace = config.inPlace; + extMemDesc = config.desc; // NOLINT(cppcoreguidelines-prefer-member-initializer) fixed in clang-tidy-18 + m_isInPlace = config.inPlace; // NOLINT(cppcoreguidelines-prefer-member-initializer) fixed in clang-tidy-18 } -Input::Input(const std::shared_ptr& op, const GraphContext::CPtr context, OutputConfig config) +Input::Input(const std::shared_ptr& op, const GraphContext::CPtr& context, const OutputConfig& config) : Input(op, context) { - extMemDesc = config.desc; - m_useParentMemoryDescForOutput = config.useParentMemoryDescForOutput; - m_isInPlace = config.inPlace; + extMemDesc = config.desc; // NOLINT(cppcoreguidelines-prefer-member-initializer) fixed in clang-tidy-18 + m_useParentMemoryDescForOutput = // NOLINT(cppcoreguidelines-prefer-member-initializer) + config.useParentMemoryDescForOutput; + m_isInPlace = config.inPlace; // NOLINT(cppcoreguidelines-prefer-member-initializer) fixed in clang-tidy-18 } MemoryCPtr Input::getMemoryPtr() const { diff --git a/src/plugins/intel_cpu/src/nodes/input.h b/src/plugins/intel_cpu/src/nodes/input.h index c3c424b28c2c5e..d0e1814b7a6878 100644 --- a/src/plugins/intel_cpu/src/nodes/input.h +++ b/src/plugins/intel_cpu/src/nodes/input.h @@ -33,19 +33,22 @@ class Input : public Node { bool inPlace = false; }; - Input(const std::shared_ptr& op, const GraphContext::CPtr context); + Input(const std::shared_ptr& op, const GraphContext::CPtr& context); Input(const Shape& shape, const ov::element::Type& prc, const std::string& name, const std::string& type, - const GraphContext::CPtr context); + const GraphContext::CPtr& context); - Input(MemoryDescPtr memDesc, const std::string& name, const std::string& type, const GraphContext::CPtr context); + Input(const MemoryDescPtr& memDesc, + const std::string& name, + const std::string& type, + const GraphContext::CPtr& context); - Input(const std::shared_ptr& op, const GraphContext::CPtr context, InputConfig config); + Input(const std::shared_ptr& op, const GraphContext::CPtr& context, const InputConfig& config); - Input(const std::shared_ptr& op, const GraphContext::CPtr context, OutputConfig config); + Input(const std::shared_ptr& op, const GraphContext::CPtr& context, const OutputConfig& config); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; @@ -57,8 +60,8 @@ class Input : public Node { void withMeanImage(); MemoryCPtr getMemoryPtr() const; - void execute(dnnl::stream strm) override {} - void executeDynamicImpl(dnnl::stream strm) override {} + void execute(const dnnl::stream& strm) override {} + void executeDynamicImpl(const dnnl::stream& strm) override {} bool isExecutable() const override { return false; } diff --git a/src/plugins/intel_cpu/src/nodes/interaction.cpp b/src/plugins/intel_cpu/src/nodes/interaction.cpp index c674ac13cb773d..13c846da6e2bea 100644 --- a/src/plugins/intel_cpu/src/nodes/interaction.cpp +++ b/src/plugins/intel_cpu/src/nodes/interaction.cpp @@ -181,7 +181,7 @@ struct jit_move_scale_kernel : public jit_uni_move_scale_kernel, public jit_gene #endif // OPENVINO_ARCH_X86_64 -Interaction::Interaction(const std::shared_ptr& op, const GraphContext::CPtr context) +Interaction::Interaction(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -240,7 +240,7 @@ static inline void flat_triangle(const uint8_t* in, uint8_t* out, size_t size, s } } -void Interaction::execRef(dnnl::stream strm) { +void Interaction::execRef(const dnnl::stream& strm) { using namespace dnnl; uint8_t* outFeaturesPtr = getDstDataAtPortAs(0); std::vector inputPtrs(inputSizes); @@ -278,7 +278,7 @@ void Interaction::execRef(dnnl::stream strm) { } } -void Interaction::execute(dnnl::stream strm) { +void Interaction::execute(const dnnl::stream& strm) { execRef(strm); } @@ -356,7 +356,7 @@ void Interaction::prepareParams() { #endif } -void Interaction::executeDynamicImpl(dnnl::stream strm) { +void Interaction::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/interaction.h b/src/plugins/intel_cpu/src/nodes/interaction.h index 8dd446bb595180..405a59940076ba 100644 --- a/src/plugins/intel_cpu/src/nodes/interaction.h +++ b/src/plugins/intel_cpu/src/nodes/interaction.h @@ -42,20 +42,20 @@ struct jit_uni_move_scale_kernel { class Interaction : public Node { public: - Interaction(const std::shared_ptr& op, const GraphContext::CPtr context); + Interaction(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; bool isExecutable() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; void prepareParams() override; private: - void execRef(dnnl::stream strm); + void execRef(const dnnl::stream& strm); dnnl::primitive prim; size_t batchSize = 0; size_t featureSize = 0; diff --git a/src/plugins/intel_cpu/src/nodes/interpolate.cpp b/src/plugins/intel_cpu/src/nodes/interpolate.cpp index cfcf868cae8c31..b50e50ac05fabd 100644 --- a/src/plugins/intel_cpu/src/nodes/interpolate.cpp +++ b/src/plugins/intel_cpu/src/nodes/interpolate.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include "common/cpu_memcpy.h" @@ -1848,7 +1849,7 @@ namespace { */ class InterpolateShapeInferFactory : public ShapeInferFactory { public: - InterpolateShapeInferFactory(std::shared_ptr op) : m_op(op) {} + InterpolateShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override { if (auto interp4 = ov::as_type_ptr(m_op)) { const auto& attr = interp4->get_attrs(); @@ -1872,7 +1873,7 @@ class InterpolateShapeInferFactory : public ShapeInferFactory { }; } // namespace -Interpolate::Interpolate(const std::shared_ptr& op, const GraphContext::CPtr context) +Interpolate::Interpolate(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, InterpolateShapeInferFactory(op)) { std::string errorMessage; if (isSupportedOperation(op, errorMessage)) { @@ -2319,7 +2320,7 @@ bool Interpolate::needShapeInfer() const { return false; } -void Interpolate::executeDynamicImpl(dnnl::stream strm) { +void Interpolate::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); const size_t port = interpAttrs.shapeCalcMode == InterpolateShapeCalcMode::sizes ? TARGET_SHAPE_ID : get_scale_id(); @@ -2570,7 +2571,7 @@ std::vector Interpolate::getScales(const VectorDims& srcDimPad, const Vec return fullScales; } -void Interpolate::execute(dnnl::stream strm) { +void Interpolate::execute(const dnnl::stream& strm) { auto dstMemPtr = getDstMemoryAtPort(0); auto srcMemPtr = getSrcMemoryAtPort(DATA_ID); @@ -4055,15 +4056,14 @@ Interpolate::InterpolateExecutorBase::InterpolateExecutorBase(const InterpolateA : mode(interpAttrs.mode), coordTransMode(interpAttrs.coordTransMode), configured_for_layout(interpAttrs.layout), + srcDimPad5d(to5Dim(getPaddedInputShape(srcDims, interpAttrs.padBegin, interpAttrs.padEnd))), + dstDim5d(to5Dim(dstDims)), inputPrec(interpAttrs.inPrc), - outputPrec(interpAttrs.outPrc) { - srcDimPad5d = to5Dim(getPaddedInputShape(srcDims, interpAttrs.padBegin, interpAttrs.padEnd)); - dstDim5d = to5Dim(dstDims); - srcDataSize = interpAttrs.inPrc.size(); - dstDataSize = interpAttrs.outPrc.size(); - dataRank = srcDims.size(); - spatialDimSize = getSpatialDimsNum(dataRank); - + outputPrec(interpAttrs.outPrc), + srcDataSize(interpAttrs.inPrc.size()), + dstDataSize(interpAttrs.outPrc.size()), + dataRank(srcDims.size()), + spatialDimSize(getSpatialDimsNum(dataRank)) { switch (mode) { case InterpolateMode::nearest: { buildTblNN(srcDimPad5d, dstDim5d, dataScales, interpAttrs.layout, interpAttrs.nearestMode); diff --git a/src/plugins/intel_cpu/src/nodes/interpolate.h b/src/plugins/intel_cpu/src/nodes/interpolate.h index ab9b6688ac3c39..9142a2272aefd4 100644 --- a/src/plugins/intel_cpu/src/nodes/interpolate.h +++ b/src/plugins/intel_cpu/src/nodes/interpolate.h @@ -74,14 +74,14 @@ class Interpolate : public Node { static constexpr float PILLOW_BICUBIC_WINDOW_SCALE = 2.0f; public: - Interpolate(const std::shared_ptr& op, const GraphContext::CPtr context); + Interpolate(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; bool created() const override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool canBeInPlace() const override { return false; } @@ -170,8 +170,8 @@ class Interpolate : public Node { VectorDims srcDimPad5d, dstDim5d; ov::element::Type inputPrec, outputPrec; size_t srcDataSize, dstDataSize; - int spatialDimSize; size_t dataRank; + int spatialDimSize; std::vector auxTable; std::vector pillow_working_buf; size_t m_threads_num = 0lu; diff --git a/src/plugins/intel_cpu/src/nodes/inverse.cpp b/src/plugins/intel_cpu/src/nodes/inverse.cpp index 51f399a5876642..25f54cb5283847 100644 --- a/src/plugins/intel_cpu/src/nodes/inverse.cpp +++ b/src/plugins/intel_cpu/src/nodes/inverse.cpp @@ -84,11 +84,11 @@ bool Inverse::created() const { return getType() == Type::Inverse; } -void Inverse::execute(dnnl::stream strm) { +void Inverse::execute(const dnnl::stream& strm) { inverse(); } -void Inverse::executeDynamicImpl(dnnl::stream strm) { +void Inverse::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/inverse.hpp b/src/plugins/intel_cpu/src/nodes/inverse.hpp index 4add38136aecc5..0a30c46ed08916 100644 --- a/src/plugins/intel_cpu/src/nodes/inverse.hpp +++ b/src/plugins/intel_cpu/src/nodes/inverse.hpp @@ -25,8 +25,8 @@ class Inverse : public Node { void prepareParams() override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool canBeInPlace() const override { return false; } diff --git a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/brgemm_kernel.cpp b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/brgemm_kernel.cpp index 49d946b57d77ae..4185eafc8880cd 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/brgemm_kernel.cpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/brgemm_kernel.cpp @@ -19,6 +19,12 @@ using namespace dnnl::impl::cpu::aarch64::matmul; namespace ov { namespace intel_cpu { +static size_t getVlen() { + return mayiuse(sve_512) ? cpu_isa_traits::vlen + : mayiuse(sve_256) ? cpu_isa_traits::vlen + : cpu_isa_traits::vlen; +} + BrgemmKernel::BrgemmKernel(size_t M, size_t N, size_t K, @@ -29,30 +35,22 @@ BrgemmKernel::BrgemmKernel(size_t M, ov::element::Type inType, bool b_accumulate) : M(M), + M_blk(matmulOptimalM), + M_tail(M % M_blk), K(K), + K_blk(K), + K_tail(K % K_blk), N(N), + N_blk(std::max(N, getVlen() / inType.size())), + N_tail(N % N_blk), lda(lda), ldb(ldb), ldc(ldc), b_transposed(b_transposed), + kBlkStep(4 / inType.size()), + packedBSize(rnd_up(K, getVlen() / inType.size()) * rnd_up(N, N_blk) * inType.size()), inType(inType) { - // blocking M - M_blk = matmulOptimalM; - M_tail = M % M_blk; - kBlkStep = 4 / inType.size(); - size_t vlen; - vlen = mayiuse(sve_512) ? cpu_isa_traits::vlen - : mayiuse(sve_256) ? cpu_isa_traits::vlen - : cpu_isa_traits::vlen; - // blocking N - N_blk = std::max(N, vlen / inType.size()); - N_tail = N % N_blk; - - // blocking K - K_blk = K; - K_tail = K % K_blk; // copied K must be round up by vlen / inType.size(), otherwise copy B kernel may access wrong memory - packedBSize = rnd_up(K, vlen / inType.size()) * rnd_up(N, N_blk) * inType.size(); size_t brg0BaseIdx = std::numeric_limits::max(); for (size_t m = 0; m < 2; m++) { for (size_t k = 0; k < 2; k++) { @@ -330,4 +328,4 @@ void BrgemmKernel::callBrgemm(brgemmCtx& ctx, } } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.cpp b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.cpp index c64ba45cdd93f6..66db416ec7c732 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.cpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.cpp @@ -4,6 +4,8 @@ #include "jit_uni_eltwise_generic.hpp" +#include + namespace ov { namespace intel_cpu { namespace aarch64 { @@ -19,15 +21,15 @@ void jit_uni_eltwise_kernel::operator()(const node::jit_eltwise_call_args_ptrs* } template -jit_uni_eltwise_generic::jit_uni_eltwise_generic(const jit_eltwise_params& jep, - const std::vector& eltwise_data, - const std::vector& ops_list, - const dnnl::post_ops& post_ops) - : jit_uni_eltwise_kernel(jep), +jit_uni_eltwise_generic::jit_uni_eltwise_generic(jit_eltwise_params jep, + std::vector eltwise_data, + std::vector ops_list, + dnnl::post_ops post_ops) + : jit_uni_eltwise_kernel(std::move(jep)), jit_generator(), - eltwise_data_(eltwise_data), - ops_list_(ops_list), - post_ops_(post_ops) {} + eltwise_data_(std::move(eltwise_data)), + ops_list_(std::move(ops_list)), + post_ops_(std::move(post_ops)) {} template void jit_uni_eltwise_generic::generate() { diff --git a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.hpp b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.hpp index c4fb7608d521de..107495a693431b 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.hpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/jit_uni_eltwise_generic.hpp @@ -7,6 +7,7 @@ #include #include +#include #include #include "nodes/executors/eltwise.hpp" @@ -70,7 +71,7 @@ struct jit_uni_eltwise_kernel { void operator()(const node::jit_eltwise_call_args_ptrs* const_args, const jit_eltwise_call_args_indexes* indexes); jit_uni_eltwise_kernel() {} - jit_uni_eltwise_kernel(const jit_eltwise_params& jep) : ker_(nullptr), jep_(jep) {} + jit_uni_eltwise_kernel(jit_eltwise_params jep) : ker_(nullptr), jep_(std::move(jep)) {} virtual ~jit_uni_eltwise_kernel() {} virtual void create_ker() = 0; @@ -83,10 +84,10 @@ struct jit_uni_eltwise_generic : public jit_uni_eltwise_kernel, jit_generator { public: DECLARE_CPU_JIT_AUX_FUNCTIONS(jit_uni_eltwise_generic) - jit_uni_eltwise_generic(const jit_eltwise_params& jep, - const std::vector& eltwise_data, - const std::vector& ops_list, - const dnnl::post_ops& post_ops); + jit_uni_eltwise_generic(jit_eltwise_params jep, + std::vector eltwise_data, + std::vector ops_list, + dnnl::post_ops post_ops); jit_uni_eltwise_generic() {} diff --git a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp index 8197f5e648481c..67cf6137bb8b45 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/softmax_kernel.hpp @@ -4,6 +4,8 @@ #pragma once #include +#include +#include #include #include #include @@ -750,7 +752,7 @@ inline void exp_reduce_sum(float* a, const float max, const size_t size, float& # endif #endif for (; i < size; i++) { - a[i] = exp(a[i] - max); + a[i] = std::exp(a[i] - max); sum += a[i]; } } diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/brgemm_kernel.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/brgemm_kernel.cpp index 786884c3805989..5defe98c55aad8 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/x64/brgemm_kernel.cpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/brgemm_kernel.cpp @@ -28,6 +28,8 @@ BrgemmKernel::BrgemmKernel(size_t M, ov::element::Type inType, bool b_accumulate) : M(M), + M_blk(matmulOptimalM), + M_tail(M % M_blk), K(K), N(N), lda(lda), @@ -36,10 +38,6 @@ BrgemmKernel::BrgemmKernel(size_t M, b_transposed(b_transposed), inType(inType), b_accumulate(b_accumulate) { - // blocking M - M_blk = matmulOptimalM; - M_tail = M % M_blk; - if (!one_of(inType, ov::element::bf16, ov::element::f16, ov::element::f32)) THROW_ERROR("brgemm kernel only supports f16, bf16, f32"); bool is_f32 = inType == ov::element::f32; diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.cpp index c0de6520b7099c..5606d3902c6526 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.cpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.cpp @@ -55,11 +55,8 @@ const unsigned jitGatherKernelBase::incVec[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, template jitUniGatherKernel::jitUniGatherKernel(const jGatherConfParams& jcp) - : jitGatherKernelBase(jcp), + : jitGatherKernelBase(jcp, x64::cpu_isa_traits::vlen, indicesTypeSize), x64::jit_generator(jit_name()) { - vlen = x64::cpu_isa_traits::vlen; - dataElPerVec = vlen / jcp.dataTypeSize; - idxElPerVec = vlen / indicesTypeSize; if (jcp.dataTypeSize == 2) dataTypeShift = 1; else if (jcp.dataTypeSize == 4) diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.hpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.hpp index de8cda30d06499..d9a260aabeae93 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.hpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.hpp @@ -75,7 +75,12 @@ struct jitGatherKernelBase { assert(ker_); ker_(args); } - explicit jitGatherKernelBase(const jGatherConfParams& jcp) : ker_(nullptr), jcp(jcp) {} + explicit jitGatherKernelBase(const jGatherConfParams& jcp, uint64_t vlen, uint64_t indicesTypeSize) + : ker_(nullptr), + jcp(jcp), + vlen(vlen), + dataElPerVec(vlen / jcp.dataTypeSize), + idxElPerVec(vlen / indicesTypeSize) {} virtual ~jitGatherKernelBase() {} virtual void create_ker() = 0; diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.cpp index 0a2073ec3dd72e..dd135fb3b7aabc 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.cpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.cpp @@ -14,12 +14,7 @@ namespace kernel { template GridSampleKernel::GridSampleKernel(const GridSampleKernelConfParams& jcp) - : GridSampleKernelBase(jit_name(), jcp, isa) { - vlen = x64::cpu_isa_traits::vlen; - dataTypeSize = jcp.inDataPrc.size(); - gridTypeSize = jcp.gridPrc.size(); - dataElPerVec = vlen / dataTypeSize; - gridElPerVec = vlen / gridTypeSize; + : GridSampleKernelBase(jit_name(), jcp, isa, x64::cpu_isa_traits::vlen) { if (dataTypeSize == 2) dataTypeShift = 1; else if (dataTypeSize == 4) diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.hpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.hpp index 31c14aac6364bf..9513681341d587 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.hpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.hpp @@ -72,10 +72,16 @@ class GridSampleKernelBase : public JitKernelBase { } explicit GridSampleKernelBase(const char* name, const GridSampleKernelConfParams& jcp, - dnnl::impl::cpu::x64::cpu_isa_t isa) + dnnl::impl::cpu::x64::cpu_isa_t isa, + uint64_t vlen) : JitKernelBase(name, isa), ker_(nullptr), - jcp(jcp) {} + jcp(jcp), + vlen(vlen), + dataTypeSize(jcp.inDataPrc.size()), + gridTypeSize(jcp.gridPrc.size()), + dataElPerVec(vlen / dataTypeSize), + gridElPerVec(vlen / gridTypeSize) {} virtual void create_ker() = 0; uint64_t getVecLen() { diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.cpp index a967bb2c1de944..8c35b15500fee9 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.cpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.cpp @@ -259,7 +259,10 @@ stack_frame::stack_frame(ov::intel_cpu::jit_kernel& kernel, size_t size, uint32_ } } -stack_frame::stack_frame(stack_frame&& rhs) : _kernel(rhs._kernel), _size(rhs._size), _alignment(rhs._alignment) { +stack_frame::stack_frame(stack_frame&& rhs) noexcept + : _kernel(rhs._kernel), + _size(rhs._size), + _alignment(rhs._alignment) { rhs._size = 0; rhs._alignment = 0; } diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.hpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.hpp index fbfe98be8d6aae..c170086af70bb7 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.hpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.hpp @@ -229,7 +229,7 @@ class variable_base { variable_base& operator=(const variable_base&) = delete; variable_base(const variable_base&); - variable_base(variable_base&&); + variable_base(variable_base&&) noexcept; reg_type& reg() const { return *_reg; @@ -263,7 +263,7 @@ class variable_base { variable_base& operator=(const variable_base&) = delete; variable_base(const variable_base&); - variable_base(variable_base&&); + variable_base(variable_base&&) noexcept; reg_type& reg() const { return *_addr; @@ -286,7 +286,7 @@ class variable using reg_type = const typename base::reg_type; using arithmetic_type = typename std::conditional::value, size_t, T>::type; - variable(variable&&) = default; + variable(variable&&) noexcept = default; variable(jit_kernel& krnl); variable(jit_kernel& krnl, const shared_reg& reg); @@ -491,7 +491,7 @@ class variable : public variable_base { using base = variable_base; using reg_type = const typename base::reg_type; - variable(variable&&) = default; + variable(variable&&) noexcept = default; variable(jit_kernel& krnl, const shared_reg& reg); const variable& operator=(const variable& rhs) const; @@ -505,7 +505,7 @@ class variable : public variable_base { using reg_type = const typename base::reg_type; constexpr static size_t length = N; - variable(variable&&) = default; + variable(variable&&) noexcept = default; variable(jit_kernel& krnl); variable(jit_kernel& krnl, const shared_reg& reg); @@ -546,7 +546,7 @@ class stack_frame { public: stack_frame(jit_kernel& kernel, size_t size, uint32_t alignment = 1); - stack_frame(stack_frame&& rhs); + stack_frame(stack_frame&& rhs) noexcept; ~stack_frame(); const Xbyak::Reg64& pointer() const; void clear() const; @@ -951,8 +951,9 @@ variable_base::variable_base(const variable_base& rhs) : _kerne _reg(rhs._reg) {} template -variable_base::variable_base(variable_base&& rhs) : _kernel(rhs._kernel), - _reg(std::move(rhs._reg)) {} +variable_base::variable_base(variable_base&& rhs) noexcept + : _kernel(rhs._kernel), + _reg(std::move(rhs._reg)) {} template variable_base::variable_base(jit_kernel& krnl, const shared_reg& addr) @@ -964,8 +965,9 @@ variable_base::variable_base(const variable_base& rhs) : _kernel( _addr(rhs._addr) {} template -variable_base::variable_base(variable_base&& rhs) : _kernel(rhs._kernel), - _addr(std::move(rhs._addr)) {} +variable_base::variable_base(variable_base&& rhs) noexcept + : _kernel(rhs._kernel), + _addr(std::move(rhs._addr)) {} template variable::variable(jit_kernel& krnl) diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.cpp index 5e3db6e23493ff..c7a49ffd0feedf 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.cpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.cpp @@ -10,9 +10,10 @@ namespace ov { namespace intel_cpu { namespace kernel { -JitKernelBase::JitKernelBase(const char* name, x64::cpu_isa_t isa) : x64::jit_generator(name, isa), m_isa(isa) { - vlen = x64::isa_max_vlen(isa); -} +JitKernelBase::JitKernelBase(const char* name, x64::cpu_isa_t isa) + : x64::jit_generator(name, isa), + m_isa(isa), + vlen(x64::isa_max_vlen(isa)) {} void JitKernelBase::uni_vfmsub132ps(const Xbyak::Xmm& v_dst, const Xbyak::Xmm& v_src, const Xbyak::Operand& op) { if (isValidIsa(x64::avx2)) { diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_kernel.hpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_kernel.hpp index 768d2e2dc3d7f4..cc908dd82b6295 100644 --- a/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_kernel.hpp +++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_kernel.hpp @@ -422,7 +422,7 @@ struct ScratchBuffAllocator { ScratchBuffAllocator() = default; // register size / allocate totally size / inform consumers - void register_allocation(size_t size, CallBack cb) { + void register_allocation(size_t size, const CallBack& cb) { m_allocs.push_back(cb); m_total_size += size; m_sizes.push_back(size); diff --git a/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp b/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp index 81acbb7a7787e7..b4e7a00c74f8fc 100644 --- a/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp +++ b/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp @@ -5,6 +5,7 @@ #include "llm_mlp.h" #include +#include #include #include "common/bfloat16.hpp" @@ -339,13 +340,12 @@ struct LLMMLP::Executor : public LLMMLP::ExecutorBase { Executor(LLMMLP* pnode, const LLMMLPNode::Config& config, DnnlScratchPadPtr scrachPad) : m_pnode(pnode), m_config(config), - m_scrachPad(scrachPad) { + m_scrachPad(std::move(scrachPad)), + m_rt_prec_f16(std::is_same::value) { PlainTensor w_gate(pnode->getSrcMemoryAtPort(1)); PlainTensor w_up(pnode->getSrcMemoryAtPort(2)); PlainTensor w_down(pnode->getSrcMemoryAtPort(3)); - m_rt_prec_f16 = std::is_same::value; - // [N, K] [N, K] interleave (16-16-...) into [2*N, K] auto K = w_gate.size(1); auto N = w_gate.size(0); @@ -491,12 +491,12 @@ struct LLMMLP::Executor : public LLMMLP::ExecutorBase { #else template struct LLMMLP::Executor : public LLMMLP::ExecutorBase { - Executor(LLMMLP* pnode, const LLMMLPNode::Config& config, DnnlScratchPadPtr scrachPad) {} + Executor(LLMMLP*, const LLMMLPNode::Config&, const DnnlScratchPadPtr&) {} void execute() {} }; #endif -LLMMLP::LLMMLP(const std::shared_ptr& op, const GraphContext::CPtr context) +LLMMLP::LLMMLP(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; const auto& config = context->getConfig(); @@ -589,7 +589,7 @@ void LLMMLP::createPrimitive() { } } -void LLMMLP::execute(dnnl::stream strm) { +void LLMMLP::execute(const dnnl::stream& strm) { MAYBE_UNUSED(strm); m_executor->execute(); } diff --git a/src/plugins/intel_cpu/src/nodes/llm_mlp.h b/src/plugins/intel_cpu/src/nodes/llm_mlp.h index 81d87dc2f7e2d3..0328e99571a28a 100644 --- a/src/plugins/intel_cpu/src/nodes/llm_mlp.h +++ b/src/plugins/intel_cpu/src/nodes/llm_mlp.h @@ -14,7 +14,7 @@ namespace node { class LLMMLP : public Node { public: - LLMMLP(const std::shared_ptr& op, const GraphContext::CPtr context); + LLMMLP(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override {} bool created() const override { @@ -24,11 +24,11 @@ class LLMMLP : public Node { return false; } void createPrimitive() override; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage, uint64_t fcDynamicQuantizationGroupSize = 0) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/log_softmax.cpp b/src/plugins/intel_cpu/src/nodes/log_softmax.cpp index 172f4fd3ebe87a..05981f170298d9 100644 --- a/src/plugins/intel_cpu/src/nodes/log_softmax.cpp +++ b/src/plugins/intel_cpu/src/nodes/log_softmax.cpp @@ -26,7 +26,7 @@ bool LogSoftmax::isSupportedOperation(const std::shared_ptr& op, return true; } -LogSoftmax::LogSoftmax(const std::shared_ptr& op, const GraphContext::CPtr context) +LogSoftmax::LogSoftmax(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -83,11 +83,11 @@ void LogSoftmax::prepareParams() { reducedAxisStride *= dims[i]; } -void LogSoftmax::executeDynamicImpl(dnnl::stream strm) { +void LogSoftmax::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void LogSoftmax::execute(dnnl::stream strm) { +void LogSoftmax::execute(const dnnl::stream& strm) { const float* srcData = getSrcDataAtPortAs(0); float* dstData = getDstDataAtPortAs(0); diff --git a/src/plugins/intel_cpu/src/nodes/log_softmax.h b/src/plugins/intel_cpu/src/nodes/log_softmax.h index e2f64e52449681..395464f41069ac 100644 --- a/src/plugins/intel_cpu/src/nodes/log_softmax.h +++ b/src/plugins/intel_cpu/src/nodes/log_softmax.h @@ -12,15 +12,15 @@ namespace node { class LogSoftmax : public Node { public: - LogSoftmax(const std::shared_ptr& op, const GraphContext::CPtr context); + LogSoftmax(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; void prepareParams() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/lora.cpp b/src/plugins/intel_cpu/src/nodes/lora.cpp index c59a3a7fa37578..c252142d461b08 100644 --- a/src/plugins/intel_cpu/src/nodes/lora.cpp +++ b/src/plugins/intel_cpu/src/nodes/lora.cpp @@ -106,11 +106,11 @@ void LoRA::createPrimitive() { m_graph.Activate(inputMemory, outputMemory); } -void LoRA::execute(dnnl::stream) { +void LoRA::execute(const dnnl::stream&) { m_graph.Infer(); } -void LoRA::executeDynamicImpl(dnnl::stream strm) { +void LoRA::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/lora.h b/src/plugins/intel_cpu/src/nodes/lora.h index b2b5757db4acb8..3c993c20e3f91d 100644 --- a/src/plugins/intel_cpu/src/nodes/lora.h +++ b/src/plugins/intel_cpu/src/nodes/lora.h @@ -25,8 +25,8 @@ class LoRA : public Node { void selectOptimalPrimitiveDescriptor() override; void createPrimitive() override; void prepareParams() override; - void execute(dnnl::stream) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream&) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: std::shared_ptr m_body; diff --git a/src/plugins/intel_cpu/src/nodes/lrn.cpp b/src/plugins/intel_cpu/src/nodes/lrn.cpp index b913e831ddabe4..95c14667964135 100644 --- a/src/plugins/intel_cpu/src/nodes/lrn.cpp +++ b/src/plugins/intel_cpu/src/nodes/lrn.cpp @@ -109,7 +109,7 @@ bool Lrn::isSupportedOperation(const std::shared_ptr& op, std::s return true; } -Lrn::Lrn(const std::shared_ptr& op, const GraphContext::CPtr context) +Lrn::Lrn(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, PassThroughShapeInferFactory()) { std::string errorMessage; if (isSupportedOperation(op, errorMessage)) { @@ -240,7 +240,7 @@ void Lrn::createDescriptor(const std::vector& inputDesc, const st descs.push_back(desc); } -void Lrn::execute(dnnl::stream strm) { +void Lrn::execute(const dnnl::stream& strm) { if (execPtr) { execPtr->exec(primArgs, strm); } else { @@ -248,7 +248,7 @@ void Lrn::execute(dnnl::stream strm) { } } -void Lrn::executeDynamicImpl(dnnl::stream strm) { +void Lrn::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/lrn.h b/src/plugins/intel_cpu/src/nodes/lrn.h index bb87e797538045..b74a63745b5b25 100644 --- a/src/plugins/intel_cpu/src/nodes/lrn.h +++ b/src/plugins/intel_cpu/src/nodes/lrn.h @@ -13,7 +13,7 @@ namespace node { class Lrn : public Node { public: - Lrn(const std::shared_ptr& op, const GraphContext::CPtr context); + Lrn(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void createDescriptor(const std::vector& inputDesc, @@ -28,8 +28,8 @@ class Lrn : public Node { } void prepareParams() override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/mathematics.cpp b/src/plugins/intel_cpu/src/nodes/mathematics.cpp index 06b4ef8d3a672a..ebb16097e6d15f 100644 --- a/src/plugins/intel_cpu/src/nodes/mathematics.cpp +++ b/src/plugins/intel_cpu/src/nodes/mathematics.cpp @@ -39,7 +39,7 @@ bool Math::isSupportedOperation(const std::shared_ptr& op, std:: return true; } -Math::Math(const std::shared_ptr& op, const GraphContext::CPtr context) +Math::Math(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, PassThroughShapeInferFactory()), alpha(0.f), beta(0.f), @@ -64,11 +64,11 @@ void Math::initSupportedPrimitiveDescriptors() { addSupportedPrimDesc(inDataConf, {{LayoutType::ncsp, ov::element::f32}}, impl_desc_type::ref_any); } -void Math::executeDynamicImpl(dnnl::stream strm) { +void Math::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void Math::execute(dnnl::stream strm) { +void Math::execute(const dnnl::stream& strm) { size_t dataSize = getChildEdgeAt(0)->getMemory().getShape().getElementsCount(); const float* src_data = getSrcDataAtPortAs(0); float* dst_data = getDstDataAtPortAs(0); @@ -151,7 +151,7 @@ void Math::execute(dnnl::stream strm) { gamma = (gamma == 0.0f) ? 1.0507f : gamma; parallel_for(dataSize, [&](size_t i) { float x = src_data[i]; - dst_data[i] = (x > 0.0f) ? (gamma * x) : (gamma * alpha * (exp(x) - 1.0f)); + dst_data[i] = (x > 0.0f) ? (gamma * x) : (gamma * alpha * (std::exp(x) - 1.0f)); }); break; case Algorithm::MathSign: diff --git a/src/plugins/intel_cpu/src/nodes/mathematics.h b/src/plugins/intel_cpu/src/nodes/mathematics.h index 4849bceab4eaa6..0ba80685a9acc1 100644 --- a/src/plugins/intel_cpu/src/nodes/mathematics.h +++ b/src/plugins/intel_cpu/src/nodes/mathematics.h @@ -12,17 +12,17 @@ namespace node { class Math : public Node { public: - Math(const std::shared_ptr& op, const GraphContext::CPtr context); + Math(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override { return false; }; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/matmul.cpp b/src/plugins/intel_cpu/src/nodes/matmul.cpp index a9020ea8798243..20c5dcf1040e71 100644 --- a/src/plugins/intel_cpu/src/nodes/matmul.cpp +++ b/src/plugins/intel_cpu/src/nodes/matmul.cpp @@ -112,7 +112,7 @@ bool MatMul::isSupportedOperation(const std::shared_ptr& op, std return true; } -MatMul::MatMul(const std::shared_ptr& op, const GraphContext::CPtr context) +MatMul::MatMul(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, MMShapeInferFactory(op)), withBiases(false) { std::string errorMessage; @@ -255,7 +255,7 @@ static VectorDims getStridesAndModifyShape(Shape& shape, const bool transpose) { return strides; } -dnnl::memory::desc MatMul::getBiasDescFrom(const DnnlMemoryDescCPtr outMemDesc) { +dnnl::memory::desc MatMul::getBiasDescFrom(const DnnlMemoryDescCPtr& outMemDesc) { // oneDNN matmul requires shape for bias desc to be the same rank VectorDims biasDims(outMemDesc->getShape().getRank(), 1); const auto outDims = outMemDesc->getShape().getStaticDims(); @@ -684,7 +684,7 @@ void MatMul::prepareParams() { #endif } -void MatMul::execute(dnnl::stream strm) { +void MatMul::execute(const dnnl::stream& strm) { if (execPtr) { execPtr->exec(primArgs, strm); } else if (hasEmptyInputTensors()) { @@ -695,7 +695,7 @@ void MatMul::execute(dnnl::stream strm) { } } -void MatMul::executeDynamicImpl(dnnl::stream strm) { +void MatMul::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/matmul.h b/src/plugins/intel_cpu/src/nodes/matmul.h index aea709970e2839..d1cff0ca8bcd2a 100644 --- a/src/plugins/intel_cpu/src/nodes/matmul.h +++ b/src/plugins/intel_cpu/src/nodes/matmul.h @@ -16,7 +16,7 @@ namespace node { class MatMul : public Node { public: - MatMul(const std::shared_ptr& op, const GraphContext::CPtr context); + MatMul(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void createDescriptor(const std::vector& inputDesc, @@ -36,8 +36,8 @@ class MatMul : public Node { } void prepareParams() override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; const std::vector& getDefaultImplPriority() override; @@ -52,7 +52,7 @@ class MatMul : public Node { private: using executorPtr = std::shared_ptr; executorPtr execPtr = nullptr; - dnnl::memory::desc getBiasDescFrom(const DnnlMemoryDescCPtr outMemDesc); + dnnl::memory::desc getBiasDescFrom(const DnnlMemoryDescCPtr& outMemDesc); std::pair makeDummyInputShapes(const Shape& in0, const Shape& in1, const Shape& out) const; bool withBiases; diff --git a/src/plugins/intel_cpu/src/nodes/matrix_nms.cpp b/src/plugins/intel_cpu/src/nodes/matrix_nms.cpp index 2f9758fbc1b242..da8ed5cf60c3a3 100644 --- a/src/plugins/intel_cpu/src/nodes/matrix_nms.cpp +++ b/src/plugins/intel_cpu/src/nodes/matrix_nms.cpp @@ -47,7 +47,7 @@ bool MatrixNms::isSupportedOperation(const std::shared_ptr& op, return true; } -MatrixNms::MatrixNms(const std::shared_ptr& op, const GraphContext::CPtr context) +MatrixNms::MatrixNms(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, InternalDynShapeInferFactory()) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -305,7 +305,7 @@ bool MatrixNms::isExecutable() const { return isDynamicNode() || Node::isExecutable(); } -void MatrixNms::executeDynamicImpl(dnnl::stream strm) { +void MatrixNms::executeDynamicImpl(const dnnl::stream& strm) { if (hasEmptyInputTensors()) { redefineOutputMemory({{0, 6}, {0, 1}, {0}}); return; @@ -313,7 +313,7 @@ void MatrixNms::executeDynamicImpl(dnnl::stream strm) { execute(strm); } -void MatrixNms::execute(dnnl::stream strm) { +void MatrixNms::execute(const dnnl::stream& strm) { const float* boxes = getSrcDataAtPortAs(NMS_BOXES); const float* scores = getSrcDataAtPortAs(NMS_SCORES); @@ -444,9 +444,9 @@ void MatrixNms::execute(dnnl::stream strm) { } void MatrixNms::checkPrecision(const ov::element::Type prec, - const std::vector precList, - const std::string name, - const std::string type) { + const std::vector& precList, + const std::string& name, + const std::string& type) { if (std::find(precList.begin(), precList.end(), prec) == precList.end()) THROW_CPU_NODE_ERR("has unsupported '", name, "' ", type, " precision: ", prec); } diff --git a/src/plugins/intel_cpu/src/nodes/matrix_nms.h b/src/plugins/intel_cpu/src/nodes/matrix_nms.h index ad872dc3eeba2d..4071cd81d18ae4 100644 --- a/src/plugins/intel_cpu/src/nodes/matrix_nms.h +++ b/src/plugins/intel_cpu/src/nodes/matrix_nms.h @@ -20,17 +20,17 @@ enum MatrixNmsDecayFunction { GAUSSIAN, LINEAR }; class MatrixNms : public Node { public: - MatrixNms(const std::shared_ptr& op, const GraphContext::CPtr context); + MatrixNms(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; bool isExecutable() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool needShapeInfer() const override { return false; @@ -105,9 +105,9 @@ class MatrixNms : public Node { size_t m_realNumBoxes = 0; float (*m_decay_fn)(float, float, float) = nullptr; void checkPrecision(const ov::element::Type prec, - const std::vector precList, - const std::string name, - const std::string type); + const std::vector& precList, + const std::string& name, + const std::string& type); size_t nmsMatrix(const float* boxesData, const float* scoresData, diff --git a/src/plugins/intel_cpu/src/nodes/memory.cpp b/src/plugins/intel_cpu/src/nodes/memory.cpp index d7ce7f6515c2f8..8b29ac8cbfbadb 100644 --- a/src/plugins/intel_cpu/src/nodes/memory.cpp +++ b/src/plugins/intel_cpu/src/nodes/memory.cpp @@ -5,6 +5,7 @@ #include "memory.hpp" #include +#include #include "common/arbitrary_order_desc_creator.h" #include "dnnl_extension_utils.h" @@ -50,9 +51,9 @@ class MemoryStub : public IMemory { }; public: - MemoryStub(const dnnl::engine& eng, const MemoryDescPtr& pMemDesc) - : m_eng(eng), - m_pMemDesc(pMemDesc), + MemoryStub(dnnl::engine eng, MemoryDescPtr pMemDesc) + : m_eng(std::move(eng)), + m_pMemDesc(std::move(pMemDesc)), m_pMemoryBlock(std::make_shared()) {} const MemoryDesc& getDesc() const override { @@ -121,7 +122,7 @@ bool MemoryOutputBase::isSupportedOperation(const std::shared_ptr& op, const GraphContext::CPtr context) +MemoryOutputBase::MemoryOutputBase(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)), MemoryNode(op) { std::string errorMessage; @@ -133,12 +134,12 @@ MemoryOutputBase::MemoryOutputBase(const std::shared_ptr& op, const Gr } } -MemoryOutputBase::MemoryOutputBase(const std::string id, +MemoryOutputBase::MemoryOutputBase(const std::string& id, const std::string& name, const std::string& type, const Shape& input_shape, const ov::element::Type& input_prc, - const GraphContext::CPtr context) + const GraphContext::CPtr& context) : Node(type, {input_shape}, {}, {input_prc}, {}, name, context), MemoryNode(id) { isDynamic = input_shape.isDynamic(); @@ -217,17 +218,17 @@ void MemoryOutputBase::initOptimalPrimitiveDescriptor() { selected_pd->setConfig(config); } -void MemoryOutputBase::execute(dnnl::stream strm) { +void MemoryOutputBase::execute(const dnnl::stream& strm) { runStatic(strm); state->commit(); } -void MemoryOutputBase::executeDynamicImpl(dnnl::stream strm) { +void MemoryOutputBase::executeDynamicImpl(const dnnl::stream& strm) { runDynamic(strm); state->commit(); } -void MemoryOutputBase::assignState(MemStatePtr newState) { +void MemoryOutputBase::assignState(const MemStatePtr& newState) { OPENVINO_ASSERT(newState, "MemoryOutput ", getName(), " got null state"); state = newState; assignExtMemory(state->output_mem(), state->internal_desc()); @@ -388,7 +389,7 @@ bool MemoryInputBase::isSupportedOperation(const std::shared_ptr return true; } -MemoryInputBase::MemoryInputBase(const std::shared_ptr& op, const GraphContext::CPtr ctx) +MemoryInputBase::MemoryInputBase(const std::shared_ptr& op, const GraphContext::CPtr& ctx) : Input(op, ctx), MemoryStateNode(op) { std::string errorMessage; @@ -401,12 +402,12 @@ MemoryInputBase::MemoryInputBase(const std::shared_ptr& op, const Grap executeHook = &MemoryInputBase::assignState; } -MemoryInputBase::MemoryInputBase(const std::string id, +MemoryInputBase::MemoryInputBase(const std::string& id, const std::string& name, const std::string& type, const Shape& output_shape, const ov::element::Type& output_prc, - const GraphContext::CPtr context, + const GraphContext::CPtr& context, const ov::optional>& input_shape, const ov::optional>& input_prc, MemoryInputBase::mode mode) @@ -415,7 +416,7 @@ MemoryInputBase::MemoryInputBase(const std::string id, outputShapes.emplace_back(output_shape); addOriginalOutputPrecision(output_prc); if (input_shape) { - for (auto inp_shape : *input_shape) { + for (const auto& inp_shape : *input_shape) { inputShapes.push_back(inp_shape); isDynamic = isDynamic || inp_shape.isDynamic(); } @@ -553,13 +554,13 @@ void MemoryInputBase::assignState(MemStatePtr newState) { assignStateHook(); } -void MemoryInputBase::execute(dnnl::stream strm) { +void MemoryInputBase::execute(const dnnl::stream& strm) { assert(executeHook && "executeHook is not initialized!"); (this->*executeHook)(); runStatic(strm); } -void MemoryInputBase::executeDynamicImpl(dnnl::stream strm) { +void MemoryInputBase::executeDynamicImpl(const dnnl::stream& strm) { assert(executeHook && "executeHook is not initialized!"); (this->*executeHook)(); runDynamic(strm); @@ -574,7 +575,7 @@ void MemoryInputBase::bypassAssignState() { return; } -MemoryInput::MemoryInput(const std::shared_ptr& op, const GraphContext::CPtr ctx) +MemoryInput::MemoryInput(const std::shared_ptr& op, const GraphContext::CPtr& ctx) : MemoryInputBase::MemoryInputBase(op, ctx) { auto rvWithSubgraph = ov::as_type_ptr(op); if (rvWithSubgraph) { @@ -586,27 +587,18 @@ MemoryInput::MemoryInput(const std::shared_ptr& op, const GraphContext } } -MemoryInput::MemoryInput(const std::string id, +MemoryInput::MemoryInput(const std::string& id, const std::string& name, const std::string& type, const Shape& output_shape, const ov::element::Type& output_prc, - const GraphContext::CPtr context, + const GraphContext::CPtr& context, const ov::optional>& input_shape, const ov::optional>& input_prc, std::shared_ptr func, mode mode) - : MemoryInputBase::MemoryInputBase(id, - name, - type, - output_shape, - output_prc, - context, - input_shape, - input_prc, - mode) { - body = func; - + : MemoryInputBase::MemoryInputBase(id, name, type, output_shape, output_prc, context, input_shape, input_prc, mode), + body(std::move(func)) { if (haveSubgraph()) { subGraph = make_unique(); if (isDynamic) { @@ -904,12 +896,12 @@ bool MemoryInput::isSupportedOperation(const std::shared_ptr& op return MemoryInputBase::isSupportedOperation(op, errorMessage); } -MemoryInputSDPA::MemoryInputSDPA(const std::string id, +MemoryInputSDPA::MemoryInputSDPA(const std::string& id, const std::string& name, const std::string& type, const Shape& output_shape, const ov::element::Type& output_prc, - const GraphContext::CPtr context, + const GraphContext::CPtr& context, const ov::optional>& input_shape, const ov::optional>& input_prc, const std::shared_ptr& sdpaNode) @@ -1010,12 +1002,12 @@ void MemoryInputSDPA::resolveInPlaceEdges(Edge::LOOK look) { } } -MemoryInputSingle::MemoryInputSingle(const std::string id, +MemoryInputSingle::MemoryInputSingle(const std::string& id, const std::string& name, const std::string& type, const Shape& output_shape, const ov::element::Type& output_prc, - const GraphContext::CPtr context, + const GraphContext::CPtr& context, const ov::optional>& input_shape, const ov::optional>& input_prc, std::shared_ptr func) @@ -1027,7 +1019,7 @@ MemoryInputSingle::MemoryInputSingle(const std::string id, context, input_shape, input_prc, - func, + std::move(func), MemoryInputBase::mode::single_read_value) {} MemStatePtr MemoryInputSingle::makeState() const { diff --git a/src/plugins/intel_cpu/src/nodes/memory.hpp b/src/plugins/intel_cpu/src/nodes/memory.hpp index 678c391fcc7cad..604d0d2c80bad2 100644 --- a/src/plugins/intel_cpu/src/nodes/memory.hpp +++ b/src/plugins/intel_cpu/src/nodes/memory.hpp @@ -46,13 +46,13 @@ class MemoryStatesRegister { class MemoryOutputBase : public Node, public MemoryNode { public: - MemoryOutputBase(const std::shared_ptr& op, const GraphContext::CPtr context); - MemoryOutputBase(const std::string id, + MemoryOutputBase(const std::shared_ptr& op, const GraphContext::CPtr& context); + MemoryOutputBase(const std::string& id, const std::string& name, const std::string& type, const Shape& input_shape, const ov::element::Type& input_prc, - const GraphContext::CPtr context); + const GraphContext::CPtr& context); ~MemoryOutputBase() override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; @@ -64,9 +64,9 @@ class MemoryOutputBase : public Node, public MemoryNode { return getType() == Type::MemoryOutput; } - void execute(dnnl::stream strm) override final; // NOLINT - void executeDynamicImpl(dnnl::stream strm) override final; // NOLINT - bool isExecutable() const override final; // NOLINT + void execute(const dnnl::stream& strm) override final; // NOLINT + void executeDynamicImpl(const dnnl::stream& strm) override final; // NOLINT + bool isExecutable() const override final; // NOLINT void registerInputNode(MemoryInputBase* node); void deregisterSibling(MemoryInputBase* node); @@ -78,7 +78,7 @@ class MemoryOutputBase : public Node, public MemoryNode { return false; } - void assignState(MemStatePtr newState); + void assignState(const MemStatePtr& newState); protected: virtual void runStatic(dnnl::stream strm) = 0; @@ -130,7 +130,7 @@ class MemoryInputBase : public Input, public MemoryStateNode { enum class mode { read_value_assign, single_read_value }; public: - MemoryInputBase(const std::shared_ptr& op, const GraphContext::CPtr context); + MemoryInputBase(const std::shared_ptr& op, const GraphContext::CPtr& context); ~MemoryInputBase() override; @@ -141,8 +141,8 @@ class MemoryInputBase : public Input, public MemoryStateNode { void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override final; // NOLINT - void executeDynamicImpl(dnnl::stream strm) override final; // NOLINT + void execute(const dnnl::stream& strm) override final; // NOLINT + void executeDynamicImpl(const dnnl::stream& strm) override final; // NOLINT bool needShapeInfer() const override { return false; } @@ -158,12 +158,12 @@ class MemoryInputBase : public Input, public MemoryStateNode { void assignState(MemStatePtr newState) override final; // NOLINT protected: - MemoryInputBase(const std::string id, + MemoryInputBase(const std::string& id, const std::string& name, const std::string& type, const Shape& output_shape, const ov::element::Type& output_prc, - const GraphContext::CPtr context, + const GraphContext::CPtr& context, const ov::optional>& input_shape, const ov::optional>& input_prc, mode mode = mode::read_value_assign); @@ -194,13 +194,13 @@ class MemoryInputBase : public Input, public MemoryStateNode { class MemoryInput : public MemoryInputBase { public: - MemoryInput(const std::shared_ptr& op, const GraphContext::CPtr ctx); - MemoryInput(const std::string id, + MemoryInput(const std::shared_ptr& op, const GraphContext::CPtr& ctx); + MemoryInput(const std::string& id, const std::string& name, const std::string& type, const Shape& output_shape, const ov::element::Type& output_prc, - const GraphContext::CPtr context, + const GraphContext::CPtr& context, const ov::optional>& input_shape, const ov::optional>& input_prc, std::shared_ptr func = nullptr, @@ -241,12 +241,12 @@ class MemoryInput : public MemoryInputBase { class MemoryInputSingle : public MemoryInput { public: - MemoryInputSingle(const std::string id, + MemoryInputSingle(const std::string& id, const std::string& name, const std::string& type, const Shape& output_shape, const ov::element::Type& output_prc, - const GraphContext::CPtr context, + const GraphContext::CPtr& context, const ov::optional>& input_shape, const ov::optional>& input_prc, std::shared_ptr func); @@ -262,12 +262,12 @@ class MemoryInputSingle : public MemoryInput { class MemoryInputSDPA : public MemoryInputBase { public: - MemoryInputSDPA(const std::string id, + MemoryInputSDPA(const std::string& id, const std::string& name, const std::string& type, const Shape& output_shape, const ov::element::Type& output_prc, - const GraphContext::CPtr context, + const GraphContext::CPtr& context, const ov::optional>& input_shape, const ov::optional>& input_prc, const std::shared_ptr& sdpaNode); diff --git a/src/plugins/intel_cpu/src/nodes/memory_state_base.h b/src/plugins/intel_cpu/src/nodes/memory_state_base.h index 8861d853e518ea..3bd79a4114a535 100644 --- a/src/plugins/intel_cpu/src/nodes/memory_state_base.h +++ b/src/plugins/intel_cpu/src/nodes/memory_state_base.h @@ -4,6 +4,8 @@ #pragma once +#include + #include "memory_state.h" namespace ov { @@ -12,7 +14,7 @@ namespace node { class MemoryNode { public: - explicit MemoryNode(std::string id) : m_id(id) {} + explicit MemoryNode(std::string id) : m_id(std::move(id)) {} explicit MemoryNode(const std::shared_ptr& op); virtual ~MemoryNode() = default; const std::string& getId() const { diff --git a/src/plugins/intel_cpu/src/nodes/mha.cpp b/src/plugins/intel_cpu/src/nodes/mha.cpp index a78629f8c0f1cc..e1f4a774011dc9 100644 --- a/src/plugins/intel_cpu/src/nodes/mha.cpp +++ b/src/plugins/intel_cpu/src/nodes/mha.cpp @@ -39,11 +39,9 @@ struct jit_mul_add_softmax_kernel : public jit_uni_mul_add_softmax_kernel, publi explicit jit_mul_add_softmax_kernel(const jit_mul_add_softmax_compile_params& jcp) : jit_uni_mul_add_softmax_kernel(jcp), - jit_generator(jit_name()) { - exp_emitter = std::make_shared(this, isa, dnnl_eltwise_exp, 0.f, 0.f); - - vec_size = dnnl::impl::cpu::x64::cpu_isa_traits::vlen / sizeof(float); - } + jit_generator(jit_name()), + vec_size(dnnl::impl::cpu::x64::cpu_isa_traits::vlen / sizeof(float)), + exp_emitter(std::make_shared(this, isa, dnnl_eltwise_exp, 0.f, 0.f)) {} virtual ~jit_mul_add_softmax_kernel() {} void create_ker() override { @@ -384,9 +382,8 @@ struct jit_convert_reorder_kernel : public jit_uni_convert_reorder_kernel, publi explicit jit_convert_reorder_kernel(const jit_convert_reorder_compile_params& jcp) : jit_uni_convert_reorder_kernel(jcp), - jit_generator(jit_name()) { - vec_size = dnnl::impl::cpu::x64::cpu_isa_traits::vlen / sizeof(float); - } + jit_generator(jit_name()), + vec_size(dnnl::impl::cpu::x64::cpu_isa_traits::vlen / sizeof(float)) {} virtual ~jit_convert_reorder_kernel() {} void create_ker() override { @@ -801,7 +798,7 @@ bool MHA::isSupportedOperation(const std::shared_ptr& op, std::s return true; } -MHA::MHA(const std::shared_ptr& op, const GraphContext::CPtr context) +MHA::MHA(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -1542,7 +1539,7 @@ void MHA::mhaImpl() { }); } -void MHA::execute(dnnl::stream strm) { +void MHA::execute(const dnnl::stream& strm) { if (inputPrecisions[1] == ov::element::f32) { mhaImpl(); } else if (inputPrecisions[1] == ov::element::bf16) { @@ -1554,7 +1551,7 @@ void MHA::execute(dnnl::stream strm) { } } -void MHA::executeDynamicImpl(dnnl::stream strm) { +void MHA::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/mha.h b/src/plugins/intel_cpu/src/nodes/mha.h index 8770ba2455272c..9229f9dfdc4790 100644 --- a/src/plugins/intel_cpu/src/nodes/mha.h +++ b/src/plugins/intel_cpu/src/nodes/mha.h @@ -41,19 +41,18 @@ struct jit_mul_add_softmax_call_args { }; struct jit_uni_mul_add_softmax_kernel { - void (*ker_)(const jit_mul_add_softmax_call_args*); - void operator()(const jit_mul_add_softmax_call_args* call_args) { assert(ker_); ker_(call_args); } - explicit jit_uni_mul_add_softmax_kernel(const jit_mul_add_softmax_compile_params& jcp) : ker_(nullptr), jcp_(jcp) {} + explicit jit_uni_mul_add_softmax_kernel(const jit_mul_add_softmax_compile_params& jcp) : jcp_(jcp), ker_(nullptr) {} virtual ~jit_uni_mul_add_softmax_kernel() {} virtual void create_ker() = 0; jit_mul_add_softmax_compile_params jcp_; + void (*ker_)(const jit_mul_add_softmax_call_args*); }; struct jit_convert_reorder_compile_params { @@ -129,17 +128,17 @@ struct jit_uni_convert_transpose_kernel { class MHA : public Node { public: - MHA(const std::shared_ptr& op, const GraphContext::CPtr context); + MHA(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; protected: - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; void prepareParams() override; private: diff --git a/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp b/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp index 67d840ebbc48ae..c735aea89b8660 100644 --- a/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp +++ b/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp @@ -42,7 +42,7 @@ bool MultiClassNms::isSupportedOperation(const std::shared_ptr& return true; } -MultiClassNms::MultiClassNms(const std::shared_ptr& op, const GraphContext::CPtr context) +MultiClassNms::MultiClassNms(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, InternalDynShapeInferFactory()) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -213,7 +213,7 @@ bool MultiClassNms::isExecutable() const { return isDynamicNode() || Node::isExecutable(); } -void MultiClassNms::executeDynamicImpl(dnnl::stream strm) { +void MultiClassNms::executeDynamicImpl(const dnnl::stream& strm) { if (hasEmptyInputTensors()) { redefineOutputMemory({{0, 6}, {0, 1}, {0}}); return; @@ -221,7 +221,7 @@ void MultiClassNms::executeDynamicImpl(dnnl::stream strm) { execute(strm); } -void MultiClassNms::execute(dnnl::stream strm) { +void MultiClassNms::execute(const dnnl::stream& strm) { const float* boxes = getSrcDataAtPortAs(NMS_BOXES); const float* scores = getSrcDataAtPortAs(NMS_SCORES); @@ -640,9 +640,9 @@ void MultiClassNms::nmsWithoutEta(const float* boxes, } void MultiClassNms::checkPrecision(const ov::element::Type prec, - const std::vector precList, - const std::string name, - const std::string type) { + const std::vector& precList, + const std::string& name, + const std::string& type) { if (std::find(precList.begin(), precList.end(), prec) == precList.end()) THROW_CPU_NODE_ERR("has unsupported '", name, "' ", type, " precision: ", prec); } diff --git a/src/plugins/intel_cpu/src/nodes/multiclass_nms.hpp b/src/plugins/intel_cpu/src/nodes/multiclass_nms.hpp index 030a14e56b61df..fdcdc9af26d611 100644 --- a/src/plugins/intel_cpu/src/nodes/multiclass_nms.hpp +++ b/src/plugins/intel_cpu/src/nodes/multiclass_nms.hpp @@ -18,17 +18,17 @@ enum class MulticlassNmsSortResultType { class MultiClassNms : public Node { public: - MultiClassNms(const std::shared_ptr& op, const GraphContext::CPtr context); + MultiClassNms(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; bool isExecutable() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool needShapeInfer() const override { return false; @@ -92,9 +92,9 @@ class MultiClassNms : public Node { std::vector m_filtBoxes; // rois after nms for each class in each image void checkPrecision(const ov::element::Type prec, - const std::vector precList, - const std::string name, - const std::string type); + const std::vector& precList, + const std::string& name, + const std::string& type); float intersectionOverUnion(const float* boxesI, const float* boxesJ, const bool normalized); diff --git a/src/plugins/intel_cpu/src/nodes/multinomial.cpp b/src/plugins/intel_cpu/src/nodes/multinomial.cpp index 0b522f4042b12c..e7ed2d1b8e199f 100644 --- a/src/plugins/intel_cpu/src/nodes/multinomial.cpp +++ b/src/plugins/intel_cpu/src/nodes/multinomial.cpp @@ -124,7 +124,7 @@ bool Multinomial::created() const { return getType() == Type::Multinomial; } -void Multinomial::execute(dnnl::stream strm) { +void Multinomial::execute(const dnnl::stream& strm) { switch (m_probs_precision) { case ov::element::f32: return execute_probs_type(); @@ -137,7 +137,7 @@ void Multinomial::execute(dnnl::stream strm) { } } -void Multinomial::executeDynamicImpl(dnnl::stream strm) { +void Multinomial::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/multinomial.hpp b/src/plugins/intel_cpu/src/nodes/multinomial.hpp index 7a36a8773c2523..b56fe08e870d93 100644 --- a/src/plugins/intel_cpu/src/nodes/multinomial.hpp +++ b/src/plugins/intel_cpu/src/nodes/multinomial.hpp @@ -31,8 +31,8 @@ class Multinomial : public Node { void createPrimitive() override; bool isExecutable() const override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool canBeInPlace() const override { return false; } diff --git a/src/plugins/intel_cpu/src/nodes/mvn.cpp b/src/plugins/intel_cpu/src/nodes/mvn.cpp index e3c8d7b3f40822..df017fe052c343 100644 --- a/src/plugins/intel_cpu/src/nodes/mvn.cpp +++ b/src/plugins/intel_cpu/src/nodes/mvn.cpp @@ -361,7 +361,7 @@ struct jit_uni_mvn_mean_variance_kernel_f32 : public jit_uni_mvn_mean_variance_k } }; - auto vector_worker = [&](std::function func) { + auto vector_worker = [&](const std::function& func) { Xbyak::Label label_end; func(0); cmp(reg_unroll_size, 1); @@ -749,7 +749,7 @@ struct jit_uni_mvn_mean_variance_kernel_f32 : public jit_uni_mvn_mean_variance_k } } - inline void worker_tails(Xbyak::Reg64& reg_tail_num, std::function func) { + inline void worker_tails(Xbyak::Reg64& reg_tail_num, const std::function& func) { int tile_start_idx = (isa == cpu::x64::avx512_core) ? 0 : ((isa == cpu::x64::avx2) ? 1 : 2); Label tile_exit[kTileNum]; for (int i = tile_start_idx; i < kTileNum; i++) { @@ -1314,7 +1314,7 @@ struct jit_uni_mvn_kernel_f32 : public jit_uni_mvn_kernel, public jit_generator add(reg_dst_aux, step * jcp_.dst_data_size); }; - auto vector_worker = [&](std::function func) { + auto vector_worker = [&](const std::function& func) { Xbyak::Label label_end; func(0, vector_step); cmp(addr_unroll_size, 1); @@ -1659,7 +1659,7 @@ struct jit_uni_mvn_kernel_f32 : public jit_uni_mvn_kernel, public jit_generator {store_pool_gpr_idxs}); } - inline void worker_mvn_tails(Xbyak::Reg64& reg_tail_num, std::function func) { + inline void worker_mvn_tails(Xbyak::Reg64& reg_tail_num, const std::function& func) { int tile_start_idx = (isa == cpu::x64::avx512_core) ? 0 : ((isa == cpu::x64::avx2) ? 1 : 2); Label tile_exit[kTileNum]; for (int i = tile_start_idx; i < kTileNum; i++) { @@ -1869,7 +1869,7 @@ bool MVN::isSupportedOperation(const std::shared_ptr& op, std::s return true; } -MVN::MVN(const std::shared_ptr& op, const GraphContext::CPtr context) +MVN::MVN(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -2257,11 +2257,11 @@ void MVN::setPostOps(dnnl::primitive_attr& attr, bool initWeights) { attr.set_post_ops(ops); } -void MVN::executeDynamicImpl(dnnl::stream strm) { +void MVN::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void MVN::execute(dnnl::stream strm) { +void MVN::execute(const dnnl::stream& strm) { auto dstMemPtr = getDstMemoryAtPort(0); auto srcMemPtr = getSrcMemoryAtPort(0); diff --git a/src/plugins/intel_cpu/src/nodes/mvn.h b/src/plugins/intel_cpu/src/nodes/mvn.h index c9cb0894315457..b7bba5309a05d0 100644 --- a/src/plugins/intel_cpu/src/nodes/mvn.h +++ b/src/plugins/intel_cpu/src/nodes/mvn.h @@ -80,14 +80,14 @@ struct jit_uni_mvn_kernel { class MVN : public Node { public: - MVN(const std::shared_ptr& op, const GraphContext::CPtr context); + MVN(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; bool created() const override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool canBeInPlace() const override { return false; } diff --git a/src/plugins/intel_cpu/src/nodes/ngram.cpp b/src/plugins/intel_cpu/src/nodes/ngram.cpp index 90229676a23a3c..4a4c41e0a45d94 100644 --- a/src/plugins/intel_cpu/src/nodes/ngram.cpp +++ b/src/plugins/intel_cpu/src/nodes/ngram.cpp @@ -98,7 +98,7 @@ std::vector Ngram::computeBatchLenghts() { return batchLenghts; } -void Ngram::execute(dnnl::stream strm) { +void Ngram::execute(const dnnl::stream& strm) { auto* srcData = getSrcDataAtPortAs(0); auto* dstData = getDstDataAtPortAs(0); @@ -140,7 +140,7 @@ void Ngram::execute(dnnl::stream strm) { }); } -void Ngram::executeDynamicImpl(dnnl::stream strm) { +void Ngram::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/ngram.h b/src/plugins/intel_cpu/src/nodes/ngram.h index d9b4fef245789e..50a1eedb76dc57 100644 --- a/src/plugins/intel_cpu/src/nodes/ngram.h +++ b/src/plugins/intel_cpu/src/nodes/ngram.h @@ -20,13 +20,13 @@ class Ngram : public Node { void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; protected: - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; void prepareParams() override; private: diff --git a/src/plugins/intel_cpu/src/nodes/node_config.h b/src/plugins/intel_cpu/src/nodes/node_config.h index 5dfe123bff3dd6..d09e2132c1b470 100644 --- a/src/plugins/intel_cpu/src/nodes/node_config.h +++ b/src/plugins/intel_cpu/src/nodes/node_config.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include "memory_desc/blocked_memory_desc.h" #include "memory_desc/cpu_memory_desc.h" @@ -46,7 +47,7 @@ class PortDescBase_ : public PortDescBase { class PortDescGeneric : public PortDescBase_ { public: - explicit PortDescGeneric(MemoryDescPtr memDesc) : _memDesc(memDesc) { + explicit PortDescGeneric(MemoryDescPtr memDesc) : _memDesc(std::move(memDesc)) { if (nullptr == _memDesc) { OPENVINO_THROW("ParameterMismatch: PortDescGeneric constructor got nullptr"); } @@ -67,7 +68,7 @@ class PortDescBlocked : public PortDescBase_ { using CmpMask = BlockedMemoryDesc::CmpMask; public: - PortDescBlocked(BlockedMemoryDescPtr memDesc, CmpMask cmpMask) : _memDesc(memDesc), _cmpMask(cmpMask) { + PortDescBlocked(BlockedMemoryDescPtr memDesc, CmpMask cmpMask) : _memDesc(std::move(memDesc)), _cmpMask(cmpMask) { if (nullptr == _memDesc) { OPENVINO_THROW("ParameterMismatch: PortDescBlocked constructor got nullptr"); } @@ -88,7 +89,7 @@ class PortConfig { public: PortConfig() = default; - PortConfig(MemoryDescPtr desc, + PortConfig(const MemoryDescPtr& desc, BlockedMemoryDesc::CmpMask cmpMask = BlockedMemoryDesc::FULL_MASK, int inPlacePort = -1, bool isConstant = false) @@ -130,23 +131,23 @@ class PortConfig { return _desc; } - void setMemDesc(MemoryDescPtr desc) { + void setMemDesc(const MemoryDescPtr& desc) { _desc = createPortDesc(desc, BlockedMemoryDesc::FULL_MASK); } - void setMemDesc(BlockedMemoryDescPtr desc, BlockedMemoryDesc::CmpMask cmpMask) { + void setMemDesc(const BlockedMemoryDescPtr& desc, BlockedMemoryDesc::CmpMask cmpMask) { _desc = createPortDesc(desc, cmpMask); } private: - PortDescBasePtr createPortDesc(MemoryDescPtr desc, BlockedMemoryDesc::CmpMask cmpMask) { + PortDescBasePtr createPortDesc(const MemoryDescPtr& desc, BlockedMemoryDesc::CmpMask cmpMask) { if (desc->getType() & Blocked) return createPortDesc(std::dynamic_pointer_cast(desc), cmpMask); return std::make_shared(desc); } - PortDescBasePtr createPortDesc(BlockedMemoryDescPtr desc, BlockedMemoryDesc::CmpMask cmpMask) { + PortDescBasePtr createPortDesc(const BlockedMemoryDescPtr& desc, BlockedMemoryDesc::CmpMask cmpMask) { return std::make_shared(desc, cmpMask); } diff --git a/src/plugins/intel_cpu/src/nodes/non_max_suppression.cpp b/src/plugins/intel_cpu/src/nodes/non_max_suppression.cpp index 05b3b12f284285..8ad10c25ebf1a3 100644 --- a/src/plugins/intel_cpu/src/nodes/non_max_suppression.cpp +++ b/src/plugins/intel_cpu/src/nodes/non_max_suppression.cpp @@ -221,7 +221,7 @@ void NonMaxSuppression::createJitKernel() { #endif // OPENVINO_ARCH_X86_64 } -void NonMaxSuppression::executeDynamicImpl(dnnl::stream strm) { +void NonMaxSuppression::executeDynamicImpl(const dnnl::stream& strm) { if (hasEmptyInputTensors() || (inputShapes.size() > NMS_MAX_OUTPUT_BOXES_PER_CLASS && getSrcDataAtPortAs(NMS_MAX_OUTPUT_BOXES_PER_CLASS)[0] == 0)) { redefineOutputMemory({{0, 3}, {0, 3}, {1}}); @@ -231,7 +231,7 @@ void NonMaxSuppression::executeDynamicImpl(dnnl::stream strm) { execute(strm); } -void NonMaxSuppression::execute(dnnl::stream strm) { +void NonMaxSuppression::execute(const dnnl::stream& strm) { const auto inputs_num = inputShapes.size(); size_t max_number_of_boxes = m_output_boxes_per_class * m_batches_num * m_classes_num; diff --git a/src/plugins/intel_cpu/src/nodes/non_max_suppression.h b/src/plugins/intel_cpu/src/nodes/non_max_suppression.h index 91d81c1c2dcceb..8d7aa93b969ad7 100644 --- a/src/plugins/intel_cpu/src/nodes/non_max_suppression.h +++ b/src/plugins/intel_cpu/src/nodes/non_max_suppression.h @@ -21,9 +21,9 @@ class NonMaxSuppression : public Node { void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool created() const override; diff --git a/src/plugins/intel_cpu/src/nodes/non_zero.cpp b/src/plugins/intel_cpu/src/nodes/non_zero.cpp index 57eee8520d0ccf..5e9a09d13a9dcf 100644 --- a/src/plugins/intel_cpu/src/nodes/non_zero.cpp +++ b/src/plugins/intel_cpu/src/nodes/non_zero.cpp @@ -31,7 +31,7 @@ bool NonZero::isSupportedOperation(const std::shared_ptr& op, st return true; } -NonZero::NonZero(const std::shared_ptr& op, const GraphContext::CPtr context) +NonZero::NonZero(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, InternalDynShapeInferFactory()) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -119,11 +119,11 @@ struct NonZero::NonZeroExecute { } }; -void NonZero::executeDynamicImpl(dnnl::stream strm) { +void NonZero::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void NonZero::execute(dnnl::stream strm) { +void NonZero::execute(const dnnl::stream& strm) { auto inputPrec = getParentEdgeAt(0)->getMemory().getDesc().getPrecision(); NonZeroContext ctx = {*this}; OV_SWITCH(intel_cpu, diff --git a/src/plugins/intel_cpu/src/nodes/non_zero.h b/src/plugins/intel_cpu/src/nodes/non_zero.h index 7ba3552a45c846..e9e2bef9fe294a 100644 --- a/src/plugins/intel_cpu/src/nodes/non_zero.h +++ b/src/plugins/intel_cpu/src/nodes/non_zero.h @@ -19,11 +19,11 @@ namespace node { class NonZero : public Node { public: - NonZero(const std::shared_ptr& op, const GraphContext::CPtr context); + NonZero(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needShapeInfer() const override { return false; @@ -31,7 +31,7 @@ class NonZero : public Node { bool needPrepareParams() const override { return false; }; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; bool isExecutable() const override { diff --git a/src/plugins/intel_cpu/src/nodes/normalize.cpp b/src/plugins/intel_cpu/src/nodes/normalize.cpp index 5b83b043d53e30..e416781cdf69a2 100644 --- a/src/plugins/intel_cpu/src/nodes/normalize.cpp +++ b/src/plugins/intel_cpu/src/nodes/normalize.cpp @@ -5,6 +5,7 @@ #include "normalize.h" #include +#include #include "common/cpu_memcpy.h" #include "common/primitive_hashing_utils.hpp" @@ -773,7 +774,7 @@ bool NormalizeL2::isSupportedOperation(const std::shared_ptr& op return true; } -NormalizeL2::NormalizeL2(const std::shared_ptr& op, const GraphContext::CPtr context) +NormalizeL2::NormalizeL2(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, PassThroughShapeInferFactory()) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -965,11 +966,11 @@ void NormalizeL2::prepareParams() { execPtr = result.first; } -void NormalizeL2::executeDynamicImpl(dnnl::stream strm) { +void NormalizeL2::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void NormalizeL2::execute(dnnl::stream strm) { +void NormalizeL2::execute(const dnnl::stream& strm) { if (!execPtr) THROW_ERROR("doesn't have a compiled executor."); @@ -983,9 +984,8 @@ void NormalizeL2::execute(dnnl::stream strm) { template class NormalizeL2::NormalizeL2CornerCaseExecutor : public NormalizeL2::NormalizeL2Executor { public: - NormalizeL2CornerCaseExecutor(const VectorDims& dims) { - workAmount = std::accumulate(dims.begin(), dims.end(), 1, std::multiplies()); - } + NormalizeL2CornerCaseExecutor(const VectorDims& dims) + : workAmount(std::accumulate(dims.begin(), dims.end(), 1, std::multiplies())) {} void exec(const uint8_t* src_ptr, uint8_t* dst_ptr, const void** post_ops_data) override { normalize(reinterpret_cast(src_ptr), reinterpret_cast(dst_ptr)); @@ -1347,8 +1347,8 @@ class NormalizeL2::NormalizeL2ReferenceExecutor : public NormalizeL2::NormalizeL public: NormalizeL2ReferenceExecutor(const NormalizeL2Attrs& attrs, const dnnl::primitive_attr& kernel_attrs, - const VectorDims& dims) - : dims(dims), + VectorDims dims) + : dims(std::move(dims)), kernel_attrs(kernel_attrs), attrs(attrs) { if (attrs.layout != LayoutType::ncsp) { diff --git a/src/plugins/intel_cpu/src/nodes/normalize.h b/src/plugins/intel_cpu/src/nodes/normalize.h index 08422fc52f4b68..fe6c6c83589fc1 100644 --- a/src/plugins/intel_cpu/src/nodes/normalize.h +++ b/src/plugins/intel_cpu/src/nodes/normalize.h @@ -82,21 +82,21 @@ struct jit_uni_normalize_kernel { #endif class NormalizeL2 : public Node { public: - NormalizeL2(const std::shared_ptr& op, const GraphContext::CPtr context); + NormalizeL2(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; bool created() const override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool canBeInPlace() const override { return false; } bool canFuse(const NodePtr& node) const override; void prepareParams() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool isExecutable() const override; diff --git a/src/plugins/intel_cpu/src/nodes/one_hot.cpp b/src/plugins/intel_cpu/src/nodes/one_hot.cpp index 2a8f6aea669107..efdcbc9f0d31db 100644 --- a/src/plugins/intel_cpu/src/nodes/one_hot.cpp +++ b/src/plugins/intel_cpu/src/nodes/one_hot.cpp @@ -41,7 +41,7 @@ bool OneHot::isSupportedOperation(const std::shared_ptr& op, std return true; } -OneHot::OneHot(const std::shared_ptr& op, const GraphContext::CPtr context) +OneHot::OneHot(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, OneHotShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -132,11 +132,11 @@ void OneHot::one_hot(size_t prefix_size, size_t suffix_size) { }); } -void OneHot::executeDynamicImpl(dnnl::stream strm) { +void OneHot::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void OneHot::execute(dnnl::stream strm) { +void OneHot::execute(const dnnl::stream& strm) { std::size_t prefix_size = 1; auto input_dims = getParentEdgeAt(0)->getMemory().getStaticDims(); diff --git a/src/plugins/intel_cpu/src/nodes/one_hot.h b/src/plugins/intel_cpu/src/nodes/one_hot.h index f33efaef39fc26..bb89a7c91df6c5 100644 --- a/src/plugins/intel_cpu/src/nodes/one_hot.h +++ b/src/plugins/intel_cpu/src/nodes/one_hot.h @@ -12,19 +12,19 @@ namespace node { class OneHot : public Node { public: - OneHot(const std::shared_ptr& op, const GraphContext::CPtr context); + OneHot(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override{}; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needShapeInfer() const override; bool needPrepareParams() const override { return false; }; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/pad.cpp b/src/plugins/intel_cpu/src/nodes/pad.cpp index efbf51b3e05b7f..4d651e2d4f87a1 100644 --- a/src/plugins/intel_cpu/src/nodes/pad.cpp +++ b/src/plugins/intel_cpu/src/nodes/pad.cpp @@ -38,7 +38,7 @@ bool Pad::isSupportedOperation(const std::shared_ptr& op, std::s return true; } -Pad::Pad(const std::shared_ptr& op, const GraphContext::CPtr context) +Pad::Pad(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -387,14 +387,14 @@ void Pad::PadExecutor::exec(const MemoryPtr& srcMemPtr, const MemoryPtr& dstMemP } } -void Pad::execute(dnnl::stream strm) { +void Pad::execute(const dnnl::stream& strm) { if (!execPtr) THROW_CPU_NODE_ERR("has not compiled executor."); execPtr->exec(getSrcMemoryAtPort(0), getDstMemoryAtPort(0)); } -void Pad::executeDynamicImpl(dnnl::stream strm) { +void Pad::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/pad.h b/src/plugins/intel_cpu/src/nodes/pad.h index 38fb57e4c9971a..02915eff6a7d3b 100644 --- a/src/plugins/intel_cpu/src/nodes/pad.h +++ b/src/plugins/intel_cpu/src/nodes/pad.h @@ -12,13 +12,13 @@ namespace node { class Pad : public Node { public: - Pad(const std::shared_ptr& op, const GraphContext::CPtr context); + Pad(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; void prepareParams() override; @@ -27,7 +27,7 @@ class Pad : public Node { bool needPrepareParams() const override; protected: - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: using VectorIdxs = std::vector; diff --git a/src/plugins/intel_cpu/src/nodes/paged_attn.cpp b/src/plugins/intel_cpu/src/nodes/paged_attn.cpp index b558a129eb9b75..484e2af6d96b19 100644 --- a/src/plugins/intel_cpu/src/nodes/paged_attn.cpp +++ b/src/plugins/intel_cpu/src/nodes/paged_attn.cpp @@ -52,7 +52,7 @@ bool PagedAttentionKey::operator==(const PagedAttentionKey& rhs) const { return retVal; } -PagedAttention::PagedAttention(const std::shared_ptr& op, const GraphContext::CPtr context) +PagedAttention::PagedAttention(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, InternalDynShapeInferFactory()) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -180,7 +180,7 @@ void PagedAttention::createPrimitive() { m_executor = result.first; } -void PagedAttention::execute(dnnl::stream strm) { +void PagedAttention::execute(const dnnl::stream& strm) { auto orginInputNumber = getOriginalInputsNumber(); std::vector inputs(orginInputNumber); std::vector outputs(m_hasScore ? 2 : 1); diff --git a/src/plugins/intel_cpu/src/nodes/paged_attn.h b/src/plugins/intel_cpu/src/nodes/paged_attn.h index df83f550de0c34..8526b3b8dda999 100644 --- a/src/plugins/intel_cpu/src/nodes/paged_attn.h +++ b/src/plugins/intel_cpu/src/nodes/paged_attn.h @@ -16,7 +16,7 @@ namespace node { class PagedAttention : public Node { public: - PagedAttention(const std::shared_ptr& op, const GraphContext::CPtr context); + PagedAttention(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override {} bool created() const override { @@ -29,11 +29,11 @@ class PagedAttention : public Node { bool needPrepareParams() const override { return false; } - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; void createPrimitive() override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/pooling.cpp b/src/plugins/intel_cpu/src/nodes/pooling.cpp index 28d0f20654469f..7b1bb1653404bc 100644 --- a/src/plugins/intel_cpu/src/nodes/pooling.cpp +++ b/src/plugins/intel_cpu/src/nodes/pooling.cpp @@ -164,14 +164,15 @@ bool Pooling::isSupportedOperation(const std::shared_ptr& op, st return true; } -Pooling::Pooling(const std::shared_ptr& op, const GraphContext::CPtr context) +Pooling::Pooling(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage); } - auto get_attributes = [](std::vector& internal_attribute, const std::vector external_attribute) { + auto get_attributes = [](std::vector& internal_attribute, + const std::vector& external_attribute) { for (size_t i = 0; i < external_attribute.size(); i++) { internal_attribute.push_back(static_cast(external_attribute[i])); } @@ -503,7 +504,7 @@ void Pooling::prepareParams() { } } -void Pooling::execute(dnnl::stream strm) { +void Pooling::execute(const dnnl::stream& strm) { if (dnnlExecPtr) { dnnlExecPtr->exec(primArgs, strm); } else if (execPtr) { @@ -522,7 +523,7 @@ void Pooling::execute(dnnl::stream strm) { } } -void Pooling::executeDynamicImpl(dnnl::stream strm) { +void Pooling::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/pooling.h b/src/plugins/intel_cpu/src/nodes/pooling.h index 74e6c5456f1d01..269a155ff9b90b 100644 --- a/src/plugins/intel_cpu/src/nodes/pooling.h +++ b/src/plugins/intel_cpu/src/nodes/pooling.h @@ -15,7 +15,7 @@ namespace node { class Pooling : public Node { public: - Pooling(const std::shared_ptr& op, const GraphContext::CPtr context); + Pooling(const std::shared_ptr& op, const GraphContext::CPtr& context); void createDescriptor(const std::vector& inputDesc, const std::vector& outputDesc) override; @@ -29,8 +29,8 @@ class Pooling : public Node { } void prepareParams() override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/priorbox.cpp b/src/plugins/intel_cpu/src/nodes/priorbox.cpp index 9f892f733c7375..d1a2acd05d1a7a 100644 --- a/src/plugins/intel_cpu/src/nodes/priorbox.cpp +++ b/src/plugins/intel_cpu/src/nodes/priorbox.cpp @@ -43,7 +43,7 @@ bool PriorBox::isSupportedOperation(const std::shared_ptr& op, s return true; } -PriorBox::PriorBox(const std::shared_ptr& op, const GraphContext::CPtr context) +PriorBox::PriorBox(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, PriorBoxShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -73,7 +73,7 @@ PriorBox::PriorBox(const std::shared_ptr& op, const GraphContext::CPtr } for (float _aspect_ratio : aspect_ratio) { - if (fabs(aspect_ratio_item - _aspect_ratio) < 1e-6) { + if (std::fabs(aspect_ratio_item - _aspect_ratio) < 1e-6) { exist = true; break; } @@ -142,7 +142,7 @@ void PriorBox::createPrimitive() { } } -void PriorBox::execute(dnnl::stream strm) { +void PriorBox::execute(const dnnl::stream& strm) { const int* in_data = getSrcDataAtPortAs(0); const int H = in_data[0]; const int W = in_data[1]; diff --git a/src/plugins/intel_cpu/src/nodes/priorbox.h b/src/plugins/intel_cpu/src/nodes/priorbox.h index 9d2a9e7ecebe9c..b9b7679e120af3 100644 --- a/src/plugins/intel_cpu/src/nodes/priorbox.h +++ b/src/plugins/intel_cpu/src/nodes/priorbox.h @@ -12,18 +12,18 @@ namespace node { class PriorBox : public Node { public: - PriorBox(const std::shared_ptr& op, const GraphContext::CPtr context); + PriorBox(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needShapeInfer() const override; bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/priorbox_clustered.cpp b/src/plugins/intel_cpu/src/nodes/priorbox_clustered.cpp index fb21f1e8c6b5ab..26cd97f2334a7f 100644 --- a/src/plugins/intel_cpu/src/nodes/priorbox_clustered.cpp +++ b/src/plugins/intel_cpu/src/nodes/priorbox_clustered.cpp @@ -31,7 +31,7 @@ bool PriorBoxClustered::isSupportedOperation(const std::shared_ptr& op, const GraphContext::CPtr context) +PriorBoxClustered::PriorBoxClustered(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, PriorBoxClusteredShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -93,7 +93,7 @@ void PriorBoxClustered::createPrimitive() { } } -void PriorBoxClustered::execute(dnnl::stream strm) { +void PriorBoxClustered::execute(const dnnl::stream& strm) { const int* in_data = getSrcDataAtPortAs(0); const int layer_height = in_data[0]; const int layer_width = in_data[1]; diff --git a/src/plugins/intel_cpu/src/nodes/priorbox_clustered.h b/src/plugins/intel_cpu/src/nodes/priorbox_clustered.h index e077f4b123ccc3..a6ee787545f8d5 100644 --- a/src/plugins/intel_cpu/src/nodes/priorbox_clustered.h +++ b/src/plugins/intel_cpu/src/nodes/priorbox_clustered.h @@ -12,18 +12,18 @@ namespace node { class PriorBoxClustered : public Node { public: - PriorBoxClustered(const std::shared_ptr& op, const GraphContext::CPtr context); + PriorBoxClustered(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needShapeInfer() const override; bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/proposal.cpp b/src/plugins/intel_cpu/src/nodes/proposal.cpp index 722a997f9a429c..6fefd4ca3e24b9 100644 --- a/src/plugins/intel_cpu/src/nodes/proposal.cpp +++ b/src/plugins/intel_cpu/src/nodes/proposal.cpp @@ -92,7 +92,7 @@ bool Proposal::isSupportedOperation(const std::shared_ptr& op, s return true; } -Proposal::Proposal(const std::shared_ptr& op, const GraphContext::CPtr context) +Proposal::Proposal(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -156,11 +156,11 @@ void Proposal::initSupportedPrimitiveDescriptors() { } } -void Proposal::executeDynamicImpl(dnnl::stream strm) { +void Proposal::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void Proposal::execute(dnnl::stream strm) { +void Proposal::execute(const dnnl::stream& strm) { try { const float* probabilitiesData = getSrcDataAtPortAs(PROBABILITIES_IN_IDX); const float* anchorsData = getSrcDataAtPortAs(ANCHORS_IN_IDX); diff --git a/src/plugins/intel_cpu/src/nodes/proposal.h b/src/plugins/intel_cpu/src/nodes/proposal.h index 3ee1100a5551f7..064eb11aebd974 100644 --- a/src/plugins/intel_cpu/src/nodes/proposal.h +++ b/src/plugins/intel_cpu/src/nodes/proposal.h @@ -15,17 +15,17 @@ namespace node { class Proposal : public Node { public: - Proposal(const std::shared_ptr& op, const GraphContext::CPtr context); + Proposal(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override { return false; }; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp b/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp index 3049e82dcd93ee..e171b0113ac4c5 100644 --- a/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp +++ b/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp @@ -59,7 +59,7 @@ bool PSROIPooling::isSupportedOperation(const std::shared_ptr& o return true; } -PSROIPooling::PSROIPooling(const std::shared_ptr& op, const GraphContext::CPtr context) +PSROIPooling::PSROIPooling(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -203,8 +203,8 @@ void PSROIPooling::unpackParams(const BlockedMemoryDesc& srcDesc, const bool outIsBlk = dstDesc.hasLayoutType(LayoutType::nCsp16c) || dstDesc.hasLayoutType(LayoutType::nCsp8c); size_t expectedInBlockDimsSize = (inpIsBlk ? 5 : 4); size_t expectedOutBlockDimsSize = (outIsBlk ? 5 : 4); - auto inBlkDims = srcDesc.getBlockDims(); - auto outBlkDims = dstDesc.getBlockDims(); + const auto& inBlkDims = srcDesc.getBlockDims(); + const auto& outBlkDims = dstDesc.getBlockDims(); if (inBlkDims.size() != expectedInBlockDimsSize) THROW_CPU_NODE_ERR("has unexpected size of blocking dims in input (given ", inBlkDims.size(), @@ -601,7 +601,7 @@ struct PSROIPooling::PSROIPoolingExecute { } }; -void PSROIPooling::execute(dnnl::stream strm) { +void PSROIPooling::execute(const dnnl::stream& strm) { auto inputPrec = getParentEdgeAt(0)->getMemory().getDesc().getPrecision(); auto outputPrec = getChildEdgeAt(0)->getMemory().getDesc().getPrecision(); diff --git a/src/plugins/intel_cpu/src/nodes/psroi_pooling.h b/src/plugins/intel_cpu/src/nodes/psroi_pooling.h index 2a0f59de26430e..08912df92087a0 100644 --- a/src/plugins/intel_cpu/src/nodes/psroi_pooling.h +++ b/src/plugins/intel_cpu/src/nodes/psroi_pooling.h @@ -12,12 +12,12 @@ namespace node { class PSROIPooling : public Node { public: - PSROIPooling(const std::shared_ptr& op, const GraphContext::CPtr context); + PSROIPooling(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override{}; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp b/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp index 73cc613e86a802..d6f50e2df78244 100644 --- a/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp +++ b/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp @@ -5,6 +5,7 @@ #include "qkv_proj.h" #include +#include #include #include "common/bfloat16.hpp" @@ -66,7 +67,7 @@ struct QKVProjection::Executor : public QKVProjection::ExecutorBase { WeightBuffer wbuffer; - Executor(QKVProjection* pnode, DnnlScratchPadPtr scrachPad) : m_node(pnode), m_scrachPad(scrachPad) { + Executor(QKVProjection* pnode, DnnlScratchPadPtr scrachPad) : m_node(pnode), m_scrachPad(std::move(scrachPad)) { PlainTensor w0(pnode->getSrcMemoryAtPort(1)); PlainTensor w1(pnode->getSrcMemoryAtPort(2)); PlainTensor w2(pnode->getSrcMemoryAtPort(3)); @@ -329,12 +330,12 @@ void QKVProjection::createPrimitive() { } } -void QKVProjection::execute(dnnl::stream strm) { +void QKVProjection::execute(const dnnl::stream& strm) { MAYBE_UNUSED(strm); m_executor->execute(); } -QKVProjection::QKVProjection(const std::shared_ptr& op, const GraphContext::CPtr context) +QKVProjection::QKVProjection(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; diff --git a/src/plugins/intel_cpu/src/nodes/qkv_proj.h b/src/plugins/intel_cpu/src/nodes/qkv_proj.h index 2e2c444612c6f2..d65dbc79daabd8 100644 --- a/src/plugins/intel_cpu/src/nodes/qkv_proj.h +++ b/src/plugins/intel_cpu/src/nodes/qkv_proj.h @@ -17,7 +17,7 @@ namespace node { class QKVProjection : public Node { public: - QKVProjection(const std::shared_ptr& op, const GraphContext::CPtr context); + QKVProjection(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override {} bool created() const override { @@ -27,11 +27,11 @@ class QKVProjection : public Node { return false; } void createPrimitive() override; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage, int concurrency = 0, diff --git a/src/plugins/intel_cpu/src/nodes/random_uniform.cpp b/src/plugins/intel_cpu/src/nodes/random_uniform.cpp index ad52060dc9dd2b..eeb36442a71bc7 100644 --- a/src/plugins/intel_cpu/src/nodes/random_uniform.cpp +++ b/src/plugins/intel_cpu/src/nodes/random_uniform.cpp @@ -152,7 +152,7 @@ void RandomUniform::prepareParams() { } } -void RandomUniform::execute(dnnl::stream strm) { +void RandomUniform::execute(const dnnl::stream& strm) { if (!m_const_inputs[MIN_VAL]) { initEdgeValues(m_min_val, getSrcDataAtPort(MIN_VAL), m_output_prc); if (m_const_inputs[MAX_VAL]) { @@ -177,7 +177,7 @@ void RandomUniform::execute(dnnl::stream strm) { } } -void RandomUniform::executeDynamicImpl(dnnl::stream strm) { +void RandomUniform::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } @@ -191,7 +191,7 @@ std::string RandomUniform::getPrimitiveDescriptorType() const { std::string str_type; - auto add_type = [&](std::string t) { + auto add_type = [&](const std::string& t) { if (!str_type.empty() && t.c_str()[0] != '_') str_type += "_"; str_type += t; diff --git a/src/plugins/intel_cpu/src/nodes/random_uniform.hpp b/src/plugins/intel_cpu/src/nodes/random_uniform.hpp index 404e7edaa3f041..7c0321b8183bfc 100644 --- a/src/plugins/intel_cpu/src/nodes/random_uniform.hpp +++ b/src/plugins/intel_cpu/src/nodes/random_uniform.hpp @@ -37,9 +37,9 @@ class RandomUniform : public Node { void prepareParams() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool isExecutable() const override; diff --git a/src/plugins/intel_cpu/src/nodes/range.cpp b/src/plugins/intel_cpu/src/nodes/range.cpp index 02eb470d2f6d5b..1f0a02e5594d55 100644 --- a/src/plugins/intel_cpu/src/nodes/range.cpp +++ b/src/plugins/intel_cpu/src/nodes/range.cpp @@ -29,7 +29,7 @@ bool Range::isSupportedOperation(const std::shared_ptr& op, std: return true; } -Range::Range(const std::shared_ptr& op, const GraphContext::CPtr context) +Range::Range(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, InternalDynShapeInferFactory()) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -87,11 +87,11 @@ void Range::initSupportedPrimitiveDescriptors() { } } -void Range::executeDynamicImpl(dnnl::stream strm) { +void Range::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void Range::execute(dnnl::stream strm) { +void Range::execute(const dnnl::stream& strm) { StatusCode retcode = OK; switch (getParentEdgeAt(0)->getMemory().getDesc().getPrecision()) { case ov::element::f32: diff --git a/src/plugins/intel_cpu/src/nodes/range.h b/src/plugins/intel_cpu/src/nodes/range.h index bd21f12495f76b..e6f0d637adb5fb 100644 --- a/src/plugins/intel_cpu/src/nodes/range.h +++ b/src/plugins/intel_cpu/src/nodes/range.h @@ -12,11 +12,11 @@ namespace node { class Range : public Node { public: - Range(const std::shared_ptr& op, const GraphContext::CPtr context); + Range(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override { return false; @@ -24,7 +24,7 @@ class Range : public Node { bool needShapeInfer() const override { return false; }; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; enum StatusCode : int { diff --git a/src/plugins/intel_cpu/src/nodes/rdft.cpp b/src/plugins/intel_cpu/src/nodes/rdft.cpp index d39aa9e23343fe..4639bbd8a8c814 100644 --- a/src/plugins/intel_cpu/src/nodes/rdft.cpp +++ b/src/plugins/intel_cpu/src/nodes/rdft.cpp @@ -74,7 +74,7 @@ static std::vector getDefaultSignalSizes(const VectorDims& inputShape, return signalSizes; } -RDFT::RDFT(const std::shared_ptr& op, const GraphContext::CPtr context) +RDFT::RDFT(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -151,7 +151,7 @@ void RDFT::initSupportedPrimitiveDescriptors() { addSupportedPrimDesc(configurators, {{LayoutType::ncsp, ov::element::f32}}, impl_desc_type::ref_any); } -void RDFT::execute(dnnl::stream strm) { +void RDFT::execute(const dnnl::stream& strm) { const auto& inputMem = getParentEdgeAt(DATA_INDEX)->getMemory(); const auto& outputMem = getChildEdgeAt(0)->getMemory(); const auto& inputShape = inputMem.getStaticDims(); @@ -177,7 +177,7 @@ void RDFT::execute(dnnl::stream strm) { outputStrides); } -void RDFT::executeDynamicImpl(dnnl::stream strm) { +void RDFT::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/rdft.h b/src/plugins/intel_cpu/src/nodes/rdft.h index 0238ecb36867ad..e8990e383d8ff3 100644 --- a/src/plugins/intel_cpu/src/nodes/rdft.h +++ b/src/plugins/intel_cpu/src/nodes/rdft.h @@ -99,13 +99,13 @@ struct RDFTExecutor { class RDFT : public Node { public: - RDFT(const std::shared_ptr& op, const GraphContext::CPtr context); + RDFT(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void prepareParams() override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool created() const override; void createPrimitive() override; diff --git a/src/plugins/intel_cpu/src/nodes/reduce.cpp b/src/plugins/intel_cpu/src/nodes/reduce.cpp index f320ed270c6d18..04dfbc2c35e30a 100644 --- a/src/plugins/intel_cpu/src/nodes/reduce.cpp +++ b/src/plugins/intel_cpu/src/nodes/reduce.cpp @@ -1959,7 +1959,7 @@ bool Reduce::isSupportedOperation(const std::shared_ptr& op, std return true; } -Reduce::Reduce(const std::shared_ptr& op, const GraphContext::CPtr context) +Reduce::Reduce(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (isSupportedOperation(op, errorMessage)) { @@ -2362,11 +2362,11 @@ void Reduce::create_reduce_kernel(std::shared_ptr& kernel jit_mode = jit_mode && kernel; } -void Reduce::executeDynamicImpl(dnnl::stream strm) { +void Reduce::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void Reduce::execute(dnnl::stream strm) { +void Reduce::execute(const dnnl::stream& strm) { auto dstMemPtr = getDstMemoryAtPort(0); auto srcMemPtr = getSrcMemoryAtPort(REDUCE_DATA); diff --git a/src/plugins/intel_cpu/src/nodes/reduce.h b/src/plugins/intel_cpu/src/nodes/reduce.h index e0d68241365ef4..16cf99bd9c75d4 100644 --- a/src/plugins/intel_cpu/src/nodes/reduce.h +++ b/src/plugins/intel_cpu/src/nodes/reduce.h @@ -88,15 +88,15 @@ struct jit_uni_reduce_post_kernel { class Reduce : public Node { public: - Reduce(const std::shared_ptr& op, const GraphContext::CPtr context); + Reduce(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void prepareParams() override; void createPrimitive() override; bool created() const override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; int getFusingAxis() const override; bool canFuse(const NodePtr& node) const override; bool canBeInPlace() const override { diff --git a/src/plugins/intel_cpu/src/nodes/reference.cpp b/src/plugins/intel_cpu/src/nodes/reference.cpp index 78d62bebf50c83..c7f1bbe30ff574 100644 --- a/src/plugins/intel_cpu/src/nodes/reference.cpp +++ b/src/plugins/intel_cpu/src/nodes/reference.cpp @@ -4,6 +4,8 @@ #include "reference.h" +#include + #include "common/cpu_memcpy.h" #include "shape_inference/shape_inference.hpp" @@ -24,12 +26,10 @@ class ReferenceShapeInferFactory : public ShapeInferFactory { namespace node { -Reference::Reference(const std::shared_ptr& op, - const GraphContext::CPtr& context, - const std::string& errorMessage) +Reference::Reference(const std::shared_ptr& op, const GraphContext::CPtr& context, std::string errorMessage) : Node(op, context, ReferenceShapeInferFactory(op)), ovCoreNode(op), - additionalErrorMessage(errorMessage) { + additionalErrorMessage(std::move(errorMessage)) { if (!op->has_evaluate()) { OPENVINO_THROW_NOT_IMPLEMENTED( "Cannot fallback on ngraph reference implementation. Ngraph::Node::evaluate() is not implemented for op: ", @@ -63,7 +63,7 @@ void Reference::initSupportedPrimitiveDescriptors() { void Reference::createPrimitive() {} -void Reference::execute(dnnl::stream strm) { +void Reference::execute(const dnnl::stream& strm) { auto inputs = prepareInputs(); auto outputs = prepareOutputs(); if (!ovCoreNode->evaluate(outputs, inputs)) { @@ -71,7 +71,7 @@ void Reference::execute(dnnl::stream strm) { } } -void Reference::executeDynamicImpl(dnnl::stream strm) { +void Reference::executeDynamicImpl(const dnnl::stream& strm) { auto inputs = prepareInputs(); ov::TensorVector outputs; auto result = Node::shapeInfer(); diff --git a/src/plugins/intel_cpu/src/nodes/reference.h b/src/plugins/intel_cpu/src/nodes/reference.h index 705f2308721130..782c55716506a8 100644 --- a/src/plugins/intel_cpu/src/nodes/reference.h +++ b/src/plugins/intel_cpu/src/nodes/reference.h @@ -12,12 +12,12 @@ namespace node { class Reference : public Node { public: - Reference(const std::shared_ptr& op, const GraphContext::CPtr& context, const std::string& errorMessage); + Reference(const std::shared_ptr& op, const GraphContext::CPtr& context, std::string errorMessage); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needShapeInfer() const override; @@ -27,7 +27,7 @@ class Reference : public Node { bool isExecutable() const override { return true; } - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: ov::TensorVector prepareInputs() const; diff --git a/src/plugins/intel_cpu/src/nodes/region_yolo.cpp b/src/plugins/intel_cpu/src/nodes/region_yolo.cpp index fc198bc0cc2d72..10fd3ef2bb77f5 100644 --- a/src/plugins/intel_cpu/src/nodes/region_yolo.cpp +++ b/src/plugins/intel_cpu/src/nodes/region_yolo.cpp @@ -258,7 +258,7 @@ bool RegionYolo::needPrepareParams() const { return false; } -RegionYolo::RegionYolo(const std::shared_ptr& op, const GraphContext::CPtr context) +RegionYolo::RegionYolo(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -387,7 +387,7 @@ inline void RegionYolo::calculate_logistic(size_t start_index, int count, uint8_ } } -void RegionYolo::execute(dnnl::stream strm) { +void RegionYolo::execute(const dnnl::stream& strm) { const auto& inShape = getParentEdgeAt(0)->getMemory().getShape(); const auto& inDims = inShape.getStaticDims(); size_t B = (inShape.getRank() > 0) ? inDims[0] : 1; diff --git a/src/plugins/intel_cpu/src/nodes/region_yolo.h b/src/plugins/intel_cpu/src/nodes/region_yolo.h index 1f34e8cb0431a6..77054a249b664e 100644 --- a/src/plugins/intel_cpu/src/nodes/region_yolo.h +++ b/src/plugins/intel_cpu/src/nodes/region_yolo.h @@ -40,19 +40,19 @@ struct jit_uni_logistic_kernel { class RegionYolo : public Node { public: - RegionYolo(const std::shared_ptr& op, const GraphContext::CPtr context); + RegionYolo(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; protected: bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/reorder.cpp b/src/plugins/intel_cpu/src/nodes/reorder.cpp index 901df6c6bf8742..bde3481da6fc47 100644 --- a/src/plugins/intel_cpu/src/nodes/reorder.cpp +++ b/src/plugins/intel_cpu/src/nodes/reorder.cpp @@ -32,7 +32,7 @@ bool Reorder::isExecutable() const { return Node::isExecutable() && !isOptimized; } -Reorder::Reorder(const std::shared_ptr& op, const GraphContext::CPtr context) +Reorder::Reorder(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, PassThroughShapeInferFactory()) { THROW_CPU_NODE_ERR("could not create CPU node from Core node."); } @@ -40,7 +40,7 @@ Reorder::Reorder(const std::shared_ptr& op, const GraphContext::CPtr c Reorder::Reorder(const MemoryDesc& input, const MemoryDesc& output, const std::string& name, - const GraphContext::CPtr context) + const GraphContext::CPtr& context) : Node("Reorder", {input.getShape()}, {output.getShape()}, @@ -128,11 +128,11 @@ void Reorder::createPrimitive() { } } -void Reorder::executeDynamicImpl(dnnl::stream strm) { +void Reorder::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void Reorder::prepareReorderAsTranspose(MemoryDescPtr parentDesc, MemoryDescPtr childDesc) { +void Reorder::prepareReorderAsTranspose(const MemoryDescPtr& parentDesc, const MemoryDescPtr& childDesc) { auto getOrderAndBlockedDims = [](const MemoryDesc& lhs, const MemoryDesc& rhs) -> std::pair, std::vector> { const auto& in = lhs.as()->getBlockDims(); @@ -399,7 +399,7 @@ void Reorder::optimizedNspc2Ncsp() { }); } -void Reorder::execute(dnnl::stream strm) { +void Reorder::execute(const dnnl::stream& strm) { #if defined(OPENVINO_ARCH_ARM) || defined(OPENVINO_ARCH_ARM64) if (transposeExecutor) { auto dstMemPtr = getDstMemoryAtPort(0); @@ -449,7 +449,7 @@ std::string Reorder::getReorderArgs(const MemoryDesc& parentDesc, const MemoryDe return inArgs + "_" + outArgs; } -void Reorder::reorderData(const IMemory& input, const IMemory& output, MultiCachePtr cache) { +void Reorder::reorderData(const IMemory& input, const IMemory& output, const MultiCachePtr& cache) { if (!input.getDesc().isDefined() || !output.getDesc().isDefined()) OPENVINO_THROW("Can't reorder data with dynamic shapes"); @@ -510,7 +510,7 @@ void Reorder::reorderData(const IMemory& input, const IMemory& output, MultiCach input.getSize() / input.getDesc().getPrecision().size()); auto tmpDesc = input.getDesc().cloneWithNewPrecision(outPrc); - Memory tmpMem(engine, std::move(tmpDesc), tmpBuff.data()); + Memory tmpMem(engine, tmpDesc, tmpBuff.data()); srcMemory = tmpMem.getPrimitive(); reorder = getReorderPrim(cache, dstMemory.get_engine(), srcMemory.get_desc(), dstMemory.get_desc()); diff --git a/src/plugins/intel_cpu/src/nodes/reorder.h b/src/plugins/intel_cpu/src/nodes/reorder.h index 33aba78c323bac..d04416157a0991 100644 --- a/src/plugins/intel_cpu/src/nodes/reorder.h +++ b/src/plugins/intel_cpu/src/nodes/reorder.h @@ -14,15 +14,15 @@ namespace node { class Reorder : public Node { public: - Reorder(const std::shared_ptr& op, const GraphContext::CPtr context); + Reorder(const std::shared_ptr& op, const GraphContext::CPtr& context); Reorder(const MemoryDesc& input, const MemoryDesc& output, const std::string& name, - const GraphContext::CPtr context); + const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; const std::vector& getDefaultImplPriority() override; @@ -32,7 +32,7 @@ class Reorder : public Node { void prepareParams() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; void setSrcPermutation(const std::vector& src_perm) { this->src_permutation = src_perm; @@ -59,7 +59,7 @@ class Reorder : public Node { static std::string getReorderArgs(const MemoryDesc& parentDesc, const MemoryDesc& childDesc); - static void reorderData(const IMemory& input, const IMemory& output, MultiCachePtr cache = nullptr); + static void reorderData(const IMemory& input, const IMemory& output, const MultiCachePtr& cache = nullptr); private: dnnl::reorder::primitive prim; @@ -79,7 +79,7 @@ class Reorder : public Node { void optimizedNcsp2Nspc(); void createReorderPrimitive(const DnnlMemoryDescPtr& srcDesc, const DnnlMemoryDescPtr& dstDesc); - void prepareReorderAsTranspose(MemoryDescPtr parentDesc, MemoryDescPtr childDesc); + void prepareReorderAsTranspose(const MemoryDescPtr& parentDesc, const MemoryDescPtr& childDesc); TransposeExecutorPtr transposeExecutor; }; diff --git a/src/plugins/intel_cpu/src/nodes/reorg_yolo.cpp b/src/plugins/intel_cpu/src/nodes/reorg_yolo.cpp index 015bc38adea65b..2c098d83d97215 100644 --- a/src/plugins/intel_cpu/src/nodes/reorg_yolo.cpp +++ b/src/plugins/intel_cpu/src/nodes/reorg_yolo.cpp @@ -26,7 +26,7 @@ bool ReorgYolo::isSupportedOperation(const std::shared_ptr& op, return true; } -ReorgYolo::ReorgYolo(const std::shared_ptr& op, const GraphContext::CPtr context) +ReorgYolo::ReorgYolo(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -52,11 +52,11 @@ void ReorgYolo::initSupportedPrimitiveDescriptors() { impl_desc_type::ref_any); } -void ReorgYolo::executeDynamicImpl(dnnl::stream strm) { +void ReorgYolo::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void ReorgYolo::execute(dnnl::stream strm) { +void ReorgYolo::execute(const dnnl::stream& strm) { const auto* src_data = getSrcDataAtPortAs(0); auto* dst_data = getDstDataAtPortAs(0); diff --git a/src/plugins/intel_cpu/src/nodes/reorg_yolo.h b/src/plugins/intel_cpu/src/nodes/reorg_yolo.h index a2f341fee4aed2..0c8f4ec445eda5 100644 --- a/src/plugins/intel_cpu/src/nodes/reorg_yolo.h +++ b/src/plugins/intel_cpu/src/nodes/reorg_yolo.h @@ -12,16 +12,16 @@ namespace node { class ReorgYolo : public Node { public: - ReorgYolo(const std::shared_ptr& op, const GraphContext::CPtr context); + ReorgYolo(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override { return false; } - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/reshape.cpp b/src/plugins/intel_cpu/src/nodes/reshape.cpp index f4ee25aab83aa8..c79f430aac4bd6 100644 --- a/src/plugins/intel_cpu/src/nodes/reshape.cpp +++ b/src/plugins/intel_cpu/src/nodes/reshape.cpp @@ -30,7 +30,7 @@ bool Reshape::isSupportedOperation(const std::shared_ptr& op, st return true; } -Reshape::Reshape(const std::shared_ptr& op, const GraphContext::CPtr context) +Reshape::Reshape(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, ReshapeShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -38,7 +38,7 @@ Reshape::Reshape(const std::shared_ptr& op, const GraphContext::CPtr c } if (isDynamicNode()) { - auto checkSecondInput = [](const std::shared_ptr& op, const std::string opType) { + auto checkSecondInput = [](const std::shared_ptr& op, const std::string& opType) { if (op->get_input_partial_shape(1).is_dynamic()) { OPENVINO_THROW("CPU plug-in doesn't support ", opType, " node with non static second input"); } @@ -120,11 +120,11 @@ void Reshape::initSupportedPrimitiveDescriptors() { supportedPrimitiveDescriptors.emplace_back(config, impl_desc_type::unknown); } -void Reshape::executeDynamicImpl(dnnl::stream strm) { +void Reshape::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void Reshape::execute(dnnl::stream strm) { +void Reshape::execute(const dnnl::stream& strm) { auto srcMemPtr = getSrcMemoryAtPort(0); auto dstMemPtr = getDstMemoryAtPort(0); diff --git a/src/plugins/intel_cpu/src/nodes/reshape.h b/src/plugins/intel_cpu/src/nodes/reshape.h index f64c6e2807b7e4..7758dfa6e06746 100644 --- a/src/plugins/intel_cpu/src/nodes/reshape.h +++ b/src/plugins/intel_cpu/src/nodes/reshape.h @@ -13,7 +13,7 @@ namespace node { class Reshape : public Node { public: - Reshape(const std::shared_ptr& op, const GraphContext::CPtr context); + Reshape(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; @@ -24,8 +24,8 @@ class Reshape : public Node { bool needPrepareParams() const override { return false; } - void executeDynamicImpl(dnnl::stream strm) override; - void execute(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; + void execute(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp b/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp index 9cdc9fa596b436..de8e0319b8d525 100644 --- a/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp +++ b/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp @@ -28,7 +28,7 @@ bool ReverseSequence::isSupportedOperation(const std::shared_ptr return true; } -ReverseSequence::ReverseSequence(const std::shared_ptr& op, const GraphContext::CPtr context) +ReverseSequence::ReverseSequence(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -98,8 +98,8 @@ void ReverseSequence::prepareParams() { execPtr = std::make_shared(dataDims, seqLengthsDims, dstDims, batch_axis, seq_axis); } -void ReverseSequence::executeDynamicImpl(dnnl::stream strm) { - execute(std::move(strm)); +void ReverseSequence::executeDynamicImpl(const dnnl::stream& strm) { + execute(strm); } ReverseSequence::ReverseSequenceExecutor::ReverseSequenceExecutor(const VectorDims& dataDims, @@ -169,7 +169,7 @@ void ReverseSequence::ReverseSequenceExecutor::exec(const MemoryPtr& dataMemPtr, }); } -void ReverseSequence::execute(dnnl::stream strm) { +void ReverseSequence::execute(const dnnl::stream& strm) { if (!execPtr) THROW_CPU_NODE_ERR("has no compiled executor"); diff --git a/src/plugins/intel_cpu/src/nodes/reverse_sequence.h b/src/plugins/intel_cpu/src/nodes/reverse_sequence.h index 3e9fa7e352a234..6593a383d84b62 100644 --- a/src/plugins/intel_cpu/src/nodes/reverse_sequence.h +++ b/src/plugins/intel_cpu/src/nodes/reverse_sequence.h @@ -12,15 +12,15 @@ namespace node { class ReverseSequence : public Node { public: - ReverseSequence(const std::shared_ptr& op, const GraphContext::CPtr context); + ReverseSequence(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; void prepareParams() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/rms_norm.cpp b/src/plugins/intel_cpu/src/nodes/rms_norm.cpp index b2eda6cf8dad6f..85d09ae093ce10 100644 --- a/src/plugins/intel_cpu/src/nodes/rms_norm.cpp +++ b/src/plugins/intel_cpu/src/nodes/rms_norm.cpp @@ -117,7 +117,7 @@ struct RMSNorm::RMSNormExecutor : public RMSNorm::Executor { }; #endif // OPENVINO_ARCH_X86_64 -RMSNorm::RMSNorm(const std::shared_ptr& op, const GraphContext::CPtr context) +RMSNorm::RMSNorm(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, RMSNormShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -172,7 +172,7 @@ void RMSNorm::createPrimitive() { m_executor = result.first; } -void RMSNorm::execute(dnnl::stream strm) { +void RMSNorm::execute(const dnnl::stream& strm) { auto orginInputNumber = getOriginalInputsNumber(); std::vector inputs(orginInputNumber); diff --git a/src/plugins/intel_cpu/src/nodes/rms_norm.h b/src/plugins/intel_cpu/src/nodes/rms_norm.h index 00ace4c13de753..039e13eb2d7c2b 100644 --- a/src/plugins/intel_cpu/src/nodes/rms_norm.h +++ b/src/plugins/intel_cpu/src/nodes/rms_norm.h @@ -13,7 +13,7 @@ namespace node { class RMSNorm : public Node { public: - RMSNorm(const std::shared_ptr& op, const GraphContext::CPtr context); + RMSNorm(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override {} bool created() const override { @@ -22,11 +22,11 @@ class RMSNorm : public Node { bool needPrepareParams() const override { return false; } - void executeDynamicImpl(dnnl::stream strm) override { - execute(std::move(strm)); + void executeDynamicImpl(const dnnl::stream& strm) override { + execute(strm); } void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; void createPrimitive() override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/rnn.cpp b/src/plugins/intel_cpu/src/nodes/rnn.cpp index 7f831ab02c66e3..8140624edd3c37 100644 --- a/src/plugins/intel_cpu/src/nodes/rnn.cpp +++ b/src/plugins/intel_cpu/src/nodes/rnn.cpp @@ -4,6 +4,8 @@ #include "rnn.h" +#include + #include "common/primitive_hashing_utils.hpp" #include "memory_desc/cpu_memory_desc_utils.h" #include "nodes/common/cpu_convert.h" @@ -409,7 +411,7 @@ class RnnShapeInfer : public IShapeInfer { class RnnShapeInferFactory final : public ShapeInferFactory { public: - RnnShapeInferFactory(std::shared_ptr op) : m_op(op) {} + RnnShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override { return std::make_shared(m_op); } @@ -420,7 +422,7 @@ class RnnShapeInferFactory final : public ShapeInferFactory { } // namespace -RNN::RNN(const std::shared_ptr& op, const GraphContext::CPtr context) +RNN::RNN(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, RnnShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -1108,7 +1110,7 @@ void RNN::copyWeightsData() { } namespace { -dnnl::primitive_desc createPrimitiveDescriptor(const dnnl::engine engine, +dnnl::primitive_desc createPrimitiveDescriptor(const dnnl::engine& engine, const dnnl::algorithm cellType, const dnnl::algorithm cellAct, const dnnl::rnn_direction direction, @@ -1385,7 +1387,7 @@ std::shared_ptr RNN::getDstMemDesc(const dnnl::primitive_desc& prim_ return supportedPrimitiveDescriptors[0].getConfig().outConfs[idx].getMemDesc(); } -void RNN::execute(dnnl::stream strm) { +void RNN::execute(const dnnl::stream& strm) { if (!execPtr) THROW_CPU_NODE_ERR("does not have initialized primitive to execute."); @@ -1423,7 +1425,7 @@ void RNN::execute(dnnl::stream strm) { execPtr->exec(args, strm); } -void RNN::executeDynamicImpl(dnnl::stream strm) { +void RNN::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } @@ -1434,11 +1436,11 @@ void RNN::cleanup() { m_initial_weights[2].reset(); } - for (auto it : fusedWith) { + for (const auto& it : fusedWith) { it->cleanup(); } - for (auto it : mergedWith) { + for (const auto& it : mergedWith) { it->cleanup(); } } diff --git a/src/plugins/intel_cpu/src/nodes/rnn.h b/src/plugins/intel_cpu/src/nodes/rnn.h index 7ad53dca6d0e25..f714ba474a55e7 100644 --- a/src/plugins/intel_cpu/src/nodes/rnn.h +++ b/src/plugins/intel_cpu/src/nodes/rnn.h @@ -14,7 +14,7 @@ namespace node { class RNN : public Node { public: - RNN(const std::shared_ptr& op, const GraphContext::CPtr context); + RNN(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; static bool isCell(const std::shared_ptr& op); @@ -27,7 +27,7 @@ class RNN : public Node { const std::vector& outputDesc) override; std::shared_ptr initPrimitiveAttr() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; inline bool hasNativeOrder() const { return nativeOrder; @@ -39,7 +39,7 @@ class RNN : public Node { protected: void prepareParams() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: void configurePortDataTypes(); @@ -98,10 +98,7 @@ class RNN : public Node { struct Interval { Interval() = default; - Interval(Dim min, Dim max) { - minVal = min; - maxVal = max; - } + Interval(Dim min, Dim max) : minVal(min), maxVal(max) {} bool isStatic() { return minVal == maxVal; diff --git a/src/plugins/intel_cpu/src/nodes/roi_align.cpp b/src/plugins/intel_cpu/src/nodes/roi_align.cpp index 38bf4594c4d882..8b6d388551f034 100644 --- a/src/plugins/intel_cpu/src/nodes/roi_align.cpp +++ b/src/plugins/intel_cpu/src/nodes/roi_align.cpp @@ -694,7 +694,7 @@ bool ROIAlign::isSupportedOperation(const std::shared_ptr& op, s return true; } -ROIAlign::ROIAlign(const std::shared_ptr& op, const GraphContext::CPtr context) +ROIAlign::ROIAlign(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (isSupportedOperation(op, errorMessage)) { @@ -864,7 +864,7 @@ struct ROIAlign::ROIAlignExecute { ctx.node.executeSpecified(); } }; -void ROIAlign::execute(dnnl::stream strm) { +void ROIAlign::execute(const dnnl::stream& strm) { auto inputPrec = getParentEdgeAt(0)->getMemory().getDataType(); auto outputPrec = getChildEdgeAt(0)->getMemory().getDataType(); if (!((inputPrec == dnnl_bf16 && outputPrec == dnnl_bf16) || (inputPrec == dnnl_f32 && outputPrec == dnnl_f32))) @@ -1185,7 +1185,7 @@ bool ROIAlign::needPrepareParams() const { return false; } -void ROIAlign::executeDynamicImpl(dnnl::stream strm) { +void ROIAlign::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/roi_align.h b/src/plugins/intel_cpu/src/nodes/roi_align.h index dc78a23b4c79d5..c359dd9dddf73b 100644 --- a/src/plugins/intel_cpu/src/nodes/roi_align.h +++ b/src/plugins/intel_cpu/src/nodes/roi_align.h @@ -55,16 +55,16 @@ struct jit_uni_roi_align_kernel { class ROIAlign : public Node { public: - ROIAlign(const std::shared_ptr& op, const GraphContext::CPtr context); + ROIAlign(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cpp b/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cpp index 77de786a773009..d9566c679ce438 100644 --- a/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cpp +++ b/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cpp @@ -13,7 +13,7 @@ namespace ov { namespace intel_cpu { namespace node { -ROIAlignRotated::ROIAlignRotated(const std::shared_ptr& op, const GraphContext::CPtr context) +ROIAlignRotated::ROIAlignRotated(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { const auto roiAlign = ov::as_type_ptr(op); pooledH = roiAlign->get_pooled_h(); @@ -48,7 +48,7 @@ bool ROIAlignRotated::needPrepareParams() const { return false; } -void ROIAlignRotated::executeDynamicImpl(dnnl::stream strm) { +void ROIAlignRotated::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } @@ -83,7 +83,7 @@ void ROIAlignRotated::executeImpl() { clockwiseMode); } -void ROIAlignRotated::execute(dnnl::stream) { +void ROIAlignRotated::execute(const dnnl::stream&) { const ov::element::Type type = getOriginalInputPrecisionAtPort(0); executeImpl(); diff --git a/src/plugins/intel_cpu/src/nodes/roi_align_rotated.h b/src/plugins/intel_cpu/src/nodes/roi_align_rotated.h index a73789869ff51f..1f932ea27b854e 100644 --- a/src/plugins/intel_cpu/src/nodes/roi_align_rotated.h +++ b/src/plugins/intel_cpu/src/nodes/roi_align_rotated.h @@ -12,14 +12,14 @@ namespace node { class ROIAlignRotated : public Node { public: - ROIAlignRotated(const std::shared_ptr& op, const GraphContext::CPtr context); + ROIAlignRotated(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: template diff --git a/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp b/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp index 20013eef3c6b88..db00dfe607c1c4 100644 --- a/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp +++ b/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp @@ -401,7 +401,7 @@ bool ROIPooling::isSupportedOperation(const std::shared_ptr& op, return true; } -ROIPooling::ROIPooling(const std::shared_ptr& op, const GraphContext::CPtr context) +ROIPooling::ROIPooling(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -497,7 +497,7 @@ void ROIPooling::createPrimitive() { } } -void ROIPooling::execute(dnnl::stream strm) { +void ROIPooling::execute(const dnnl::stream& strm) { if (execPtr) { const auto& srcMemory0 = getParentEdgeAt(0)->getMemory(); const auto& srcMemory1 = getParentEdgeAt(1)->getMemory(); @@ -508,7 +508,7 @@ void ROIPooling::execute(dnnl::stream strm) { } } -void ROIPooling::executeDynamicImpl(dnnl::stream strm) { +void ROIPooling::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/roi_pooling.h b/src/plugins/intel_cpu/src/nodes/roi_pooling.h index e02be525f0c34b..8852bf6c42e465 100644 --- a/src/plugins/intel_cpu/src/nodes/roi_pooling.h +++ b/src/plugins/intel_cpu/src/nodes/roi_pooling.h @@ -63,15 +63,15 @@ struct jit_uni_roi_pooling_kernel { class ROIPooling : public Node { public: - ROIPooling(const std::shared_ptr& op, const GraphContext::CPtr context); + ROIPooling(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; void prepareParams() override; private: diff --git a/src/plugins/intel_cpu/src/nodes/roll.cpp b/src/plugins/intel_cpu/src/nodes/roll.cpp index 3d6a422b634abd..858f4750463852 100644 --- a/src/plugins/intel_cpu/src/nodes/roll.cpp +++ b/src/plugins/intel_cpu/src/nodes/roll.cpp @@ -34,7 +34,7 @@ bool Roll::isSupportedOperation(const std::shared_ptr& op, std:: return true; } -Roll::Roll(const std::shared_ptr& op, const GraphContext::CPtr context) +Roll::Roll(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (isSupportedOperation(op, errorMessage)) { @@ -121,11 +121,11 @@ void Roll::prepareParams() { execPtr = std::make_shared(dataDims, shiftDims, axesDims, dstDims); } -void Roll::executeDynamicImpl(dnnl::stream strm) { - execute(std::move(strm)); +void Roll::executeDynamicImpl(const dnnl::stream& strm) { + execute(strm); } -void Roll::execute(dnnl::stream strm) { +void Roll::execute(const dnnl::stream& strm) { if (!execPtr) THROW_CPU_NODE_ERR("has no compiled executor"); diff --git a/src/plugins/intel_cpu/src/nodes/roll.h b/src/plugins/intel_cpu/src/nodes/roll.h index 35fe87994aa3e5..7d3ad9efce3d53 100644 --- a/src/plugins/intel_cpu/src/nodes/roll.h +++ b/src/plugins/intel_cpu/src/nodes/roll.h @@ -12,15 +12,15 @@ namespace node { class Roll : public Node { public: - Roll(const std::shared_ptr& op, const GraphContext::CPtr context); + Roll(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; void prepareParams() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/rope.cpp b/src/plugins/intel_cpu/src/nodes/rope.cpp index 90a9ab9d6f945f..984b35237d93ba 100644 --- a/src/plugins/intel_cpu/src/nodes/rope.cpp +++ b/src/plugins/intel_cpu/src/nodes/rope.cpp @@ -21,7 +21,7 @@ namespace ov { namespace intel_cpu { namespace node { -RoPE::RoPE(const std::shared_ptr& op, const GraphContext::CPtr context) +RoPE::RoPE(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -106,7 +106,7 @@ struct RoPE::RoPEExecutorRotateHalf : public RoPE::Executor { m_rotaryKernel = createJitKernel(jcp); } - void execute(dnnl::stream strm, + void execute(const dnnl::stream& strm, const std::vector& inputs, const std::vector& outputs) override { ov::intel_cpu::PlainTensor t_src(inputs[0]); @@ -188,7 +188,7 @@ struct RoPE::RoPEExecutorInterleaved : public RoPE::Executor { m_rotaryKernel = createJitKernel(jcp, true); } - void execute(dnnl::stream strm, + void execute(const dnnl::stream& strm, const std::vector& inputs, const std::vector& outputs) override { ov::intel_cpu::PlainTensor t_src(inputs[0]); @@ -238,7 +238,7 @@ struct RoPE::RoPEExecutorChatGLM : public RoPE::Executor { m_rotaryKernel = createJitKernel(jcp, true); } - void execute(dnnl::stream strm, + void execute(const dnnl::stream& strm, const std::vector& inputs, const std::vector& outputs) override { ov::intel_cpu::PlainTensor t_src(inputs[0]); @@ -327,7 +327,7 @@ struct RoPE::RoPEExecutorQwen : public RoPE::Executor { m_rotaryKernel = createJitKernel(jcp); } - void execute(dnnl::stream strm, + void execute(const dnnl::stream& strm, const std::vector& inputs, const std::vector& outputs) override { ov::intel_cpu::PlainTensor t_src(inputs[0]); // [batch, length, head_cnt*head_size * 3] @@ -444,7 +444,7 @@ void RoPE::initSupportedPrimitiveDescriptors() { addSupportedPrimDesc(inPortConfigs, outPortConfigs, impl_desc_type::ref_any); } -void RoPE::execute(dnnl::stream strm) { +void RoPE::execute(const dnnl::stream& strm) { std::vector inputs(getParentEdges().size()), outputs(getChildEdges().size()); for (size_t i = 0; i < inputs.size(); i++) { inputs[i] = getSrcMemoryAtPort(i); diff --git a/src/plugins/intel_cpu/src/nodes/rope.h b/src/plugins/intel_cpu/src/nodes/rope.h index 9bb910f29e4236..6082301f6bd27e 100644 --- a/src/plugins/intel_cpu/src/nodes/rope.h +++ b/src/plugins/intel_cpu/src/nodes/rope.h @@ -13,7 +13,7 @@ namespace node { class RoPE : public Node { public: - RoPE(const std::shared_ptr& op, const GraphContext::CPtr context); + RoPE(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override {} bool created() const override { @@ -22,16 +22,16 @@ class RoPE : public Node { bool needPrepareParams() const override { return false; }; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; private: struct Executor { - virtual void execute(dnnl::stream strm, + virtual void execute(const dnnl::stream& strm, const std::vector& inputs, const std::vector& outputs) = 0; virtual ~Executor() = default; diff --git a/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp b/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp index 6b4308c6b807d4..e6455505e55532 100644 --- a/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp +++ b/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include "kernels/scaled_attn/attn_memcpy.hpp" @@ -73,7 +74,7 @@ template struct MHAKernel { const GraphContext::CPtr context; MHAKernel() = delete; - explicit MHAKernel(GraphContext::CPtr ctx) : context(ctx) {} + explicit MHAKernel(GraphContext::CPtr ctx) : context(std::move(ctx)) {} template float dot_product(const D* a, const D* b, int len, int stride_b = 1) { @@ -110,7 +111,7 @@ struct MHAKernel { PlainTensor causal_mask; bool select_nfltmax_at_0 = false; // set attn_score to -FLT_MAX when causal_mask[...] equal to this - void set_causal_mask(PlainTensor mask, bool _select_nfltmax_at_0) { + void set_causal_mask(const PlainTensor& mask, bool _select_nfltmax_at_0) { causal_mask = mask; select_nfltmax_at_0 = _select_nfltmax_at_0; } @@ -121,7 +122,7 @@ struct MHAKernel { // present_value [B, H, kv_len, S] // attention_mask [B, 1, q_len, kv_len] // output_emb [B, q_len, H*S] - void operator()(dnnl::stream strm, + void operator()(const dnnl::stream& strm, PlainTensor& query, PlainTensor& present_key, PlainTensor& present_value, @@ -252,7 +253,7 @@ struct MHAKernel { std::shared_ptr wv_gemm_ptr = nullptr; MHAKernel() = delete; - explicit MHAKernel(GraphContext::CPtr ctx) : context(ctx) {} + explicit MHAKernel(GraphContext::CPtr ctx) : context(std::move(ctx)) {} dnnl::memory::dims make_dnnl_dims(const std::vector& dims) { dnnl::memory::dims dnnl_dims(dims.size()); @@ -261,7 +262,7 @@ struct MHAKernel { return dnnl_dims; } - void prepare_brgemm_prim(dnnl::stream strm, + void prepare_brgemm_prim(const dnnl::stream& strm, PlainTensor& query, PlainTensor& present_key, PlainTensor& present_value, @@ -436,14 +437,13 @@ struct MHAKernel { } T* v_ptr = is_xf16 ? &wv_scratch_b.at({b, h / h_each_group_len, 0}) : &present_value.at({b, h / h_each_group_len, 0, 0}); - wv_gemm_ptr->executeGemm(m_cntget_scratch_a_size()> 0 - ? &wv_scratch_a.at({tid, 0}) - : nullptr); + const bool is_m_tail = m_cnt < m_block_size; + wv_gemm_ptr->executeGemm(is_m_tail, + w_ptr, + v_ptr, + fp32_out_ptr, + wsp.data() + tid * wsp_size_per_thread, + wv_gemm_ptr->get_scratch_a_size() > 0 ? &wv_scratch_a.at({tid, 0}) : nullptr); if (is_xf16) { if (has_out_transpose) { attn_memcpy2d_kernel(&fp32_out.at({b, m_start, h, 0}), @@ -474,7 +474,7 @@ struct MHAKernel { PlainTensor causal_mask; bool select_nfltmax_at_0 = false; // set attn_score to -FLT_MAX when causal_mask[...] equal to this - void set_causal_mask(PlainTensor mask, bool _select_nfltmax_at_0) { + void set_causal_mask(const PlainTensor& mask, bool _select_nfltmax_at_0) { causal_mask = mask; select_nfltmax_at_0 = _select_nfltmax_at_0; } @@ -521,15 +521,15 @@ struct MHAKernel { ov::element::Type precision; MHAKernel() = delete; - explicit MHAKernel(GraphContext::CPtr ctx) : context(ctx) { - m_block_size = 512; - select_nfltmax_at_0 = false; - precision = ov::element::from(); - } + explicit MHAKernel(GraphContext::CPtr ctx) + : context(std::move(ctx)), + m_block_size(512), + precision(ov::element::from()), + select_nfltmax_at_0(false) {} PlainTensor causal_mask; bool select_nfltmax_at_0 = false; // set attn_score to -FLT_MAX when causal_mask[...] equal to this - void set_causal_mask(PlainTensor mask, bool _select_nfltmax_at_0) { + void set_causal_mask(const PlainTensor& mask, bool _select_nfltmax_at_0) { causal_mask = mask; select_nfltmax_at_0 = _select_nfltmax_at_0; } @@ -541,7 +541,7 @@ struct MHAKernel { // attention_mask [B, 1, q_len, kv_len] // alibi // output_emb [B, L1, H*S] - void operator()(dnnl::stream strm, + void operator()(const dnnl::stream& strm, PlainTensor& query, PlainTensor& present_key, PlainTensor& present_value, @@ -668,16 +668,17 @@ struct MHAKernel { size_t m_threads_num = 0lu; MHAKernel() = delete; - explicit MHAKernel(GraphContext::CPtr ctx) : context(ctx) { - m_block_size = 4; - select_nfltmax_at_0 = false; - m_threads_num = parallel_get_max_threads(); + explicit MHAKernel(GraphContext::CPtr ctx) + : context(std::move(ctx)), + m_block_size(4), + m_threads_num(parallel_get_max_threads()), + select_nfltmax_at_0(false) { qk_buffers.resize(m_threads_num); } PlainTensor causal_mask; bool select_nfltmax_at_0 = false; // set attn_score to -FLT_MAX when causal_mask[...] equal to this - void set_causal_mask(PlainTensor mask, bool _select_nfltmax_at_0) { + void set_causal_mask(const PlainTensor& mask, bool _select_nfltmax_at_0) { causal_mask = mask; select_nfltmax_at_0 = _select_nfltmax_at_0; } @@ -689,7 +690,7 @@ struct MHAKernel { // attention_mask [B, 1, q_len, kv_len] // alibi // output_emb [B, L1, H*S] - void operator()(dnnl::stream strm, + void operator()(const dnnl::stream& strm, PlainTensor& query, PlainTensor& present_key, PlainTensor& present_value, @@ -887,16 +888,16 @@ struct ScaledDotProductAttention::AttentionExecutor : public ScaledDotProductAtt MHAKernel kernel; MHASingleToken kernel_single_token; - AttentionExecutor(GraphContext::CPtr ctx) : context(ctx), kernel(context) {} + AttentionExecutor(GraphContext::CPtr ctx) : context(std::move(ctx)), kernel(context) {} - void prepare_attn_mask(MemoryPtr attn_input) { + void prepare_attn_mask(const MemoryPtr& attn_input) { attn_buf.resize(attn_input->getStaticDims()); auto p = attn_input->getDataAs(); for (size_t i = 0; i < attn_input->getSize(); i++) attn_buf.ptr()[i] = p[i] ? 0.0f : -FLT_MAX; } - void execute(dnnl::stream strm, + void execute(const dnnl::stream& strm, const Config& config, const std::vector& inputs, const MemoryPtr output, @@ -1055,7 +1056,7 @@ struct ScaledDotProductAttention::AttentionExecutor : public ScaledDotProductAtt }; ScaledDotProductAttention::ScaledDotProductAttention(const std::shared_ptr& op, - const GraphContext::CPtr context) + const GraphContext::CPtr& context) : Node(op, context, SDPAShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -1216,7 +1217,7 @@ void ScaledDotProductAttention::createPrimitive() { m_executor = result.first; } -void ScaledDotProductAttention::execute(dnnl::stream strm) { +void ScaledDotProductAttention::execute(const dnnl::stream& strm) { auto orginSDPInputNumber = getOriginalInputsNumber() - (m_config.config.fuse_concat ? 3 : 0); std::vector inputs(orginSDPInputNumber); auto output = getDstMemoryAtPort(0); diff --git a/src/plugins/intel_cpu/src/nodes/scaled_attn.h b/src/plugins/intel_cpu/src/nodes/scaled_attn.h index c3636ab6626519..aeabee681599b8 100644 --- a/src/plugins/intel_cpu/src/nodes/scaled_attn.h +++ b/src/plugins/intel_cpu/src/nodes/scaled_attn.h @@ -15,7 +15,7 @@ namespace node { class ScaledDotProductAttention : public Node { public: - ScaledDotProductAttention(const std::shared_ptr& op, const GraphContext::CPtr context); + ScaledDotProductAttention(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override {} bool created() const override { @@ -28,11 +28,11 @@ class ScaledDotProductAttention : public Node { bool needPrepareParams() const override { return false; } - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; void createPrimitive() override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; @@ -65,7 +65,7 @@ class ScaledDotProductAttention : public Node { }; struct Executor { - virtual void execute(dnnl::stream strm, + virtual void execute(const dnnl::stream& strm, const Config& config, const std::vector& inputs, const MemoryPtr output, diff --git a/src/plugins/intel_cpu/src/nodes/scatter_update.cpp b/src/plugins/intel_cpu/src/nodes/scatter_update.cpp index 3225d9d8f8da96..c8bd8fc783a96b 100644 --- a/src/plugins/intel_cpu/src/nodes/scatter_update.cpp +++ b/src/plugins/intel_cpu/src/nodes/scatter_update.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include "common/cpu_memcpy.h" @@ -73,7 +74,7 @@ bool ScatterUpdate::isExecutable() const { return !isInputTensorAtPortEmpty(DATA_ID); } -ScatterUpdate::ScatterUpdate(const std::shared_ptr& op, const GraphContext::CPtr context) +ScatterUpdate::ScatterUpdate(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)), dataSize(0lu), indicesSize(0lu), @@ -312,7 +313,7 @@ bool ScatterUpdate::needPrepareParams() const { return false; } -void ScatterUpdate::executeDynamicImpl(dnnl::stream strm) { +void ScatterUpdate::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } @@ -371,8 +372,8 @@ static inline void getCoordinate(VectorDims& coordinate, size_t offset, const Ve } struct TensorIterator { - TensorIterator(const VectorDims& squashed_shape, const int64_t squashed_axis) - : m_squashed_shape(squashed_shape), + TensorIterator(VectorDims squashed_shape, const int64_t squashed_axis) + : m_squashed_shape(std::move(squashed_shape)), m_squashed_axis(squashed_axis) { OPENVINO_ASSERT(m_squashed_shape[m_squashed_axis] == 1); } @@ -824,7 +825,7 @@ void ScatterUpdate::scatterElementsUpdate(const MemoryPtr& dstMemPtr, OV_CASE(ov::element::u8, uint8_t)); } -void ScatterUpdate::execute(dnnl::stream strm) { +void ScatterUpdate::execute(const dnnl::stream& strm) { auto srcMemPtr = getSrcMemoryAtPort(DATA_ID); auto dstMemPtr = getDstMemoryAtPort(0); auto indicesMemPtr = getSrcMemoryAtPort(INDICES_ID); diff --git a/src/plugins/intel_cpu/src/nodes/scatter_update.h b/src/plugins/intel_cpu/src/nodes/scatter_update.h index 4dc9ed1be59a63..df3827c2fa4f65 100644 --- a/src/plugins/intel_cpu/src/nodes/scatter_update.h +++ b/src/plugins/intel_cpu/src/nodes/scatter_update.h @@ -76,18 +76,18 @@ class ReduceNone { class ScatterUpdate : public Node { public: - ScatterUpdate(const std::shared_ptr& op, const GraphContext::CPtr context); + ScatterUpdate(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; bool created() const override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool canBeInPlace() const override { return false; } bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool isExecutable() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/search_sorted.cpp b/src/plugins/intel_cpu/src/nodes/search_sorted.cpp index 860964fdddf340..2254dc46391073 100644 --- a/src/plugins/intel_cpu/src/nodes/search_sorted.cpp +++ b/src/plugins/intel_cpu/src/nodes/search_sorted.cpp @@ -10,7 +10,7 @@ namespace ov { namespace intel_cpu { namespace node { -SearchSorted::SearchSorted(const std::shared_ptr& op, const GraphContext::CPtr context) +SearchSorted::SearchSorted(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -70,7 +70,7 @@ bool SearchSorted::needPrepareParams() const { return false; } -void SearchSorted::executeDynamicImpl(dnnl::stream strm) { +void SearchSorted::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } @@ -99,7 +99,7 @@ struct SearchSorted::SearchSortedExecute { ctx.node.executeImpl(); } }; -void SearchSorted::execute(dnnl::stream strm) { +void SearchSorted::execute(const dnnl::stream& strm) { auto inputPrecision = getParentEdgeAt(0)->getMemory().getDesc().getPrecision(); auto outputPrecision = getChildEdgeAt(0)->getMemory().getDesc().getPrecision(); diff --git a/src/plugins/intel_cpu/src/nodes/search_sorted.h b/src/plugins/intel_cpu/src/nodes/search_sorted.h index 6f90c20355d911..60c81c2b1f566d 100644 --- a/src/plugins/intel_cpu/src/nodes/search_sorted.h +++ b/src/plugins/intel_cpu/src/nodes/search_sorted.h @@ -12,15 +12,15 @@ namespace node { class SearchSorted : public Node { public: - SearchSorted(const std::shared_ptr& op, const GraphContext::CPtr context); + SearchSorted(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: template diff --git a/src/plugins/intel_cpu/src/nodes/shapeof.cpp b/src/plugins/intel_cpu/src/nodes/shapeof.cpp index 43f30b680c880c..abd55142b098c2 100644 --- a/src/plugins/intel_cpu/src/nodes/shapeof.cpp +++ b/src/plugins/intel_cpu/src/nodes/shapeof.cpp @@ -25,7 +25,7 @@ bool ShapeOf::isSupportedOperation(const std::shared_ptr& op, st return true; } -ShapeOf::ShapeOf(const std::shared_ptr& op, const GraphContext::CPtr context) +ShapeOf::ShapeOf(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, ShapeOfShapeInferFactory()) { std::string errorMessage; if (isSupportedOperation(op, errorMessage)) { @@ -82,7 +82,7 @@ bool ShapeOf::isExecutable() const { return true; } -void ShapeOf::execute(dnnl::stream strm) { +void ShapeOf::execute(const dnnl::stream& strm) { auto inPtr = getSrcMemoryAtPort(0); auto outPtr = getDstMemoryAtPort(0); auto&& inDims = inPtr->getStaticDims(); diff --git a/src/plugins/intel_cpu/src/nodes/shapeof.h b/src/plugins/intel_cpu/src/nodes/shapeof.h index 7b2ebb733e99a9..e625af7bfb6a0c 100644 --- a/src/plugins/intel_cpu/src/nodes/shapeof.h +++ b/src/plugins/intel_cpu/src/nodes/shapeof.h @@ -18,17 +18,17 @@ namespace node { class ShapeOf : public Node { public: - ShapeOf(const std::shared_ptr& op, const GraphContext::CPtr context); + ShapeOf(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void initOptimalPrimitiveDescriptor() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override { return false; }; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp b/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp index ee66dce2744ff1..f73b920345c46a 100644 --- a/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp +++ b/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp @@ -64,7 +64,7 @@ bool ShuffleChannels::isSupportedOperation(const std::shared_ptr return true; } -ShuffleChannels::ShuffleChannels(const std::shared_ptr& op, const GraphContext::CPtr context) +ShuffleChannels::ShuffleChannels(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -277,11 +277,11 @@ void ShuffleChannels::ShuffleChannelsExecutor::exec(const uint8_t* srcData, uint permuteKernel->execute(srcData, dstData); } -void ShuffleChannels::executeDynamicImpl(dnnl::stream strm) { +void ShuffleChannels::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void ShuffleChannels::execute(dnnl::stream strm) { +void ShuffleChannels::execute(const dnnl::stream& strm) { if (!execPtr) THROW_SHCH_ERROR("doesn't have a compiled executor."); diff --git a/src/plugins/intel_cpu/src/nodes/shuffle_channels.h b/src/plugins/intel_cpu/src/nodes/shuffle_channels.h index a7b2f768c89ed3..da6be0ad18c8a0 100644 --- a/src/plugins/intel_cpu/src/nodes/shuffle_channels.h +++ b/src/plugins/intel_cpu/src/nodes/shuffle_channels.h @@ -13,14 +13,14 @@ namespace node { class ShuffleChannels : public Node { public: - ShuffleChannels(const std::shared_ptr& op, const GraphContext::CPtr context); + ShuffleChannels(const std::shared_ptr& op, const GraphContext::CPtr& context); ~ShuffleChannels() override = default; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; void prepareParams() override; @@ -38,7 +38,7 @@ class ShuffleChannels : public Node { }; protected: - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: ShuffleChannelsAttributes attrs; diff --git a/src/plugins/intel_cpu/src/nodes/softmax.cpp b/src/plugins/intel_cpu/src/nodes/softmax.cpp index 2d3b0a98fee9a9..7dee3ae7aad8b6 100644 --- a/src/plugins/intel_cpu/src/nodes/softmax.cpp +++ b/src/plugins/intel_cpu/src/nodes/softmax.cpp @@ -68,7 +68,7 @@ bool SoftMax::isSupportedOperation(const std::shared_ptr& op, st return true; } -SoftMax::SoftMax(const std::shared_ptr& op, const GraphContext::CPtr context) +SoftMax::SoftMax(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, PassThroughShapeInferFactory()) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -223,7 +223,7 @@ void SoftMax::prepareParams() { #endif } -void SoftMax::execute(dnnl::stream strm) { +void SoftMax::execute(const dnnl::stream& strm) { if (execPtr) { execPtr->exec(primArgs, strm); } else { @@ -231,7 +231,7 @@ void SoftMax::execute(dnnl::stream strm) { } } -void SoftMax::executeDynamicImpl(dnnl::stream strm) { +void SoftMax::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/softmax.h b/src/plugins/intel_cpu/src/nodes/softmax.h index daa285843d77e1..0ce000d38dda00 100644 --- a/src/plugins/intel_cpu/src/nodes/softmax.h +++ b/src/plugins/intel_cpu/src/nodes/softmax.h @@ -13,7 +13,7 @@ namespace node { class SoftMax : public Node { public: - SoftMax(const std::shared_ptr& op, const GraphContext::CPtr context); + SoftMax(const std::shared_ptr& op, const GraphContext::CPtr& context); void initOptimalPrimitiveDescriptor() override; void createDescriptor(const std::vector& inputDesc, @@ -22,8 +22,8 @@ class SoftMax : public Node { bool created() const override; AttrPtr initPrimitiveAttr() override; void prepareParams() override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/space_to_batch.cpp b/src/plugins/intel_cpu/src/nodes/space_to_batch.cpp index c01cd65a9407bf..58d5879cca9e1a 100644 --- a/src/plugins/intel_cpu/src/nodes/space_to_batch.cpp +++ b/src/plugins/intel_cpu/src/nodes/space_to_batch.cpp @@ -25,7 +25,7 @@ bool SpaceToBatch::isSupportedOperation(const std::shared_ptr& o return true; } -SpaceToBatch::SpaceToBatch(const std::shared_ptr& op, const GraphContext::CPtr context) +SpaceToBatch::SpaceToBatch(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -239,11 +239,11 @@ void SpaceToBatch::SpaceToBatchKernel() { }); } -void SpaceToBatch::executeDynamicImpl(dnnl::stream strm) { +void SpaceToBatch::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void SpaceToBatch::execute(dnnl::stream strm) { +void SpaceToBatch::execute(const dnnl::stream& strm) { switch (getParentEdgeAt(0)->getMemory().getDesc().getPrecision().size()) { case 1: SpaceToBatchKernel::value_type>(); diff --git a/src/plugins/intel_cpu/src/nodes/space_to_batch.h b/src/plugins/intel_cpu/src/nodes/space_to_batch.h index fec4423a91a1db..e8787c06b75fc4 100644 --- a/src/plugins/intel_cpu/src/nodes/space_to_batch.h +++ b/src/plugins/intel_cpu/src/nodes/space_to_batch.h @@ -16,11 +16,11 @@ namespace node { class SpaceToBatch : public Node { public: - SpaceToBatch(const std::shared_ptr& op, const GraphContext::CPtr context); + SpaceToBatch(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override { @@ -29,7 +29,7 @@ class SpaceToBatch : public Node { bool needShapeInfer() const override { return true; }; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; diff --git a/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp b/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp index 7e4b4c4b1e307f..859944161d48b9 100644 --- a/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp +++ b/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp @@ -69,7 +69,7 @@ bool SpaceToDepth::isSupportedOperation(const std::shared_ptr& o return true; } -SpaceToDepth::SpaceToDepth(const std::shared_ptr& op, const GraphContext::CPtr context) +SpaceToDepth::SpaceToDepth(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -299,7 +299,7 @@ void SpaceToDepth::SpaceToDepthExecutor::exec(const uint8_t* srcData, uint8_t* d permuteKernel->execute(srcData, dstData, MB); } -void SpaceToDepth::execute(dnnl::stream strm) { +void SpaceToDepth::execute(const dnnl::stream& strm) { if (!execPtr) { THROW_ERROR("doesn't have a compiled executor."); } @@ -309,7 +309,7 @@ void SpaceToDepth::execute(dnnl::stream strm) { execPtr->exec(srcData, dstData, MB); } -void SpaceToDepth::executeDynamicImpl(dnnl::stream strm) { +void SpaceToDepth::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/space_to_depth.h b/src/plugins/intel_cpu/src/nodes/space_to_depth.h index 51091a07721151..5f628a2a3b4bd3 100644 --- a/src/plugins/intel_cpu/src/nodes/space_to_depth.h +++ b/src/plugins/intel_cpu/src/nodes/space_to_depth.h @@ -13,13 +13,13 @@ namespace node { class SpaceToDepth : public Node { public: - SpaceToDepth(const std::shared_ptr& op, const GraphContext::CPtr context); + SpaceToDepth(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; void prepareParams() override; @@ -40,7 +40,7 @@ class SpaceToDepth : public Node { }; protected: - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: SpaceToDepthAttrs attrs; diff --git a/src/plugins/intel_cpu/src/nodes/split.cpp b/src/plugins/intel_cpu/src/nodes/split.cpp index 7722da89f2d428..59ab2776ba884b 100644 --- a/src/plugins/intel_cpu/src/nodes/split.cpp +++ b/src/plugins/intel_cpu/src/nodes/split.cpp @@ -50,7 +50,7 @@ bool Split::isSupportedOperation(const std::shared_ptr& op, std: return true; } -Split::Split(const std::shared_ptr& op, const GraphContext::CPtr context) +Split::Split(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -295,7 +295,7 @@ bool Split::isExecutable() const { return !isInPlace() && !isInputTensorAtPortEmpty(0); } -void Split::execute(dnnl::stream strm) { +void Split::execute(const dnnl::stream& strm) { if (isInPlace()) { return; } @@ -493,7 +493,7 @@ std::vector Split::getRawDstMemPtrs() const { return result; } -Split::SplitOptimizedExecutor::SplitOptimizedExecutor(BlockedMemoryDescCPtr inDesc, +Split::SplitOptimizedExecutor::SplitOptimizedExecutor(const BlockedMemoryDescCPtr& inDesc, const std::vector& outDescs, const size_t axis) { // find axis order position diff --git a/src/plugins/intel_cpu/src/nodes/split.h b/src/plugins/intel_cpu/src/nodes/split.h index 858739c6a4df65..a93e439d7fd5f6 100644 --- a/src/plugins/intel_cpu/src/nodes/split.h +++ b/src/plugins/intel_cpu/src/nodes/split.h @@ -12,13 +12,13 @@ namespace node { class Split : public Node { public: - Split(const std::shared_ptr& op, const GraphContext::CPtr context); + Split(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void selectOptimalPrimitiveDescriptor() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; void initOptimalPrimitiveDescriptor() override; @@ -29,7 +29,7 @@ class Split : public Node { bool needShapeInfer() const override; void prepareParams() override; void createPrimitive() override; - void executeDynamicImpl(dnnl::stream strm) override { + void executeDynamicImpl(const dnnl::stream& strm) override { execute(strm); } void resolveInPlaceEdges(Edge::LOOK look) override; @@ -43,7 +43,7 @@ class Split : public Node { struct SplitOptimizedExecutor : public SplitExecutor { public: - SplitOptimizedExecutor(BlockedMemoryDescCPtr inDesc, + SplitOptimizedExecutor(const BlockedMemoryDescCPtr& inDesc, const std::vector& outDescs, const size_t axis); void exec(const uint8_t* srcData, const std::vector& dstRawMemPtrs) override; diff --git a/src/plugins/intel_cpu/src/nodes/stft.cpp b/src/plugins/intel_cpu/src/nodes/stft.cpp index 699895fcece850..21a34585c45dda 100644 --- a/src/plugins/intel_cpu/src/nodes/stft.cpp +++ b/src/plugins/intel_cpu/src/nodes/stft.cpp @@ -100,7 +100,7 @@ static void transpose_out4d(const uint8_t* in, } } // namespace -void STFT::execute(dnnl::stream strm) { +void STFT::execute(const dnnl::stream& strm) { const float* signal = getSrcDataAtPortAs(DATA_IDX); const float* window = getSrcDataAtPortAs(WINDOW_IDX); float* rdft_result = getDstDataAtPortAs(0); @@ -168,7 +168,7 @@ void STFT::execute(dnnl::stream strm) { } } -void STFT::executeDynamicImpl(dnnl::stream strm) { +void STFT::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/stft.h b/src/plugins/intel_cpu/src/nodes/stft.h index cd87c997c59a0f..4b822241c2c24b 100644 --- a/src/plugins/intel_cpu/src/nodes/stft.h +++ b/src/plugins/intel_cpu/src/nodes/stft.h @@ -24,8 +24,8 @@ class STFT : public Node { bool needPrepareParams() const override; void createPrimitive() override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool canBeInPlace() const override { return false; } diff --git a/src/plugins/intel_cpu/src/nodes/strided_slice.cpp b/src/plugins/intel_cpu/src/nodes/strided_slice.cpp index 542f8897c2d625..f2b1a90e7b4c60 100644 --- a/src/plugins/intel_cpu/src/nodes/strided_slice.cpp +++ b/src/plugins/intel_cpu/src/nodes/strided_slice.cpp @@ -4,6 +4,7 @@ #include "strided_slice.h" +#include #include #include "common/cpu_memcpy.h" @@ -33,7 +34,7 @@ bool StridedSlice::isSupportedOperation(const std::shared_ptr& o return true; } -StridedSlice::StridedSlice(const std::shared_ptr& op, const GraphContext::CPtr context) +StridedSlice::StridedSlice(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, StridedSliceShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -192,6 +193,7 @@ static void addHiddenDims(StridedSlice::StridedSliceAttributes& attrs, auto addHiddenDims = [&](std::vector& data, const int bit = 0) { std::vector temp; + temp.reserve(attrs.ellipsisPos1); for (int i = 0; i < attrs.ellipsisPos1; i++) temp.push_back(data[i]); for (size_t i = attrs.ellipsisPos1; i < ellipsisPos2 + 1; i++) @@ -340,14 +342,14 @@ bool StridedSlice::needShapeInfer() const { return Node::inputShapesModified() || shapeHasDataDependency; } -void StridedSlice::execute(dnnl::stream strm) { +void StridedSlice::execute(const dnnl::stream& strm) { if (!execPtr) THROW_CPU_NODE_ERR("doesn't have compiled executor!"); execPtr->exec(srcMemory, dstMemory); } -void StridedSlice::executeDynamicImpl(dnnl::stream strm) { +void StridedSlice::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } @@ -363,7 +365,6 @@ StridedSlice::StridedSliceCommonExecutor::StridedSliceCommonExecutor(const Strid dimsNormalization(); dimsGluing(); indicesCalculation(); - m_threads_num = parallel_get_max_threads(); } void StridedSlice::StridedSliceCommonExecutor::orderParametersByLayouts( @@ -382,7 +383,7 @@ void StridedSlice::StridedSliceCommonExecutor::orderParametersByLayouts( if (isBlockedLayout) { params.attrs.begin[1] = params.attrs.begin[1] / blk; - params.attrs.end[1] = ceil(params.attrs.end[1] / static_cast(blk)); + params.attrs.end[1] = std::ceil(params.attrs.end[1] / static_cast(blk)); params.attrs.begin.push_back(0); params.attrs.end.push_back(0); params.attrs.stride.push_back(1); @@ -573,7 +574,7 @@ void StridedSlice::StridedSliceCommonExecutor::dimsNormalization() { strideTemp.push_back(params.attrs.stride[axis]); newSrcDims.push_back(params.srcBlockedDims[srcIdx]); newDstDims.push_back( - ceil(static_cast(abs(e - b) + 1) / static_cast(abs(strideTemp.back())))); + std::ceil(static_cast(abs(e - b) + 1) / static_cast(abs(strideTemp.back())))); srcIdx++; } diff --git a/src/plugins/intel_cpu/src/nodes/strided_slice.h b/src/plugins/intel_cpu/src/nodes/strided_slice.h index b21e99c7efeb2e..ca755a62a7bdf5 100644 --- a/src/plugins/intel_cpu/src/nodes/strided_slice.h +++ b/src/plugins/intel_cpu/src/nodes/strided_slice.h @@ -15,13 +15,13 @@ namespace node { class StridedSlice : public Node { public: - StridedSlice(const std::shared_ptr& op, const GraphContext::CPtr context); + StridedSlice(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool canBeInPlace() const override { return false; @@ -65,7 +65,7 @@ class StridedSlice : public Node { protected: bool needPrepareParams() const override; void prepareParams() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: class StridedSliceExecutor { diff --git a/src/plugins/intel_cpu/src/nodes/string_tensor_pack.cpp b/src/plugins/intel_cpu/src/nodes/string_tensor_pack.cpp index c3634b67399e8b..2f7db689e7a17f 100644 --- a/src/plugins/intel_cpu/src/nodes/string_tensor_pack.cpp +++ b/src/plugins/intel_cpu/src/nodes/string_tensor_pack.cpp @@ -10,7 +10,7 @@ namespace ov { namespace intel_cpu { namespace node { -StringTensorPack::StringTensorPack(const std::shared_ptr& op, const GraphContext::CPtr context) +StringTensorPack::StringTensorPack(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -54,8 +54,8 @@ bool StringTensorPack::needPrepareParams() const { return false; } -void StringTensorPack::executeDynamicImpl(dnnl::stream strm) { - execute(std::move(strm)); +void StringTensorPack::executeDynamicImpl(const dnnl::stream& strm) { + execute(strm); } template @@ -85,7 +85,7 @@ bool StringTensorPack::isExecutable() const { return !(isInputTensorAtPortEmpty(0) || isInputTensorAtPortEmpty(1)); } -void StringTensorPack::execute(dnnl::stream strm) { +void StringTensorPack::execute(const dnnl::stream& strm) { auto indicesPrecision = getParentEdgeAt(0)->getMemory().getDesc().getPrecision(); StringTensorPackContext ctx = {*this}; OV_SWITCH(intel_cpu, diff --git a/src/plugins/intel_cpu/src/nodes/string_tensor_pack.h b/src/plugins/intel_cpu/src/nodes/string_tensor_pack.h index 952093eab53e21..52aacc1c4ecce0 100644 --- a/src/plugins/intel_cpu/src/nodes/string_tensor_pack.h +++ b/src/plugins/intel_cpu/src/nodes/string_tensor_pack.h @@ -12,16 +12,16 @@ namespace node { class StringTensorPack : public Node { public: - StringTensorPack(const std::shared_ptr& op, const GraphContext::CPtr context); + StringTensorPack(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; bool isExecutable() const override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: template diff --git a/src/plugins/intel_cpu/src/nodes/string_tensor_unpack.cpp b/src/plugins/intel_cpu/src/nodes/string_tensor_unpack.cpp index bcdbd54cb7c68a..9bfb7544470686 100644 --- a/src/plugins/intel_cpu/src/nodes/string_tensor_unpack.cpp +++ b/src/plugins/intel_cpu/src/nodes/string_tensor_unpack.cpp @@ -11,7 +11,7 @@ namespace ov { namespace intel_cpu { namespace node { -StringTensorUnpack::StringTensorUnpack(const std::shared_ptr& op, const GraphContext::CPtr context) +StringTensorUnpack::StringTensorUnpack(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, InternalDynShapeInferFactory()) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -54,7 +54,7 @@ bool StringTensorUnpack::needPrepareParams() const { return false; } -void StringTensorUnpack::executeDynamicImpl(dnnl::stream strm) { +void StringTensorUnpack::executeDynamicImpl(const dnnl::stream& strm) { const auto& srcMemory = getSrcMemoryAtPort(0); const auto& srcDataDims = srcMemory->getStaticDims(); const auto& srcData = srcMemory->getDataAs(); @@ -64,10 +64,10 @@ void StringTensorUnpack::executeDynamicImpl(dnnl::stream strm) { totalCharLength += srcData[i].length(); } redefineOutputMemory({srcDataDims, srcDataDims, {totalCharLength}}); - execute(std::move(strm)); + execute(strm); } -void StringTensorUnpack::execute(dnnl::stream strm) { +void StringTensorUnpack::execute(const dnnl::stream& strm) { const auto stringCount = ov::shape_size(getSrcMemoryAtPort(0)->getStaticDims()); ov::reference::string_tensor_unpack(getSrcDataAtPortAs(0), getDstDataAtPortAs(0), diff --git a/src/plugins/intel_cpu/src/nodes/string_tensor_unpack.h b/src/plugins/intel_cpu/src/nodes/string_tensor_unpack.h index 34bf342eb71a25..3edadccb67c82c 100644 --- a/src/plugins/intel_cpu/src/nodes/string_tensor_unpack.h +++ b/src/plugins/intel_cpu/src/nodes/string_tensor_unpack.h @@ -12,15 +12,15 @@ namespace node { class StringTensorUnpack : public Node { public: - StringTensorUnpack(const std::shared_ptr& op, const GraphContext::CPtr context); + StringTensorUnpack(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool needPrepareParams() const override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; }; } // namespace node diff --git a/src/plugins/intel_cpu/src/nodes/subgraph.cpp b/src/plugins/intel_cpu/src/nodes/subgraph.cpp index f69041fdf45b7c..43a005b27cb450 100644 --- a/src/plugins/intel_cpu/src/nodes/subgraph.cpp +++ b/src/plugins/intel_cpu/src/nodes/subgraph.cpp @@ -44,6 +44,7 @@ #include #include +#include #include #include "utils/cpu_utils.hpp" @@ -67,9 +68,9 @@ namespace { #if defined(OPENVINO_ARCH_X86_64) || defined(OPENVINO_ARCH_ARM64) struct SubgraphKey { SubgraphKey() = default; - SubgraphKey(const std::shared_ptr& attrs_, const std::vector& in_shapes_) - : attrs(attrs_), - in_shapes(in_shapes_) {} + SubgraphKey(std::shared_ptr attrs_, std::vector in_shapes_) + : attrs(std::move(attrs_)), + in_shapes(std::move(in_shapes_)) {} virtual ~SubgraphKey() = default; size_t hash() const { @@ -91,8 +92,8 @@ struct SubgraphKey { }; struct SubgraphCodeGeneratorKey { - SubgraphCodeGeneratorKey(const std::shared_ptr& attrs_, uint8_t mask_) - : attrs(attrs_), + SubgraphCodeGeneratorKey(std::shared_ptr attrs_, uint8_t mask_) + : attrs(std::move(attrs_)), broadcasting_mask(mask_) {} size_t hash() const { @@ -142,15 +143,19 @@ struct SubgraphShapeInferResult { } // namespace -Subgraph::Subgraph(const std::shared_ptr& op, const GraphContext::CPtr& context) - : Node(op, context, SnippetShapeInferFactory(op)), - subgraph_attrs(std::make_shared()) { +static _ov_dnnl_cpu_isa getHostIsa() { #if defined(OPENVINO_ARCH_ARM64) - host_isa = dnnl::impl::cpu::aarch64::asimd; + return dnnl::impl::cpu::aarch64::asimd; #else - host_isa = dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx512_core) ? dnnl::impl::cpu::x64::avx512_core - : dnnl::impl::cpu::x64::avx2; + return dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx512_core) ? dnnl::impl::cpu::x64::avx512_core + : dnnl::impl::cpu::x64::avx2; #endif +} + +Subgraph::Subgraph(const std::shared_ptr& op, const GraphContext::CPtr& context) + : Node(op, context, SnippetShapeInferFactory(op)), + host_isa(getHostIsa()), + subgraph_attrs(std::make_shared()) { const auto& tmp_snippet = ov::as_type_ptr(op); OPENVINO_ASSERT(tmp_snippet, "Attempt to create Subgraph node from an invalid op type"); subgraph_attrs->snippet = tmp_snippet->clone(); @@ -709,12 +714,12 @@ bool Subgraph::created() const { return getType() == Type::Subgraph; } -void Subgraph::execute(dnnl::stream strm) { +void Subgraph::execute(const dnnl::stream& strm) { OPENVINO_ASSERT(execPtr, "Can't execute Subgraph node. Primitive didn't created"); execPtr->execute(strm, srcMemPtrs, dstMemPtrs); } -void Subgraph::executeDynamicImpl(dnnl::stream strm) { +void Subgraph::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/subgraph.h b/src/plugins/intel_cpu/src/nodes/subgraph.h index 9e6cb3cd49a9d7..89cf6adf128393 100644 --- a/src/plugins/intel_cpu/src/nodes/subgraph.h +++ b/src/plugins/intel_cpu/src/nodes/subgraph.h @@ -34,8 +34,8 @@ class Subgraph : public Node { bool created() const override; // if generator is set, it would execute generated code otherwise it would fallback to nGraph reference - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; protected: IShapeInfer::Result shapeInfer() const override; @@ -61,11 +61,13 @@ class Subgraph : public Node { // Holds ISA version used is codeGeneration target #if defined(OPENVINO_ARCH_ARM64) - dnnl::impl::cpu::aarch64::cpu_isa_t host_isa; +# define _ov_dnnl_cpu_isa dnnl::impl::cpu::aarch64::cpu_isa_t #else - dnnl::impl::cpu::x64::cpu_isa_t host_isa; +# define _ov_dnnl_cpu_isa dnnl::impl::cpu::x64::cpu_isa_t #endif + _ov_dnnl_cpu_isa host_isa; + std::shared_ptr subgraph_attrs; // Index of Paramater -> Index of broadcastable dimension from end diff --git a/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp b/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp index 2bdda694b701ec..fbd6361eca53fc 100644 --- a/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp +++ b/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp @@ -5,6 +5,7 @@ #include "tensoriterator.h" #include +#include #include #include "common/blocked_desc_creator.h" @@ -54,7 +55,7 @@ static NodeConfig make_plain_config(const std::shared_ptr& op) { return config; } -static void redefineToMemories(const std::vector& to_mems, MemoryDescPtr new_desc) { +static void redefineToMemories(const std::vector& to_mems, const MemoryDescPtr& new_desc) { // TODO : check the entire dstMemPtrs usage considering the proper memory sharing for (size_t j = 0; j < to_mems.size(); j++) { to_mems[j]->redefineDesc(new_desc); @@ -77,7 +78,7 @@ static void nullifyUndefinedDims(VectorDims& dims) { class PortIteratorHelper : public PortMapHelper { public: - PortIteratorHelper(MultiCachePtr cache, + PortIteratorHelper(const MultiCachePtr& cache, const MemoryPtr& from, const MemoryPtr& to, bool sliced_src, @@ -127,7 +128,7 @@ class PortIteratorHelper : public PortMapHelper { getReorderPrim(cache, mem_holder_dst.get_engine(), mem_holder_src.get_desc(), mem_holder_dst.get_desc()); } - void execute(dnnl::stream strm, int iter) override { + void execute(const dnnl::stream& strm, int iter) override { OPENVINO_ASSERT(iter >= 0 && iter < iter_count); auto& chunk_mem = sliced_src ? mem_holder_src : mem_holder_dst; @@ -149,14 +150,14 @@ class PortIteratorHelper : public PortMapHelper { class BackEdgePortHelper : public PortMapHelper { public: - BackEdgePortHelper(MultiCachePtr cache, const MemoryPtr& from, const MemoryPtr& to) { + BackEdgePortHelper(const MultiCachePtr& cache, const MemoryPtr& from, const MemoryPtr& to) { mem_holder_src = from->getPrimitive(); mem_holder_dst = to->getPrimitive(); reorder = getReorderPrim(cache, mem_holder_dst.get_engine(), mem_holder_src.get_desc(), mem_holder_dst.get_desc()); } - void execute(dnnl::stream strm, int iter = -1) override { + void execute(const dnnl::stream& strm, int iter = -1) override { if (iter != 0) { reorder.execute(strm, {{DNNL_ARG_FROM, mem_holder_src}, {DNNL_ARG_TO, mem_holder_dst}}); } @@ -172,7 +173,7 @@ class IterCountPortHelper : public PortMapHelper { mem_holder_dst = to->getPrimitive(); } - void execute(dnnl::stream strm, int n_iter) override { + void execute(const dnnl::stream& strm, int n_iter) override { auto mem = mem_holder_dst; auto data_ptr = static_cast(mem.get_data_handle()); if (data_ptr == nullptr) { @@ -228,12 +229,11 @@ class staticValueCheck : public PortChecker { int value; }; -DynamicBuffer::DynamicBuffer(const MemoryPtr& from_, const std::vector& to_, const PortMap& map_rule_) - : from(from_), - to(to_), - map_rule(map_rule_) { - elem_size = DnnlExtensionUtils::sizeOfDataType(from->getDataType()); -} +DynamicBuffer::DynamicBuffer(MemoryPtr from_, std::vector to_, const PortMap& map_rule_) + : from(std::move(from_)), + to(std::move(to_)), + map_rule(map_rule_), + elem_size(DnnlExtensionUtils::sizeOfDataType(from->getDataType())) {} void DynamicBuffer::execute(const dnnl::engine& eng, const int iter) { if (from->getStaticDims()[map_rule.axis] != static_cast(std::abs(map_rule.stride))) @@ -423,7 +423,7 @@ bool TensorIterator::isSupportedOperation(const std::shared_ptr& return true; } -TensorIterator::TensorIterator(const std::shared_ptr& op, const GraphContext::CPtr context) +TensorIterator::TensorIterator(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, InternalDynShapeInferFactory()), ngraphOp(op) { std::string errorMessage; @@ -621,7 +621,7 @@ void TensorIterator::prepareParamsImpl(const bool compileStage) { } } -void TensorIterator::execute(dnnl::stream strm) { +void TensorIterator::execute(const dnnl::stream& strm) { // Special case, the subgraph is dynamic while the node has all static shapes if (runAsDynamic()) { restoreSubgraphInputByBackEdges(); @@ -657,7 +657,7 @@ void TensorIterator::execute(dnnl::stream strm) { mapper->execute(strm); } -void TensorIterator::executeDynamicImpl(dnnl::stream strm) { +void TensorIterator::executeDynamicImpl(const dnnl::stream& strm) { const auto& eng = getEngine(); sub_graph.ResetInferCount(); @@ -823,7 +823,7 @@ void TensorIterator::reshapeSubgraphInput() { } } -void TensorIterator::reshapeAndFillOutput(dnnl::stream strm) { +void TensorIterator::reshapeAndFillOutput(const dnnl::stream& strm) { for (auto map_rule : outputPortMap) { if (map_rule.axis == -1) { auto to_mems = getToMemories(this, map_rule.from); @@ -845,7 +845,7 @@ void TensorIterator::reshapeAndFillOutput(dnnl::stream strm) { } } - for (auto buffer : buffers) { + for (const auto& buffer : buffers) { buffer->transfer(this); } } diff --git a/src/plugins/intel_cpu/src/nodes/tensoriterator.h b/src/plugins/intel_cpu/src/nodes/tensoriterator.h index b5d6f178cb2b51..97399d28e788b3 100644 --- a/src/plugins/intel_cpu/src/nodes/tensoriterator.h +++ b/src/plugins/intel_cpu/src/nodes/tensoriterator.h @@ -37,7 +37,7 @@ struct PortMap { class PortMapHelper { public: virtual ~PortMapHelper() = default; - virtual void execute(dnnl::stream strm, int n_iter = -1) = 0; + virtual void execute(const dnnl::stream& strm, int n_iter = -1) = 0; protected: dnnl::primitive reorder; @@ -65,7 +65,7 @@ class PortChecker { */ class DynamicBuffer { public: - DynamicBuffer(const MemoryPtr& from_, const std::vector& to_, const PortMap& map_rule_); + DynamicBuffer(MemoryPtr from_, std::vector to_, const PortMap& map_rule_); void execute(const dnnl::engine& eng, const int iter); void transfer(const Node* node); @@ -109,14 +109,14 @@ class DynamicBuffer { class TensorIterator : public Node { public: - TensorIterator(const std::shared_ptr& op, const GraphContext::CPtr context); + TensorIterator(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void initSupportedPrimitiveDescriptors() override; void getSupportedDescriptors() override; void createPrimitive() override; bool created() const override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool isExecutable() const override { return true; } @@ -130,7 +130,7 @@ class TensorIterator : public Node { bool needPrepareParams() const override; void prepareParams() override; - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; private: void prepareInputPorts(); @@ -145,7 +145,7 @@ class TensorIterator : public Node { /* Dynamic support */ void reshapeSubgraphInput(); - void reshapeAndFillOutput(dnnl::stream strm); + void reshapeAndFillOutput(const dnnl::stream& strm); bool checkForInputAndBodyShapesInequality() const; int getNumIteration(const std::vector& inputPortMap, const std::vector& outputPortMap) const; void prepareParamsImpl(const bool compileStage); diff --git a/src/plugins/intel_cpu/src/nodes/tile.cpp b/src/plugins/intel_cpu/src/nodes/tile.cpp index 473d404a0b57d8..57bff9631cebde 100644 --- a/src/plugins/intel_cpu/src/nodes/tile.cpp +++ b/src/plugins/intel_cpu/src/nodes/tile.cpp @@ -33,7 +33,7 @@ bool Tile::isSupportedOperation(const std::shared_ptr& op, std:: return true; } -Tile::Tile(const std::shared_ptr& op, const GraphContext::CPtr context) +Tile::Tile(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -148,11 +148,11 @@ bool Tile::needShapeInfer() const { return false; } -void Tile::executeDynamicImpl(dnnl::stream strm) { +void Tile::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void Tile::execute(dnnl::stream strm) { +void Tile::execute(const dnnl::stream& strm) { if (optimizedCase) { optimizedExecute(getSrcMemoryAtPort(TILE_INPUT), getDstMemoryAtPort(0)); } else { @@ -160,7 +160,7 @@ void Tile::execute(dnnl::stream strm) { } } -void Tile::plainExecute(dnnl::stream strm) { +void Tile::plainExecute(const dnnl::stream& strm) { if (noTiling) { return; } diff --git a/src/plugins/intel_cpu/src/nodes/tile.h b/src/plugins/intel_cpu/src/nodes/tile.h index 0bb43ac91e8fb5..cac55b7be8d15c 100644 --- a/src/plugins/intel_cpu/src/nodes/tile.h +++ b/src/plugins/intel_cpu/src/nodes/tile.h @@ -14,12 +14,12 @@ namespace node { class Tile : public Node, public TileBroadcastCommon { public: - Tile(const std::shared_ptr& op, const GraphContext::CPtr context); + Tile(const std::shared_ptr& op, const GraphContext::CPtr& context); void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool created() const override; static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; @@ -30,7 +30,7 @@ class Tile : public Node, public TileBroadcastCommon { bool needShapeInfer() const override; private: - void plainExecute(dnnl::stream strm); + void plainExecute(const dnnl::stream& strm); static constexpr size_t TILE_INPUT = 0lu; static constexpr size_t TILE_REPEATS = 1lu; diff --git a/src/plugins/intel_cpu/src/nodes/topk.cpp b/src/plugins/intel_cpu/src/nodes/topk.cpp index f20bfeb8f599cf..ba1507c9b4b2e6 100644 --- a/src/plugins/intel_cpu/src/nodes/topk.cpp +++ b/src/plugins/intel_cpu/src/nodes/topk.cpp @@ -1887,7 +1887,7 @@ bool TopK::isSupportedOperation(const std::shared_ptr& op, std:: return true; } -TopK::TopK(const std::shared_ptr& op, const GraphContext::CPtr context) +TopK::TopK(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, NgraphShapeInferFactory(op)) { std::string errorMessage; if (isSupportedOperation(op, errorMessage)) { @@ -2195,11 +2195,11 @@ void TopK::createPrimitive() { } } -void TopK::executeDynamicImpl(dnnl::stream strm) { +void TopK::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } -void TopK::execute(dnnl::stream strm) { +void TopK::execute(const dnnl::stream& strm) { auto srcMemPtr = getSrcMemoryAtPort(TOPK_DATA); auto dstMemPtr = getDstMemoryAtPort(TOPK_DATA); auto dstIndexesMemPtr = getDstMemoryAtPort(TOPK_INDEX); diff --git a/src/plugins/intel_cpu/src/nodes/topk.h b/src/plugins/intel_cpu/src/nodes/topk.h index e0fbb4545ccf46..950e3fadefd662 100644 --- a/src/plugins/intel_cpu/src/nodes/topk.h +++ b/src/plugins/intel_cpu/src/nodes/topk.h @@ -74,7 +74,7 @@ struct jit_uni_topk_kernel { class TopK : public Node { public: - TopK(const std::shared_ptr& op, const GraphContext::CPtr context); + TopK(const std::shared_ptr& op, const GraphContext::CPtr& context); ~TopK() override = default; void getSupportedDescriptors() override; @@ -84,8 +84,8 @@ class TopK : public Node { void prepareParams() override; void createPrimitive() override; bool created() const override; - void execute(dnnl::stream strm) override; - void executeDynamicImpl(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; bool canBeInPlace() const override { return false; } diff --git a/src/plugins/intel_cpu/src/nodes/transpose.cpp b/src/plugins/intel_cpu/src/nodes/transpose.cpp index f316da30f97c0c..0b253d4b83892a 100644 --- a/src/plugins/intel_cpu/src/nodes/transpose.cpp +++ b/src/plugins/intel_cpu/src/nodes/transpose.cpp @@ -36,7 +36,7 @@ bool Transpose::isSupportedOperation(const std::shared_ptr& op, return true; } -Transpose::Transpose(const std::shared_ptr& op, const GraphContext::CPtr context) +Transpose::Transpose(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, TransposeShapeInferFactory(op)) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -78,7 +78,7 @@ void Transpose::initSupportedPrimitiveDescriptors() { config.outConfs[0].constant(false); transpose_context = std::make_shared(context, getImplPriority()); - auto supportedPrimitiveDescriptorsBuilder = [this](NodeConfig config, TransposeParams transposeParams) { + auto supportedPrimitiveDescriptorsBuilder = [this](NodeConfig config, const TransposeParams& transposeParams) { std::vector srcMemoryDescs; for (size_t i = 0; i < config.inConfs.size(); i++) { srcMemoryDescs.push_back(config.inConfs[i].getMemDesc()); @@ -238,7 +238,7 @@ void Transpose::createPrimitive() { } } -void Transpose::execute(dnnl::stream strm) { +void Transpose::execute(const dnnl::stream& strm) { if (isOptimized) return; @@ -254,7 +254,7 @@ void Transpose::execute(dnnl::stream strm) { } } -void Transpose::executeDynamicImpl(dnnl::stream strm) { +void Transpose::executeDynamicImpl(const dnnl::stream& strm) { execute(strm); } diff --git a/src/plugins/intel_cpu/src/nodes/transpose.h b/src/plugins/intel_cpu/src/nodes/transpose.h index 0ed1ad67940d0a..c865e4918c28cd 100644 --- a/src/plugins/intel_cpu/src/nodes/transpose.h +++ b/src/plugins/intel_cpu/src/nodes/transpose.h @@ -18,13 +18,13 @@ namespace node { class Transpose : public Node { public: - Transpose(const std::shared_ptr& op, const GraphContext::CPtr context); + Transpose(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override; bool canBeInPlace() const override { return false; @@ -43,7 +43,7 @@ class Transpose : public Node { } protected: - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; std::shared_ptr transpose_context; private: diff --git a/src/plugins/intel_cpu/src/nodes/unique.cpp b/src/plugins/intel_cpu/src/nodes/unique.cpp index 83db293885af0d..391e1967a8c682 100644 --- a/src/plugins/intel_cpu/src/nodes/unique.cpp +++ b/src/plugins/intel_cpu/src/nodes/unique.cpp @@ -33,7 +33,7 @@ bool Unique::isSupportedOperation(const std::shared_ptr& op, std return true; } -Unique::Unique(const std::shared_ptr& op, const GraphContext::CPtr context) +Unique::Unique(const std::shared_ptr& op, const GraphContext::CPtr& context) : Node(op, context, InternalDynShapeInferFactory()) { std::string errorMessage; if (!isSupportedOperation(op, errorMessage)) { @@ -78,6 +78,7 @@ void Unique::initSupportedPrimitiveDescriptors() { inPortConfigs.push_back({LayoutType::ncsp, axisPrecision}); } std::vector outPortConfigs; + outPortConfigs.reserve(4); for (int i = 0; i < 4; i++) { outPortConfigs.push_back({LayoutType::ncsp, i == 0 ? dataPrecision : axisPrecision}); } @@ -132,7 +133,7 @@ struct Unique::slicedExec { } }; -void Unique::execute(dnnl::stream strm) { +void Unique::execute(const dnnl::stream& strm) { if (flattened) { OV_SWITCH(intel_cpu, flattenExec, @@ -154,7 +155,7 @@ void Unique::execute(dnnl::stream strm) { } } -void Unique::executeDynamicImpl(dnnl::stream strm) { +void Unique::executeDynamicImpl(const dnnl::stream& strm) { const auto& srcDataDims = getSrcMemoryAtPort(IN_DATA)->getStaticDims(); VectorDims dstDataDims; Dim uniqLen = 1; diff --git a/src/plugins/intel_cpu/src/nodes/unique.hpp b/src/plugins/intel_cpu/src/nodes/unique.hpp index ddc7bdeaf62f9e..cc1a47431dc358 100644 --- a/src/plugins/intel_cpu/src/nodes/unique.hpp +++ b/src/plugins/intel_cpu/src/nodes/unique.hpp @@ -12,19 +12,19 @@ namespace node { class Unique : public Node { public: - Unique(const std::shared_ptr& op, const GraphContext::CPtr context); + Unique(const std::shared_ptr& op, const GraphContext::CPtr& context); static bool isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept; void getSupportedDescriptors() override{}; void initSupportedPrimitiveDescriptors() override; void createPrimitive() override; - void execute(dnnl::stream strm) override; + void execute(const dnnl::stream& strm) override; bool created() const override { return getType() == Type::Unique; } protected: - void executeDynamicImpl(dnnl::stream strm) override; + void executeDynamicImpl(const dnnl::stream& strm) override; void prepareParams() override; bool needShapeInfer() const override { return false; diff --git a/src/plugins/intel_cpu/src/partitioned_mem_blk.h b/src/plugins/intel_cpu/src/partitioned_mem_blk.h index 4eb8e96424cbf7..1d1558a5edb3ab 100644 --- a/src/plugins/intel_cpu/src/partitioned_mem_blk.h +++ b/src/plugins/intel_cpu/src/partitioned_mem_blk.h @@ -4,6 +4,8 @@ #pragma once +#include + #include "cpu_memory.h" namespace ov { diff --git a/src/plugins/intel_cpu/src/plugin.cpp b/src/plugins/intel_cpu/src/plugin.cpp index f2494e061c8301..6194438c928068 100644 --- a/src/plugins/intel_cpu/src/plugin.cpp +++ b/src/plugins/intel_cpu/src/plugin.cpp @@ -241,7 +241,7 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< } } - auto config = orig_config; + const auto& config = orig_config; const std::shared_ptr cloned_model = model->clone(); Config::ModelType modelType = getModelType(model); DEBUG_LOG(PrintableModel(*cloned_model, "org_")); diff --git a/src/plugins/intel_cpu/src/post_ops.cpp b/src/plugins/intel_cpu/src/post_ops.cpp index fcd250cc892e31..87904c8aa0dd7e 100644 --- a/src/plugins/intel_cpu/src/post_ops.cpp +++ b/src/plugins/intel_cpu/src/post_ops.cpp @@ -151,17 +151,17 @@ Algorithm convertToEltwiseAlgorithm(const ActivationPostOp::Type type) { OPENVINO_THROW("Unsupported algorithm"); } -PostOps getPostOps(std::vector fused) { +PostOps getPostOps(const std::vector& fused) { PostOps ops; - auto makeActivationPostOp = [](const std::shared_ptr eltwise) { + auto makeActivationPostOp = [](const std::shared_ptr& eltwise) { return std::make_shared(convertToActivationPostOpt(eltwise->getAlgorithm()), eltwise->getAlpha(), eltwise->getBeta(), eltwise->getGamma()); }; - auto makeScaleShiftPostOp = [](const std::shared_ptr eltwise) { + auto makeScaleShiftPostOp = [](const std::shared_ptr& eltwise) { return std::make_shared(convertToScaleShiftOpt(eltwise->getAlgorithm()), eltwise->getScales(), eltwise->getShifts()); diff --git a/src/plugins/intel_cpu/src/post_ops.hpp b/src/plugins/intel_cpu/src/post_ops.hpp index 706d248d37e324..e54b07544342ec 100644 --- a/src/plugins/intel_cpu/src/post_ops.hpp +++ b/src/plugins/intel_cpu/src/post_ops.hpp @@ -56,7 +56,7 @@ struct ActivationPostOp : PostOp { const float alpha, const float beta, const float gamma, - eltwiseExecutorCreatingStrategy strategy = nullptr) + const eltwiseExecutorCreatingStrategy& strategy = nullptr) : m_type(type), m_alpha(alpha), m_beta(beta), @@ -189,6 +189,6 @@ ActivationPostOp::Type convertToActivationPostOpt(const Algorithm alg); Algorithm convertToEltwiseAlgorithm(const ActivationPostOp::Type m_type); -PostOps getPostOps(std::vector fused); +PostOps getPostOps(const std::vector& fused); } // namespace intel_cpu } // namespace ov diff --git a/src/plugins/intel_cpu/src/proxy_mem_blk.cpp b/src/plugins/intel_cpu/src/proxy_mem_blk.cpp index 11256acbf86fa3..830fca67f7a007 100644 --- a/src/plugins/intel_cpu/src/proxy_mem_blk.cpp +++ b/src/plugins/intel_cpu/src/proxy_mem_blk.cpp @@ -82,4 +82,4 @@ void ProxyMemoryBlock::notifyUpdate() { item->update(); } } -} \ No newline at end of file +} diff --git a/src/plugins/intel_cpu/src/proxy_mem_blk.h b/src/plugins/intel_cpu/src/proxy_mem_blk.h index ffaa605ed491e0..b44ca44712a592 100644 --- a/src/plugins/intel_cpu/src/proxy_mem_blk.h +++ b/src/plugins/intel_cpu/src/proxy_mem_blk.h @@ -15,9 +15,9 @@ namespace intel_cpu { class ProxyMemoryBlock : public IMemoryBlockObserver { public: ProxyMemoryBlock() : m_pOrigBlock(std::make_shared()), m_pMemBlock(m_pOrigBlock) {} - explicit ProxyMemoryBlock(std::shared_ptr pBlock) { + explicit ProxyMemoryBlock(const std::shared_ptr& pBlock) { OPENVINO_ASSERT(pBlock, "Memory block is uninitialized"); - m_pMemBlock = std::move(pBlock); + m_pMemBlock = pBlock; } void* getRawPtr() const noexcept override; @@ -50,4 +50,4 @@ using ProxyMemoryBlockPtr = std::shared_ptr; using ProxyMemoryBlockCPtr = std::shared_ptr; } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/adaptive_pooling.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/adaptive_pooling.hpp index 8735d3164edf31..b52f62cb7e4691 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/adaptive_pooling.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/adaptive_pooling.hpp @@ -4,6 +4,8 @@ #include +#include + #include "shape_inference/shape_inference_cpu.hpp" #pragma once @@ -33,7 +35,7 @@ class AdaptivePoolingShapeInfer : public ShapeInferEmptyPads { class AdaptivePoolingShapeInferFactory : public ShapeInferFactory { public: - AdaptivePoolingShapeInferFactory(std::shared_ptr op) : m_op(op) {} + AdaptivePoolingShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override; private: diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/color_convert.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/color_convert.hpp index 277639be54221e..5813c4084173cb 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/color_convert.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/color_convert.hpp @@ -4,6 +4,8 @@ #include +#include + #include "shape_inference/shape_inference_cpu.hpp" #pragma once @@ -32,7 +34,7 @@ class ColorConvertShapeInfer : public ShapeInferEmptyPads { class ColorConvertShapeInferFactory : public ShapeInferFactory { public: - ColorConvertShapeInferFactory(std::shared_ptr op) : m_op(op) {} + ColorConvertShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override; private: diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/fullyconnected.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/fullyconnected.hpp index 25fa5c8b0b07c5..22967cf6ae3663 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/fullyconnected.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/fullyconnected.hpp @@ -28,7 +28,7 @@ class FCShapeInfer : public ShapeInferEmptyPads { class FCShapeInferFactory : public ShapeInferFactory { public: - FCShapeInferFactory(std::shared_ptr op) : m_op(op) {} + FCShapeInferFactory(const std::shared_ptr& op) : m_op(op) {} ShapeInferPtr makeShapeInfer() const override { return std::make_shared(m_op->get_output_partial_shape(0).rank().get_length()); } diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/gather.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/gather.hpp index ee6176302ad5be..9cb77fa2c9e25d 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/gather.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/gather.hpp @@ -4,6 +4,8 @@ #include +#include + #include "shape_inference/shape_inference_cpu.hpp" #pragma once @@ -35,7 +37,7 @@ class GatherShapeInfer : public ShapeInferEmptyPads { class GatherShapeInferFactory : public ShapeInferFactory { public: - GatherShapeInferFactory(std::shared_ptr op) : m_op(op) {} + GatherShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override; private: diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/matmul.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/matmul.hpp index 1fea18914ae426..5e7c90a3df9d4e 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/matmul.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/matmul.hpp @@ -4,6 +4,8 @@ #include +#include + #include "shape_inference/shape_inference_cpu.hpp" #pragma once @@ -35,7 +37,7 @@ class MMShapeInfer : public ShapeInferEmptyPads { class MMShapeInferFactory : public ShapeInferFactory { public: - MMShapeInferFactory(const std::shared_ptr& op) : m_op(op) {} + MMShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override; private: diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/ngram.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/ngram.hpp index 0014891baada6d..1a9d87ff20a789 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/ngram.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/ngram.hpp @@ -4,6 +4,8 @@ #include +#include + #include "shape_inference/shape_inference_cpu.hpp" #pragma once @@ -27,7 +29,7 @@ class NgramShapeInfer : public ShapeInferEmptyPads { class NgramShapeInferFactory : public ShapeInferFactory { public: - NgramShapeInferFactory(const std::shared_ptr& op) : m_op(op) {} + NgramShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override; private: diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/one_hot.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/one_hot.hpp index 5b8b648999bb75..bbccf5d435f9f8 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/one_hot.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/one_hot.hpp @@ -4,6 +4,8 @@ #include +#include + #include "shape_inference/shape_inference_cpu.hpp" #pragma once @@ -32,7 +34,7 @@ class OneHotShapeInfer : public ShapeInferEmptyPads { class OneHotShapeInferFactory : public ShapeInferFactory { public: - OneHotShapeInferFactory(std::shared_ptr op) : m_op(op) {} + OneHotShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override; private: diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/priorbox.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/priorbox.hpp index dc543a4d16f316..39189f3219b8b5 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/priorbox.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/priorbox.hpp @@ -4,6 +4,8 @@ #include +#include + #include "shape_inference/shape_inference_cpu.hpp" #pragma once @@ -34,7 +36,7 @@ class PriorBoxShapeInfer : public ShapeInferEmptyPads { class PriorBoxShapeInferFactory : public ShapeInferFactory { public: - explicit PriorBoxShapeInferFactory(std::shared_ptr op) : m_op(op) {} + explicit PriorBoxShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override; private: diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/priorbox_clustered.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/priorbox_clustered.hpp index 27faf3a63c6d4b..0100a8546d1a32 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/priorbox_clustered.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/priorbox_clustered.hpp @@ -4,6 +4,8 @@ #include +#include + #include "shape_inference/shape_inference_cpu.hpp" #pragma once @@ -34,7 +36,7 @@ class PriorBoxClusteredShapeInfer : public ShapeInferEmptyPads { class PriorBoxClusteredShapeInferFactory : public ShapeInferFactory { public: - explicit PriorBoxClusteredShapeInferFactory(std::shared_ptr op) : m_op(op) {} + explicit PriorBoxClusteredShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override; private: diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/reshape.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/reshape.cpp index fba7fb3ac3be0c..c60644a9fdba6f 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/reshape.cpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/reshape.cpp @@ -18,7 +18,7 @@ Result ReshapeShapeInfer::infer(const std::vectorgetData(); const auto& dims = memPtr->getStaticDims(); const auto outputPatternSize = std::accumulate(dims.begin(), dims.end(), 1, std::multiplies()); @@ -76,7 +76,7 @@ Result SqueezeShapeInfer::infer(const std::vectorgetData(); const auto& dims = memPtr->getStaticDims(); if (dims.size() != 0) { @@ -123,7 +123,7 @@ Result UnsqueezeShapeInfer::infer(const std::vectorgetData(); const auto& dims = memPtr->getStaticDims(); size_t outputPatternSize = std::accumulate(dims.begin(), dims.end(), 1, std::multiplies()); diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/reshape.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/reshape.hpp index 2c85f34a723713..f2ef40db7a87c1 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/reshape.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/reshape.hpp @@ -4,6 +4,8 @@ #include +#include + #include "shape_inference/shape_inference_cpu.hpp" #pragma once @@ -46,7 +48,7 @@ class UnsqueezeShapeInfer : public ShapeInferEmptyPads { class ReshapeShapeInferFactory : public ShapeInferFactory { public: - ReshapeShapeInferFactory(std::shared_ptr op) : m_op(op) {} + ReshapeShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override; private: diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/rms_norm.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/rms_norm.hpp index 1a2b8b55aad5fe..68fc4bf0462499 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/rms_norm.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/rms_norm.hpp @@ -4,6 +4,8 @@ #include +#include + #include "shape_inference/shape_inference_cpu.hpp" #pragma once diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/scaled_attn.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/scaled_attn.cpp index 69153901c40ce2..5b893b3458e4fb 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/scaled_attn.cpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/scaled_attn.cpp @@ -4,6 +4,8 @@ #include "scaled_attn.hpp" +#include + #include "shape_inference/shape_inference.hpp" #include "transformations/cpu_opset/common/op/sdpa.hpp" #include "utils.hpp" @@ -14,7 +16,7 @@ namespace node { class SDPAShapeInfer : public ShapeInferEmptyPads { public: - SDPAShapeInfer(const ScaledDotProductAttentionWithKVCache::Config& config) : m_config(config) {} + SDPAShapeInfer(ScaledDotProductAttentionWithKVCache::Config config) : m_config(std::move(config)) {} IShapeInfer::Result infer(const std::vector>& input_shapes, const std::unordered_map& data_dependency) override { diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/scaled_attn.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/scaled_attn.hpp index 870b1e9da98574..09d54181177c91 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/scaled_attn.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/scaled_attn.hpp @@ -4,6 +4,8 @@ #include +#include + #include "shape_inference/shape_inference_cpu.hpp" #pragma once @@ -13,7 +15,7 @@ namespace node { class SDPAShapeInferFactory : public ShapeInferFactory { public: - SDPAShapeInferFactory(std::shared_ptr op) : m_op(op) {} + SDPAShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override; private: diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/strided_slice.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/strided_slice.hpp index bd62d0450ec986..9261d11e88c903 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/strided_slice.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/strided_slice.hpp @@ -4,6 +4,8 @@ #include +#include + #include "shape_inference/shape_inference_cpu.hpp" #pragma once @@ -39,7 +41,7 @@ class StridedSliceShapeInfer : public ShapeInferEmptyPads { class StridedSliceShapeInferFactory : public ShapeInferFactory { public: - StridedSliceShapeInferFactory(const std::shared_ptr& op) : m_op(op) {} + StridedSliceShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override; private: diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/subgraph.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/subgraph.hpp index 0b03f442575f2d..7d52eedf0d7156 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/subgraph.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/subgraph.hpp @@ -4,7 +4,10 @@ #include +#include + #include "shape_inference/shape_inference_cpu.hpp" +#include "snippets/op/subgraph.hpp" #pragma once namespace ov { @@ -14,7 +17,7 @@ using Result = IShapeInfer::Result; class SnippetShapeInfer : public ShapeInferEmptyPads { public: - explicit SnippetShapeInfer(const std::shared_ptr& s) : m_subgraph(s) { + explicit SnippetShapeInfer(std::shared_ptr s) : m_subgraph(std::move(s)) { m_status_map[snippets::ShapeInferStatus::success] = ov::intel_cpu::ShapeInferStatus::success; m_status_map[snippets::ShapeInferStatus::skip] = ov::intel_cpu::ShapeInferStatus::skip; } diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/transpose.hpp b/src/plugins/intel_cpu/src/shape_inference/custom/transpose.hpp index 259e379fc2cc14..3403e8510cf355 100644 --- a/src/plugins/intel_cpu/src/shape_inference/custom/transpose.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/custom/transpose.hpp @@ -4,6 +4,8 @@ #include +#include + #include "shape_inference/shape_inference_cpu.hpp" #pragma once @@ -46,7 +48,7 @@ class TransposeShapeInfer : public ShapeInferEmptyPads { class TransposeShapeInferFactory : public ShapeInferFactory { public: - TransposeShapeInferFactory(const std::shared_ptr& op) : m_op(op) {} + TransposeShapeInferFactory(std::shared_ptr op) : m_op(std::move(op)) {} ShapeInferPtr makeShapeInfer() const override; private: diff --git a/src/plugins/intel_cpu/src/shape_inference/static_shape.hpp b/src/plugins/intel_cpu/src/shape_inference/static_shape.hpp index 26a13e10d3cefe..01feba13ee8ed3 100644 --- a/src/plugins/intel_cpu/src/shape_inference/static_shape.hpp +++ b/src/plugins/intel_cpu/src/shape_inference/static_shape.hpp @@ -78,10 +78,6 @@ class StaticShapeAdapter { return m_dims; } - const TDims&& operator*() const&& noexcept { - return std::move(m_dims); - } - TDims&& operator*() && noexcept { return std::move(m_dims); } diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.cpp index c65eb2340dcd34..a0ea60b9a20a63 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.cpp @@ -4,12 +4,13 @@ #include "causal_mask_preprocess.hpp" #include +#include #include "transformations/itt.hpp" -ov::intel_cpu::CausalMaskPreprocessNode::CausalMaskPreprocessNode(const OutputVector& args, const Config& cfg) +ov::intel_cpu::CausalMaskPreprocessNode::CausalMaskPreprocessNode(const OutputVector& args, Config cfg) : Op(args), - m_config(cfg) { + m_config(std::move(cfg)) { constructor_validate_and_infer_types(); } diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.hpp index 602795bf8cedfb..7628aea386e4e7 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/causal_mask_preprocess.hpp @@ -19,7 +19,7 @@ class CausalMaskPreprocessNode : public ov::op::Op { std::string type; }; - CausalMaskPreprocessNode(const OutputVector& args, const Config& cfg); + CausalMaskPreprocessNode(const OutputVector& args, Config cfg); bool visit_attributes(ov::AttributeVisitor& visitor) override; diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/read_value_with_subgraph.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/read_value_with_subgraph.cpp index 4e5a28461a3e45..94c0fb376196fb 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/read_value_with_subgraph.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/read_value_with_subgraph.cpp @@ -7,13 +7,13 @@ #include "transformations/itt.hpp" ov::intel_cpu::ReadValueWithSubgraph::ReadValueWithSubgraph(const std::shared_ptr& variable, - std::shared_ptr body) { + const std::shared_ptr& body) { m_variable = variable; set_function(body); } ov::intel_cpu::ReadValueWithSubgraph::ReadValueWithSubgraph(const std::shared_ptr& variable, - std::shared_ptr body, + const std::shared_ptr& body, const OutputVector& args) : ReadValueWithSubgraph(variable, body) { set_arguments(args); @@ -111,4 +111,4 @@ void ov::intel_cpu::ReadValueWithSubgraph::validate_and_infer_types() { set_output_type(output_index, node_result.get_element_type(), node_result.get_partial_shape()); } -} \ No newline at end of file +} diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/read_value_with_subgraph.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/read_value_with_subgraph.hpp index 35faf88422cbc5..3e06979b414cb8 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/read_value_with_subgraph.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/read_value_with_subgraph.hpp @@ -17,9 +17,10 @@ class ReadValueWithSubgraph : public ov::op::util::SubGraphOp, public ov::op::ut OPENVINO_OP("ReadValueWithSubgraph", "cpu_plugin_opset", ov::op::util::SubGraphOp); ReadValueWithSubgraph() = default; - ReadValueWithSubgraph(const std::shared_ptr& variable, std::shared_ptr body); ReadValueWithSubgraph(const std::shared_ptr& variable, - std::shared_ptr body, + const std::shared_ptr& body); + ReadValueWithSubgraph(const std::shared_ptr& variable, + const std::shared_ptr& body, const OutputVector& args); std::string get_variable_id() const override; diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/sdpa.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/sdpa.cpp index 06738401791926..f4fe54e7d41f43 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/sdpa.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/sdpa.cpp @@ -5,13 +5,14 @@ #include "sdpa.hpp" #include +#include #include "transformations/itt.hpp" ov::intel_cpu::ScaledDotProductAttentionWithKVCache::ScaledDotProductAttentionWithKVCache(const OutputVector& args, - const Config& cfg) + Config cfg) : Op(args), - m_config(cfg) { + m_config(std::move(cfg)) { constructor_validate_and_infer_types(); } @@ -102,9 +103,9 @@ bool ov::intel_cpu::ScaledDotProductAttentionWithKVCache::visit_attributes(ov::A return true; } -ov::intel_cpu::SDPAWithTransposeReshape::SDPAWithTransposeReshape(const OutputVector& args, const Config& cfg) +ov::intel_cpu::SDPAWithTransposeReshape::SDPAWithTransposeReshape(const OutputVector& args, Config cfg) : Op(args), - m_config(cfg) {} + m_config(std::move(cfg)) {} std::shared_ptr ov::intel_cpu::SDPAWithTransposeReshape::clone_with_new_inputs( const ov::OutputVector& new_args) const { @@ -117,7 +118,7 @@ void ov::intel_cpu::SDPAWithTransposeReshape::validate_and_infer_types() { INTERNAL_OP_SCOPE(SDPAWithTransposeReshape_validate_and_infer_types); // [B,L,H*S] auto q_ps = get_input_partial_shape(0); - auto output_ps = q_ps; + const auto& output_ps = q_ps; NODE_VALIDATION_CHECK(this, m_config.output_BLHxS == true); NODE_VALIDATION_CHECK(this, m_config.input_BLHxS == true); NODE_VALIDATION_CHECK(this, q_ps.size() == 3u); @@ -142,4 +143,4 @@ bool ov::intel_cpu::SDPAWithTransposeReshape::visit_attributes(ov::AttributeVisi visitor.on_attribute("order_HS", m_config.order_HS); visitor.finish_structure(); return true; -} \ No newline at end of file +} diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/sdpa.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/sdpa.hpp index 3deb4cf932bd23..2864ea41d1b4ed 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/sdpa.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/sdpa.hpp @@ -32,7 +32,7 @@ class ScaledDotProductAttentionWithKVCache : public ov::op::Op { std::vector order_HS; // Reshape[B,L,H*S]->B,L,H,S], H,S are fixed value, when input_BLHxS is true. }; - ScaledDotProductAttentionWithKVCache(const OutputVector& args, const Config& cfg); + ScaledDotProductAttentionWithKVCache(const OutputVector& args, Config cfg); std::shared_ptr clone_with_new_inputs(const OutputVector& new_args) const override; bool visit_attributes(AttributeVisitor& visitor) override; @@ -57,7 +57,7 @@ class SDPAWithTransposeReshape : public ov::op::Op { SDPAWithTransposeReshape() = default; - SDPAWithTransposeReshape(const OutputVector& args, const Config& cfg); + SDPAWithTransposeReshape(const OutputVector& args, Config cfg); std::shared_ptr clone_with_new_inputs(const OutputVector& new_args) const override; bool visit_attributes(AttributeVisitor& visitor) override; @@ -76,4 +76,4 @@ class SDPAWithTransposeReshape : public ov::op::Op { }; } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.cpp index 551ddf95ba18d1..e2bcac397af164 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.cpp @@ -89,7 +89,7 @@ CausalMaskPreprocess::CausalMaskPreprocess() { auto max_seq_len = Symbol("max_seq_len"); - auto ShapeOf_41610 = batch_size; // shapeOf(beamidx) + const auto& ShapeOf_41610 = batch_size; // shapeOf(beamidx) auto ListConstruct_Concat = makePattern({ShapeOf_41610, {1}, {1}, {1}}, {{"axis", 0}}); // tensor_array auto repeat_Tile = diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp index 0f2252fd5d256f..e28485b4c9cb1d 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp @@ -56,7 +56,7 @@ ov::intel_cpu::ConvertMatMulToFC::ConvertMatMulToFC() { // Check that if second inputs is Constant path and it's shape without ones dimensions has length <= 2 // we replace MatMul with FullyConnected operation. - if (std::count_if(shape_b.begin(), shape_b.end(), [](ov::Dimension x) { + if (std::count_if(shape_b.begin(), shape_b.end(), [](const ov::Dimension& x) { return x != 1; }) > 2) { return false; diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/move_fc_reshape_to_weights.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/move_fc_reshape_to_weights.cpp index c815e7373c870c..bc883c82484c2b 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/move_fc_reshape_to_weights.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/move_fc_reshape_to_weights.cpp @@ -24,7 +24,7 @@ ov::intel_cpu::MoveFCReshapeToWeights::MoveFCReshapeToWeights() { auto convert_m = wrap_type({weights_m}, consumers_count(1)); auto one_consumer_rank_equals = [](const ov::Dimension& expected_rank) { - return [=](ov::Output output) -> bool { + return [=](const ov::Output& output) -> bool { return consumers_count(1)(output) && rank_equals(expected_rank)(output); }; }; diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/move_readvalue_inputs_to_subgraph.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/move_readvalue_inputs_to_subgraph.cpp index 3f652bad3e4580..6f8d1cdaf8950c 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/move_readvalue_inputs_to_subgraph.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/move_readvalue_inputs_to_subgraph.cpp @@ -43,7 +43,7 @@ ov::intel_cpu::MoveReadValueInputsToSubgraph::MoveReadValueInputsToSubgraph() { OutputVector outputs = {}; // DFS, Check if current node's final successor is only ReadValue. - std::function, bool&)> dfs = [&](std::shared_ptr node, + std::function, bool&)> dfs = [&](const std::shared_ptr& node, bool& found_output) { if (found_output) { return; @@ -84,7 +84,7 @@ ov::intel_cpu::MoveReadValueInputsToSubgraph::MoveReadValueInputsToSubgraph() { } }; - std::function)> reverse_dfs = [&](std::shared_ptr node) { + std::function)> reverse_dfs = [&](const std::shared_ptr& node) { if (visited_path_to_output.find(node) != visited_path_to_output.end()) { inputs.emplace_back(node); return; @@ -128,7 +128,7 @@ ov::intel_cpu::MoveReadValueInputsToSubgraph::MoveReadValueInputsToSubgraph() { // Subgraph's input auto params = ParameterVector{}; - for (auto inp : inputs) { + for (const auto& inp : inputs) { auto param = std::make_shared(inp->get_element_type(), inp->get_output_partial_shape(0)); params.push_back(param); @@ -161,4 +161,4 @@ ov::intel_cpu::MoveReadValueInputsToSubgraph::MoveReadValueInputsToSubgraph() { auto m = std::make_shared(readvalue_pattern, matcher_name); this->register_matcher(m, callback); -} \ No newline at end of file +} diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/ngram_fusion.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/ngram_fusion.cpp index f1a8a679c0b52f..f9b1e4f2b2c053 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/ngram_fusion.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/ngram_fusion.cpp @@ -11,14 +11,14 @@ #include #include +#include "openvino/cc/pass/itt.hpp" #include "openvino/opsets/opset1.hpp" #include "transformations/cpu_opset/common/op/ngram.hpp" -#include "transformations/itt.hpp" using namespace ov::pass::pattern; ov::intel_cpu::NgramFusion::NgramFusion() { MATCHER_SCOPE(NgramFusion); - auto concat_matches = [](ov::Output output) -> bool { + auto concat_matches = [](const ov::Output& output) -> bool { if (auto concat = ov::as_type_ptr(output.get_node_shared_ptr())) { return ov::pass::pattern::rank_equals(2)(output) && concat->get_axis() == 1; } @@ -41,7 +41,7 @@ ov::intel_cpu::NgramFusion::NgramFusion() { } auto check_bias = [](const PatternValueMap& pattern_map, - const std::shared_ptr matched_constant_to_check, + const std::shared_ptr& matched_constant_to_check, const size_t expected_bias) { auto out_it = pattern_map.find(matched_constant_to_check); if (expected_bias == 0) { @@ -53,15 +53,15 @@ ov::intel_cpu::NgramFusion::NgramFusion() { return constant != nullptr && ov::op::util::constantIsEqualTo(constant, expected_bias); }; - auto tokens_match = [](ov::Output output) -> bool { + auto tokens_match = [](const ov::Output& output) -> bool { return ov::pass::pattern::rank_equals(2)(output) && ov::pass::pattern::type_matches(ov::element::f32)(output); }; - auto idces_match = [](ov::Output output) -> bool { + auto idces_match = [](const ov::Output& output) -> bool { return ov::pass::pattern::rank_equals(2)(output) && ov::pass::pattern::type_matches(ov::element::i32)(output); }; - auto as_is_cropped_shape_match = [](ov::Output output) -> bool { + auto as_is_cropped_shape_match = [](const ov::Output& output) -> bool { const auto& symbols = output.get_tensor().get_value_symbol(); return ov::pass::pattern::rank_equals(1)(output) && !symbols.empty() && symbols[0] != nullptr; }; @@ -107,13 +107,13 @@ ov::intel_cpu::NgramFusion::NgramFusion() { return false; } - auto cropped_shape_symbol_match = [cropped_shape_symbol](ov::Output output) -> bool { + auto cropped_shape_symbol_match = [cropped_shape_symbol](const ov::Output& output) -> bool { const auto& symbols = output.get_tensor().get_value_symbol(); return ov::pass::pattern::rank_equals(1)(output) && !symbols.empty() && ov::symbol::are_equal(symbols[0], cropped_shape_symbol); }; - auto tokens_symbol_match = [tokens_match, cropped_shape_symbol](ov::Output output) -> bool { + auto tokens_symbol_match = [tokens_match, cropped_shape_symbol](const ov::Output& output) -> bool { return tokens_match(output) && symbol::are_equal(output.get_partial_shape()[0].get_symbol(), cropped_shape_symbol); }; diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/stateful_sdpa_fusion.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/stateful_sdpa_fusion.cpp index 291ef98f1a88c6..8f44582ba89b01 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/stateful_sdpa_fusion.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/stateful_sdpa_fusion.cpp @@ -67,7 +67,7 @@ StatefulSDPAFusion::StatefulSDPAFusion() { auto reshape_kv = makePattern({kv, any_input()}); auto unsqueeze_kv = makePattern({kv, any_input()}); - auto check_one = [](Output output) -> bool { + auto check_one = [](const Output& output) -> bool { auto node = ov::as_type_ptr(output.get_node_shared_ptr()); const auto& bcst_arg = node->cast_vector(); return std::all_of(bcst_arg.begin(), bcst_arg.end(), [](float i) { diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp index 51fb8c33833eef..107425e38ff848 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/convert_to_cpu_specific_opset.hpp @@ -13,8 +13,8 @@ #include "common/pass/move_readvalue_inputs_to_subgraph.hpp" #include "common/pass/rnn_sequences_optimization.hpp" #include "config.h" -#include "itt.hpp" #include "nodes/fullyconnected.h" +#include "openvino/cc/pass/itt.hpp" #include "openvino/core/type/element_type.hpp" #include "openvino/pass/constant_folding.hpp" #include "openvino/pass/manager.hpp" diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/op/mha.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/op/mha.cpp index 18a396feaf09a4..1acf3c465338f8 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/op/mha.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/op/mha.cpp @@ -5,6 +5,8 @@ #include "mha.hpp" #include +#include +#include #include "openvino/opsets/opset3.hpp" #include "transformations/itt.hpp" @@ -13,16 +15,16 @@ ov::intel_cpu::MHANode::MHANode(const ov::Output& in0, const ov::Output& in1, const ov::Output& in2, const ov::Output& in3, - const std::vector& mul_scales, + std::vector mul_scales, bool is_mul_first, const ov::element::Type output_type) : Op({in0, in1, in2, in3}), - m_output_type(output_type) { - this->mul_scales = mul_scales; - this->is_mul_first = is_mul_first; - this->fq0_output_type = ov::element::undefined; - this->fq1_output_type = ov::element::undefined; - this->fq2_output_type = ov::element::undefined; + m_output_type(output_type), + mul_scales(std::move(mul_scales)), + is_mul_first(is_mul_first), + fq0_output_type(ov::element::undefined), + fq1_output_type(ov::element::undefined), + fq2_output_type(ov::element::undefined) { validate_and_infer_types(); } @@ -30,27 +32,27 @@ ov::intel_cpu::MHANode::MHANode(const ov::Output& in0, const ov::Output& in1, const ov::Output& in2, const ov::Output& in3, - const std::vector& mul_scales, + std::vector mul_scales, bool is_mul_first, - const std::vector& fq_scales0, - const std::vector& fq_scales1, - const std::vector& fq_scales2, - const std::vector& fq_scales3, + std::vector fq_scales0, + std::vector fq_scales1, + std::vector fq_scales2, + std::vector fq_scales3, const ov::element::Type fq0_output_type, const ov::element::Type fq1_output_type, const ov::element::Type fq2_output_type, const ov::element::Type output_type) : Op({in0, in1, in2, in3}), - m_output_type(output_type) { - this->mul_scales = mul_scales; - this->is_mul_first = is_mul_first; - this->fq_scales0 = fq_scales0; - this->fq_scales1 = fq_scales1; - this->fq_scales2 = fq_scales2; - this->fq_scales3 = fq_scales3; - this->fq0_output_type = fq0_output_type; - this->fq1_output_type = fq1_output_type; - this->fq2_output_type = fq2_output_type; + m_output_type(output_type), + mul_scales(std::move(mul_scales)), + is_mul_first(is_mul_first), + fq_scales0(std::move(fq_scales0)), + fq_scales1(std::move(fq_scales1)), + fq_scales2(std::move(fq_scales2)), + fq_scales3(std::move(fq_scales3)), + fq0_output_type(fq0_output_type), + fq1_output_type(fq1_output_type), + fq2_output_type(fq2_output_type) { validate_and_infer_types(); } diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/op/mha.hpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/op/mha.hpp index dff09b3cc46a05..f7b0af91516987 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/op/mha.hpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/op/mha.hpp @@ -19,7 +19,7 @@ class MHANode : public ov::op::Op { const ov::Output& in1, const ov::Output& in2, const ov::Output& in3, - const std::vector& mul_scales, + std::vector mul_scales, bool is_mul_first, const ov::element::Type output_type); @@ -27,12 +27,12 @@ class MHANode : public ov::op::Op { const ov::Output& in1, const ov::Output& in2, const ov::Output& in3, - const std::vector& mul_scales, + std::vector mul_scales, bool is_mul_first, - const std::vector& fq_scales0, - const std::vector& fq_scales1, - const std::vector& fq_scales2, - const std::vector& fq_scales3, + std::vector fq_scales0, + std::vector fq_scales1, + std::vector fq_scales2, + std::vector fq_scales3, const ov::element::Type fq0_output_type, const ov::element::Type fq1_output_type, const ov::element::Type fq2_output_type, diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/mlp_fusion.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/mlp_fusion.cpp index ff06a1b70cfd93..d4988ce9f43337 100644 --- a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/mlp_fusion.cpp +++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/mlp_fusion.cpp @@ -232,7 +232,7 @@ ov::intel_cpu::MLPFusion::MLPFusion() { new_args.push_back(pattern_map.at(down_proj_weight_scales_per_OC)); } - auto old_node = root; + const auto& old_node = root; auto new_node = std::make_shared(new_args, config); new_node->set_friendly_name(old_node->get_friendly_name()); ov::copy_runtime_info( diff --git a/src/plugins/intel_cpu/src/transformations/itt.hpp b/src/plugins/intel_cpu/src/transformations/itt.hpp index 030a80745a2a54..2dd4035062a5db 100644 --- a/src/plugins/intel_cpu/src/transformations/itt.hpp +++ b/src/plugins/intel_cpu/src/transformations/itt.hpp @@ -9,7 +9,9 @@ #pragma once -#include +#include "openvino/cc/pass/itt.hpp" +#include "openvino/cc/selective_build.h" +#include "openvino/itt.hpp" namespace ov { namespace intel_cpu { diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.cpp index ce57cd1529b893..df05ce5d539f46 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.cpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.cpp @@ -17,7 +17,7 @@ intel_cpu::BrgemmCopyB::BrgemmCopyB(const Output& x, const size_t offset_in, const size_t offset_out0, const size_t offset_out1, - std::vector layout_input) + const std::vector& layout_input) : snippets::modifier::MemoryAccess(1, with_compensations(type) ? 2 : 1), op::Op({x}), m_type(type), @@ -28,7 +28,7 @@ intel_cpu::BrgemmCopyB::BrgemmCopyB(const Output& x, if (with_compensations(m_type)) { set_output_port_descriptor({0, offset_out1}, 1); } - custom_constructor_validate_and_infer_types(std::move(layout_input)); + custom_constructor_validate_and_infer_types(layout_input); } intel_cpu::BrgemmCopyB::BrgemmCopyB(const Output& x, @@ -37,7 +37,7 @@ intel_cpu::BrgemmCopyB::BrgemmCopyB(const Output& x, const PortDescriptor& desc_in0, const PortDescriptor& desc_out0, const PortDescriptor& desc_out1, - std::vector layout_input) + const std::vector& layout_input) : snippets::modifier::MemoryAccess(1, with_compensations(type) ? 2 : 1), op::Op({x}), m_type(type), @@ -48,7 +48,7 @@ intel_cpu::BrgemmCopyB::BrgemmCopyB(const Output& x, if (with_compensations(m_type)) { set_output_port_descriptor(desc_out1, 1); } - custom_constructor_validate_and_infer_types(std::move(layout_input)); + custom_constructor_validate_and_infer_types(layout_input); } bool BrgemmCopyB::visit_attributes(AttributeVisitor& visitor) { @@ -59,7 +59,7 @@ bool BrgemmCopyB::visit_attributes(AttributeVisitor& visitor) { return true; } -void BrgemmCopyB::custom_constructor_validate_and_infer_types(std::vector layout_input) { +void BrgemmCopyB::custom_constructor_validate_and_infer_types(const std::vector& layout_input) { INTERNAL_OP_SCOPE(BrgemmRepack_ctor_validate_and_infer_types); OPENVINO_ASSERT(m_type == BRGEMM_TYPE::WITH_COMPENSATIONS || m_type == BRGEMM_TYPE::REPACKING_ONLY, "Unsupported BRGEMM_TYPE value"); @@ -136,4 +136,4 @@ ov::snippets::IShapeInferSnippets::Result BrgemmCopyB::ShapeInfer::infer( return {new_shapes, ov::snippets::ShapeInferStatus::success}; } } // namespace intel_cpu -} // namespace ov \ No newline at end of file +} // namespace ov diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.hpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.hpp index b4e7b030fc605b..bf327784503352 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.hpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.hpp @@ -31,14 +31,14 @@ class BrgemmCopyB : public snippets::modifier::MemoryAccess, public ov::op::Op { const size_t offset_in = 0lu, const size_t offset_out0 = 0lu, const size_t offset_out1 = 0lu, - std::vector layout_input = {}); + const std::vector& layout_input = {}); BrgemmCopyB(const Output& x, const element::Type src_type, BRGEMM_TYPE type, const PortDescriptor& desc_in0, const PortDescriptor& desc_out0, const PortDescriptor& desc_out1, - std::vector layout_input = {}); + const std::vector& layout_input = {}); BrgemmCopyB() = default; size_t get_offset_in() const { @@ -75,7 +75,7 @@ class BrgemmCopyB : public snippets::modifier::MemoryAccess, public ov::op::Op { static bool is_transposed(const std::vector& layout); private: - void custom_constructor_validate_and_infer_types(std::vector layout_input = {}); + void custom_constructor_validate_and_infer_types(const std::vector& layout_input = {}); void validate_element_type(const ov::element::Type& element_type); BRGEMM_TYPE m_type = BRGEMM_TYPE::REPACKING_ONLY; diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.cpp index 871cd3d2ac3686..b994ef4fa2d5df 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.cpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.cpp @@ -20,9 +20,9 @@ BrgemmCPU::BrgemmCPU(const Output& A, const size_t offset_a, const size_t offset_b, const size_t offset_c, - std::vector layout_a, - std::vector layout_b, - std::vector layout_c) + const std::vector& layout_a, + const std::vector& layout_b, + const std::vector& layout_c) : Brgemm(), m_type(type) { // We call default ctor of Brgemm class to avoid incorrect shape infer in constructor_validate_and_type_infer() call @@ -32,7 +32,7 @@ BrgemmCPU::BrgemmCPU(const Output& A, set_input_port_descriptor({0, offset_a}, 0); set_input_port_descriptor({0, offset_b}, 1); set_output_port_descriptor({0, offset_c}, 0); - custom_constructor_validate_and_infer_types(std::move(layout_a), std::move(layout_b), std::move(layout_c)); + custom_constructor_validate_and_infer_types(layout_a, layout_b, layout_c); } BrgemmCPU::BrgemmCPU(const Output& A, @@ -43,9 +43,9 @@ BrgemmCPU::BrgemmCPU(const Output& A, const size_t offset_b, const size_t offset_scratch, const size_t offset_c, - std::vector layout_a, - std::vector layout_b, - std::vector layout_c) + const std::vector& layout_a, + const std::vector& layout_b, + const std::vector& layout_c) : Brgemm(), m_type(type) { set_arguments({A, B, scratch}); @@ -55,7 +55,7 @@ BrgemmCPU::BrgemmCPU(const Output& A, set_input_port_descriptor({0, offset_b}, 1); set_output_port_descriptor({0, offset_c}, 0); set_input_port_descriptor({0, offset_scratch}, 2); - custom_constructor_validate_and_infer_types(std::move(layout_a), std::move(layout_b), std::move(layout_c)); + custom_constructor_validate_and_infer_types(layout_a, layout_b, layout_c); } BrgemmCPU::BrgemmCPU(const Output& A, @@ -64,16 +64,16 @@ BrgemmCPU::BrgemmCPU(const Output& A, const PortDescriptor& desc_a, const PortDescriptor& desc_b, const PortDescriptor& desc_c, - std::vector layout_a, - std::vector layout_b, - std::vector layout_c) + const std::vector& layout_a, + const std::vector& layout_b, + const std::vector& layout_c) : Brgemm(), m_type(type) { set_arguments({A, B}); set_output_size(1); m_input_ports = {{0, desc_a}, {1, desc_b}}; m_output_ports = {{0, desc_c}}; - custom_constructor_validate_and_infer_types(std::move(layout_a), std::move(layout_b), std::move(layout_c)); + custom_constructor_validate_and_infer_types(layout_a, layout_b, layout_c); } BrgemmCPU::BrgemmCPU(const Output& A, @@ -84,21 +84,21 @@ BrgemmCPU::BrgemmCPU(const Output& A, const PortDescriptor& desc_b, const PortDescriptor& desc_scratch, const PortDescriptor& desc_c, - std::vector layout_a, - std::vector layout_b, - std::vector layout_c) + const std::vector& layout_a, + const std::vector& layout_b, + const std::vector& layout_c) : Brgemm(), m_type(type) { set_arguments({A, B, scratch}); set_output_size(1); m_input_ports = {{0, desc_a}, {1, desc_b}, {2, desc_scratch}}; m_output_ports = {{0, desc_c}}; - custom_constructor_validate_and_infer_types(std::move(layout_a), std::move(layout_b), std::move(layout_c)); + custom_constructor_validate_and_infer_types(layout_a, layout_b, layout_c); } -void BrgemmCPU::custom_constructor_validate_and_infer_types(std::vector layout_a, - std::vector layout_b, - std::vector layout_c) { +void BrgemmCPU::custom_constructor_validate_and_infer_types(const std::vector& layout_a, + const std::vector& layout_b, + const std::vector& layout_c) { INTERNAL_OP_SCOPE(BrgemmCPU_constructor_validate_and_infer_types); validate_inputs(); diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.hpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.hpp index c2329fdf8af62d..ddc21e8ddb59d3 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.hpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.hpp @@ -29,9 +29,9 @@ class BrgemmCPU : public snippets::op::Brgemm { const size_t offset_a = 0, const size_t offset_b = 0, const size_t offset_c = 0, - std::vector layout_a = {}, - std::vector layout_b = {}, - std::vector layout_c = {}); + const std::vector& layout_a = {}, + const std::vector& layout_b = {}, + const std::vector& layout_c = {}); BrgemmCPU(const Output& A, const Output& B, const Output& scratch, @@ -40,18 +40,18 @@ class BrgemmCPU : public snippets::op::Brgemm { const size_t offset_b = 0, const size_t offset_scratch = 0, const size_t offset_c = 0, - std::vector layout_a = {}, - std::vector layout_b = {}, - std::vector layout_c = {}); + const std::vector& layout_a = {}, + const std::vector& layout_b = {}, + const std::vector& layout_c = {}); BrgemmCPU(const Output& A, const Output& B, BRGEMM_TYPE type, const PortDescriptor& desc_a, const PortDescriptor& desc_b, const PortDescriptor& desc_c, - std::vector layout_a = {}, - std::vector layout_b = {}, - std::vector layout_c = {}); + const std::vector& layout_a = {}, + const std::vector& layout_b = {}, + const std::vector& layout_c = {}); BrgemmCPU(const Output& A, const Output& B, const Output& scratch, @@ -60,9 +60,9 @@ class BrgemmCPU : public snippets::op::Brgemm { const PortDescriptor& desc_b, const PortDescriptor& desc_scratch, const PortDescriptor& desc_c, - std::vector layout_a = {}, - std::vector layout_b = {}, - std::vector layout_c = {}); + const std::vector& layout_a = {}, + const std::vector& layout_b = {}, + const std::vector& layout_c = {}); BrgemmCPU() = default; void validate_and_infer_types() override; @@ -79,9 +79,9 @@ class BrgemmCPU : public snippets::op::Brgemm { constexpr static size_t SCRATCH_BYTE_SIZE = 32 * 1024; private: - void custom_constructor_validate_and_infer_types(std::vector layout_a, - std::vector layout_b, - std::vector layout_c); + void custom_constructor_validate_and_infer_types(const std::vector& layout_a, + const std::vector& layout_b, + const std::vector& layout_c); void validate_with_scratchpad() const; void validate_inputs() const; diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_utils.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_utils.cpp index 386941fd94bb98..f360437d59da6b 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_utils.cpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_utils.cpp @@ -120,13 +120,13 @@ size_t compute_inner_k_block(const ov::element::Type& precision) { ov::snippets::lowered::ExpressionPtr get_copy_b_expr(const ov::snippets::lowered::ExpressionPtr& brgemm_expr) { OPENVINO_ASSERT(ov::is_type(brgemm_expr->get_node()), "get_copy_b_expr must be called only for BrgemmCPU node"); - const auto b_input_expr = brgemm_expr->get_input_port_connector(1)->get_source().get_expr(); + auto b_input_expr = brgemm_expr->get_input_port_connector(1)->get_source().get_expr(); if (ov::is_type(b_input_expr->get_node())) { return b_input_expr; } else if (ov::is_type(b_input_expr)) { OPENVINO_ASSERT(b_input_expr->get_input_count() >= 1, "BufferExpression on brgemm's B input must have at least one input"); - const auto input_buffer_expr = b_input_expr->get_input_port_connector(0)->get_source().get_expr(); + auto input_buffer_expr = b_input_expr->get_input_port_connector(0)->get_source().get_expr(); if (ov::is_type(input_buffer_expr->get_node())) { return input_buffer_expr; } diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/enforce_precision.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/enforce_precision.cpp index 6b7d5d31a5b12f..46c48425157ef9 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/enforce_precision.cpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/enforce_precision.cpp @@ -18,7 +18,7 @@ using namespace ov::intel_cpu::pass; EnforcePrecision::EnforcePrecision( const ov::element::Type source, const ov::element::Type target, - std::function>(const std::shared_ptr& op)> + const std::function>(const std::shared_ptr& op)>& get_supported_precisions) : source(source), target(target), diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/enforce_precision.hpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/enforce_precision.hpp index 24e848cf157e0e..d7738dec3f5935 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/enforce_precision.hpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/enforce_precision.hpp @@ -19,7 +19,7 @@ class EnforcePrecision : public ov::pass::ModelPass { EnforcePrecision(const element::Type source, const element::Type target, - std::function>(const std::shared_ptr& op)> + const std::function>(const std::shared_ptr& op)>& get_supported_precisions = nullptr); bool run_on_model(const std::shared_ptr& m) override; diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/insert_brgemm_copy_buffers.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/insert_brgemm_copy_buffers.cpp index 91334e61db91c7..b38562fa088bb1 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/insert_brgemm_copy_buffers.cpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/insert_brgemm_copy_buffers.cpp @@ -81,7 +81,7 @@ bool InsertBrgemmCopyBuffers::run(LinearIR& linear_ir, LinearIR::constExprIt beg bool modified = false; for (auto expr_it = begin; expr_it != end; ++expr_it) { - const auto brgemm_expr = *expr_it; + const auto& brgemm_expr = *expr_it; if (const auto brgemm_cpu = ov::as_type_ptr(brgemm_expr->get_node())) { if (brgemm_utils::with_repacking(brgemm_cpu->get_type())) { // BrgemmCopyB might be extracted from the body diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/snippets_mark_skipped.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/snippets_mark_skipped.cpp index d410995f09e8c7..4ae8be0bb5612c 100644 --- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/snippets_mark_skipped.cpp +++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/snippets_mark_skipped.cpp @@ -345,7 +345,7 @@ bool isSuitableChildForFusingMatMul(const std::shared_ptr& node, bool isSuitableParentForFusingSumActivation(const std::shared_ptr& node) { if (!ov::is_type(node)) return false; - auto isFusedBiasNode = [](std::shared_ptr n) { + auto isFusedBiasNode = [](const std::shared_ptr& n) { if (!(ov::is_type(n) && GetNodeFusingType(n) == NodeFusingType::FusedWithConvolution)) return false; const auto conv = n->get_input_source_output(0); @@ -372,7 +372,7 @@ bool isSuitableParentForFusingSumActivation(const std::shared_ptr& n conv_shape[channelAxis].get_length() == static_cast(bias_norm_dims[channelAxis]) && bias_norm_dims[channelAxis] == static_cast(shape_size(bias_norm_dims)); }; - auto isFusedFQNode = [&isFusedBiasNode](std::shared_ptr n) { + auto isFusedFQNode = [&isFusedBiasNode](const std::shared_ptr& n) { if (!(ov::is_type(n) && GetNodeFusingType(n) == NodeFusingType::FusedWithConvolution)) return false; const auto& parent = n->get_input_node_shared_ptr(0); diff --git a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.h b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.h index 1c8991b0e19ed5..d1b92e59452579 100644 --- a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.h +++ b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.h @@ -5,6 +5,7 @@ #pragma once #include +#include #include #include "config.h" @@ -19,8 +20,8 @@ namespace intel_cpu { class Transformations { public: - Transformations(const std::shared_ptr& initialModel, const Config& config) - : model(initialModel), + Transformations(std::shared_ptr initialModel, const Config& config) + : model(std::move(initialModel)), config(config) { CPU_DEBUG_CAPS_MAYBE_UNUSED(this->config); } diff --git a/src/plugins/intel_cpu/src/utils/blob_dump.h b/src/plugins/intel_cpu/src/utils/blob_dump.h index ca6afe50dd01fb..23ef61ac909234 100644 --- a/src/plugins/intel_cpu/src/utils/blob_dump.h +++ b/src/plugins/intel_cpu/src/utils/blob_dump.h @@ -7,6 +7,7 @@ #include #include +#include #include "memory_desc/dnnl_blocked_memory_desc.h" @@ -35,7 +36,7 @@ class BlobDumper { BlobDumper(const BlobDumper&) = default; BlobDumper& operator=(BlobDumper&&) = default; - explicit BlobDumper(const MemoryPtr& _memory) : memory(_memory) {} + explicit BlobDumper(MemoryPtr _memory) : memory(std::move(_memory)) {} static BlobDumper read(const std::string& file_path); static BlobDumper read(std::istream& stream); diff --git a/src/plugins/intel_cpu/src/utils/codec_xor.hpp b/src/plugins/intel_cpu/src/utils/codec_xor.hpp index 45f5a5e2e9cf30..087fc86ea689d3 100644 --- a/src/plugins/intel_cpu/src/utils/codec_xor.hpp +++ b/src/plugins/intel_cpu/src/utils/codec_xor.hpp @@ -5,6 +5,7 @@ #include #include +#include namespace ov { namespace intel_cpu { @@ -22,9 +23,9 @@ union CacheDecrypt { CacheDecrypt() {} - CacheDecrypt(CacheDecryptStr fn) : m_decrypt_str(fn) {} + CacheDecrypt(CacheDecryptStr fn) : m_decrypt_str(std::move(fn)) {} - CacheDecrypt(CacheDecryptChar fn) : m_decrypt_char(fn) {} + CacheDecrypt(CacheDecryptChar fn) : m_decrypt_char(std::move(fn)) {} ~CacheDecrypt() {} diff --git a/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp b/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp index 2a85edb7701ee5..722230484b6c13 100644 --- a/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp +++ b/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp @@ -33,7 +33,7 @@ namespace ov { namespace intel_cpu { namespace { -size_t replace_all(std::string& inout, std::string what, std::string with) { +size_t replace_all(std::string& inout, const std::string& what, const std::string& with) { std::size_t count{}; for (std::string::size_type pos{}; inout.npos != (pos = inout.find(what.data(), pos, what.length())); pos += with.length(), ++count) { diff --git a/src/plugins/intel_cpu/src/utils/debug_capabilities.h b/src/plugins/intel_cpu/src/utils/debug_capabilities.h index fa06c64992133f..4165f71885b2b9 100644 --- a/src/plugins/intel_cpu/src/utils/debug_capabilities.h +++ b/src/plugins/intel_cpu/src/utils/debug_capabilities.h @@ -14,6 +14,7 @@ # include # include # include +# include # include "edge.h" # include "nodes/node_config.h" @@ -60,8 +61,8 @@ class PrintableModel { public: PrintableModel(const ov::Model& model, std::string tag = "", std::string prefix = "") : model(model), - tag(tag), - prefix(prefix) {} + tag(std::move(tag)), + prefix(std::move(prefix)) {} const ov::Model& model; const std::string tag; const std::string prefix; @@ -86,9 +87,7 @@ struct PrintableDelta { class PrintableTimer { public: - PrintableTimer() : t0(std::chrono::high_resolution_clock::now()) { - t1 = t0; - } + PrintableTimer() : t0(std::chrono::high_resolution_clock::now()), t1(t0) {} std::chrono::high_resolution_clock::time_point t0; std::chrono::high_resolution_clock::time_point t1; @@ -208,9 +207,9 @@ struct EnforceInferPrcDebug { int count_limit = atoi(safe_getenv("OV_CPU_INFER_PRC_CNT", "9999999").c_str()); int count = 0; - EnforceInferPrcDebug() { - str_pos_pattern = std::getenv("OV_CPU_INFER_PRC_POS_PATTERN"); - str_neg_pattern = std::getenv("OV_CPU_INFER_PRC_NEG_PATTERN"); + EnforceInferPrcDebug() + : str_pos_pattern(std::getenv("OV_CPU_INFER_PRC_POS_PATTERN")), + str_neg_pattern(std::getenv("OV_CPU_INFER_PRC_NEG_PATTERN")) { if (str_pos_pattern || str_neg_pattern) { pattern_verbose = true; } else { @@ -245,7 +244,7 @@ struct EnforceInferPrcDebug { } } - bool enabled(std::string type, std::string name, std::string org_names) { + bool enabled(const std::string& type, const std::string& name, const std::string& org_names) { std::string tag = type + "@" + org_names; std::smatch match; bool matched = true; diff --git a/src/plugins/intel_cpu/src/utils/ngraph_utils.hpp b/src/plugins/intel_cpu/src/utils/ngraph_utils.hpp index 7507d4234a6b6e..f35c7bb8b60711 100644 --- a/src/plugins/intel_cpu/src/utils/ngraph_utils.hpp +++ b/src/plugins/intel_cpu/src/utils/ngraph_utils.hpp @@ -12,7 +12,7 @@ namespace ov { namespace intel_cpu { -inline std::string getRTInfoValue(const std::map& rtInfo, std::string paramName) { +inline std::string getRTInfoValue(const std::map& rtInfo, const std::string& paramName) { auto it = rtInfo.find(paramName); if (it != rtInfo.end()) { return it->second.as(); diff --git a/src/plugins/intel_cpu/src/utils/node_dumper.cpp b/src/plugins/intel_cpu/src/utils/node_dumper.cpp index 74eb472cd1c7e0..e5c2326ff95c76 100644 --- a/src/plugins/intel_cpu/src/utils/node_dumper.cpp +++ b/src/plugins/intel_cpu/src/utils/node_dumper.cpp @@ -113,11 +113,20 @@ static void dumpInternalBlobs(const NodePtr& node, const DebugCapsConfig& config } } +static std::string createDumpFilePath(const std::string& blobDumpDir, const std::string& fileName, int execIndex) { + auto execIndexStr = std::to_string(execIndex); + std::string dump_file; + dump_file.reserve(blobDumpDir.size() + execIndexStr.size() + fileName.size() + 4); + + dump_file.append(blobDumpDir).append("/#").append(execIndexStr).append("_").append(fileName); + + return dump_file; +} + void dumpInputBlobs(const NodePtr& node, const DebugCapsConfig& config, int count) { if (!shouldBeDumped(node, config, "IN")) return; - auto exec_order = std::to_string(node->getExecIndex()); std::string nodeName = node->getName(); formatNodeName(nodeName); @@ -133,7 +142,8 @@ void dumpInputBlobs(const NodePtr& node, const DebugCapsConfig& config, int coun if (file_name.size() > 240) file_name = file_name.substr(file_name.size() - 240); - auto dump_file = config.blobDumpDir + "/#" + exec_order + "_" + file_name; + std::string dump_file = createDumpFilePath(config.blobDumpDir, file_name, node->getExecIndex()); + std::cout << "Dump inputs: " << dump_file << std::endl; auto& desc = prEdge->getMemory().getDesc(); @@ -151,7 +161,6 @@ void dumpOutputBlobs(const NodePtr& node, const DebugCapsConfig& config, int cou if (!shouldBeDumped(node, config, "OUT")) return; - auto exec_order = std::to_string(node->getExecIndex()); std::string nodeName = node->getName(); formatNodeName(nodeName); @@ -166,7 +175,8 @@ void dumpOutputBlobs(const NodePtr& node, const DebugCapsConfig& config, int cou if (file_name.size() > 240) file_name = file_name.substr(file_name.size() - 240); - auto dump_file = config.blobDumpDir + "/#" + exec_order + "_" + file_name; + std::string dump_file = createDumpFilePath(config.blobDumpDir, file_name, node->getExecIndex()); + std::cout << "Dump outputs: " << dump_file << std::endl; auto& desc = childEdge->getMemory().getDesc(); diff --git a/src/plugins/intel_cpu/src/utils/plain_tensor.hpp b/src/plugins/intel_cpu/src/utils/plain_tensor.hpp index 81fac7a1b0ca0f..a27f29c0ab0e1b 100644 --- a/src/plugins/intel_cpu/src/utils/plain_tensor.hpp +++ b/src/plugins/intel_cpu/src/utils/plain_tensor.hpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #ifdef _WIN32 @@ -131,7 +132,7 @@ struct PlainTensor { return strides; } - PlainTensor(MemoryPtr mem) { + PlainTensor(const MemoryPtr& mem) { reset(mem); } @@ -149,7 +150,7 @@ struct PlainTensor { return *this; } - void reset(MemoryPtr mem) { + void reset(const MemoryPtr& mem) { auto mem_desc = mem->getDescWithType(); // not support block layout OPENVINO_ASSERT(mem_desc && mem_desc->getOrder().size() == mem->getStaticDims().size()); @@ -177,11 +178,7 @@ struct PlainTensor { int step; int count; // select all - tensor_index() { - start = 0; - end = INT_MAX; - step = 1; - } + tensor_index() : start(0), end(INT_MAX), step(1) {} bool slice_with_squeeze() { return end == INT_MIN; } diff --git a/src/plugins/intel_cpu/src/utils/rt_info/memory_formats_attribute.hpp b/src/plugins/intel_cpu/src/utils/rt_info/memory_formats_attribute.hpp index 080ebeb11d0c40..6ed7605f53323a 100644 --- a/src/plugins/intel_cpu/src/utils/rt_info/memory_formats_attribute.hpp +++ b/src/plugins/intel_cpu/src/utils/rt_info/memory_formats_attribute.hpp @@ -6,6 +6,7 @@ #include #include +#include #include "openvino/core/node.hpp" #include "openvino/op/util/op_types.hpp" @@ -23,7 +24,7 @@ class MemoryFormats : public ov::RuntimeAttribute { public: MemoryFormats() = default; - explicit MemoryFormats(const std::string& _memory_format) : memory_format(_memory_format) {} + explicit MemoryFormats(std::string _memory_format) : memory_format(std::move(_memory_format)) {} std::string to_string() const override { return memory_format; }; diff --git a/src/plugins/intel_cpu/src/utils/serialize.cpp b/src/plugins/intel_cpu/src/utils/serialize.cpp index e577573f49ead9..177cc817b8b3ab 100644 --- a/src/plugins/intel_cpu/src/utils/serialize.cpp +++ b/src/plugins/intel_cpu/src/utils/serialize.cpp @@ -4,6 +4,8 @@ #include "serialize.hpp" +#include + #include "openvino/core/descriptor_tensor.hpp" #include "openvino/core/parallel.hpp" #include "openvino/runtime/shared_buffer.hpp" @@ -39,7 +41,7 @@ ModelDeserializer::ModelDeserializer(std::istream& model_stream, : m_istream(model_stream), m_model_builder(std::move(fn)), m_decript_from_string(decript_from_string), - m_model_buffer(model_buffer) { + m_model_buffer(std::move(model_buffer)) { if (m_decript_from_string) { m_cache_decrypt.m_decrypt_str = decrypt_fn.m_decrypt_str; } else { diff --git a/src/plugins/intel_cpu/src/weights_cache.cpp b/src/plugins/intel_cpu/src/weights_cache.cpp index 63832c125c4d49..5c4caaeec257c0 100644 --- a/src/plugins/intel_cpu/src/weights_cache.cpp +++ b/src/plugins/intel_cpu/src/weights_cache.cpp @@ -5,6 +5,7 @@ #include "weights_cache.hpp" #include +#include #include "openvino/runtime/system_conf.hpp" @@ -12,11 +13,11 @@ namespace ov { namespace intel_cpu { WeightsSharing::SharedMemory::SharedMemory(std::unique_lock&& lock, - const MemoryInfo::Ptr& memory, + MemoryInfo::Ptr memory, MemoryPtr newPtr) : lock(std::move(lock)), - memory(memory), - newPtr(newPtr) {} + memory(std::move(memory)), + newPtr(std::move(newPtr)) {} WeightsSharing::SharedMemory::operator MemoryPtr() const { return memory->sharedMemory.lock(); @@ -31,7 +32,7 @@ void WeightsSharing::SharedMemory::valid(bool b) { } WeightsSharing::SharedMemory::Ptr WeightsSharing::findOrCreate(const std::string& key, - std::function create, + const std::function& create, bool valid) { MemoryInfo::Ptr ptr; MemoryPtr newPtr; diff --git a/src/plugins/intel_cpu/src/weights_cache.hpp b/src/plugins/intel_cpu/src/weights_cache.hpp index 4630bdc2132940..bb1d4e95ba80ec 100644 --- a/src/plugins/intel_cpu/src/weights_cache.hpp +++ b/src/plugins/intel_cpu/src/weights_cache.hpp @@ -32,7 +32,7 @@ class WeightsSharing { struct MemoryInfo { typedef std::shared_ptr Ptr; - MemoryInfo(MemoryPtr memoryPtr, bool valid) : sharedMemory(memoryPtr), valid(valid) {} + MemoryInfo(const MemoryPtr& memoryPtr, bool valid) : sharedMemory(memoryPtr), valid(valid) {} std::mutex guard; std::weak_ptr sharedMemory; @@ -46,7 +46,7 @@ class WeightsSharing { public: typedef std::shared_ptr Ptr; - SharedMemory(std::unique_lock&& lock, const MemoryInfo::Ptr& memory, MemoryPtr newPtr = nullptr); + SharedMemory(std::unique_lock&& lock, MemoryInfo::Ptr memory, MemoryPtr newPtr = nullptr); operator MemoryPtr() const; bool isValid() const; @@ -58,7 +58,9 @@ class WeightsSharing { MemoryPtr newPtr; }; - SharedMemory::Ptr findOrCreate(const std::string& key, std::function create, bool valid = true); + SharedMemory::Ptr findOrCreate(const std::string& key, + const std::function& create, + bool valid = true); SharedMemory::Ptr get(const std::string& key) const; diff --git a/src/plugins/intel_cpu/tests/unit/graph/dummy_node.hpp b/src/plugins/intel_cpu/tests/unit/graph/dummy_node.hpp index f459e866076a9c..2fca5933aa116c 100644 --- a/src/plugins/intel_cpu/tests/unit/graph/dummy_node.hpp +++ b/src/plugins/intel_cpu/tests/unit/graph/dummy_node.hpp @@ -68,7 +68,7 @@ class DummyNode : public Node { }; bool isExecutable() const override {return m_is_executable;} - void execute(dnnl::stream strm) override {}; + void execute(const dnnl::stream& strm) override {}; bool created() const override {return true;} bool needPrepareParams() const override {