Skip to content

Commit

Permalink
Merge branch 'itikhono/bug_fix/moc_in_prepostprocessing' of https://g…
Browse files Browse the repository at this point in the history
…ithub.com/itikhono/openvino into itikhono/bug_fix/moc_in_prepostprocessing
  • Loading branch information
itikhono committed Feb 12, 2025
2 parents a01f3bd + 69475da commit 9ba35a5
Show file tree
Hide file tree
Showing 640 changed files with 1,644 additions and 3,300 deletions.
4 changes: 0 additions & 4 deletions src/common/snippets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ source_group("src" FILES ${LIBRARY_SRC})
source_group("include" FILES ${PUBLIC_HEADERS})

# Create static library
if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20)
set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}")
endif()

add_library(${TARGET_NAME} STATIC
${LIBRARY_SRC}
${PUBLIC_HEADERS})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#pragma once

#include "openvino/util/pp.hpp"
#include "snippets/lowered/linear_ir.hpp"
#include <typeinfo>
#if defined(SNIPPETS_DEBUG_CAPS) && !defined(_WIN32)
Expand Down Expand Up @@ -147,7 +148,7 @@ class KernelExecutorTable {
/*** Returns lambda function that contains current state of the table, and restores this state when called */
std::function<void()> get_state_reset() {
auto current_state = get_state();
return [=]() { reset_state(current_state); };
return [OV_CAPTURE_CPY_AND_THIS]() { reset_state(current_state); };
}

virtual ~KernelExecutorTable() = default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1417,13 +1417,7 @@ bool fuse_type_to_constant(const std::shared_ptr<ov::Node>& node,
new_const->validate_and_infer_types();
new_const->set_friendly_name(constant->get_friendly_name());
ov::copy_runtime_info(constant, new_const);

const auto& rt_info = node->get_rt_info();
auto weightless_caching_attr = rt_info.find(ov::WeightlessCacheAttribute::get_type_info_static());
if (weightless_caching_attr != rt_info.end()) {
new_const->get_rt_info()[ov::WeightlessCacheAttribute::get_type_info_static()] =
weightless_caching_attr->second;
}
ov::copy_weightless_cache_attr(constant, new_const);
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace ov {

OPENVINO_API void copy_weightless_cache_attr(const std::shared_ptr<Node>& from, const std::shared_ptr<Node>& to);

/**
* @brief Holds weightless caching attributes of a single constant.
*
Expand Down
10 changes: 10 additions & 0 deletions src/core/src/op/util/weightless_caching_attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@
bool ov::WeightlessCacheAttribute::is_copyable() const {
return false;
}

OPENVINO_API void ov::copy_weightless_cache_attr(const std::shared_ptr<ov::Node>& from,
const std::shared_ptr<ov::Node>& to) {
const auto& rt_info = from->get_rt_info();
auto weightless_caching_attr = rt_info.find(ov::WeightlessCacheAttribute::get_type_info_static());

if (weightless_caching_attr != rt_info.end()) {
to->get_rt_info()[ov::WeightlessCacheAttribute::get_type_info_static()] = weightless_caching_attr->second;
}
}
2 changes: 2 additions & 0 deletions src/core/src/pass/constant_folding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "openvino/cc/pass/itt.hpp"
#include "openvino/core/constant_fold_utils.hpp"
#include "openvino/core/rt_info.hpp"
#include "openvino/core/rt_info/weightless_caching_attributes.hpp"
#include "openvino/op/constant.hpp"
#include "openvino/op/convert.hpp"
#include "openvino/op/util/op_types.hpp"
Expand Down Expand Up @@ -153,6 +154,7 @@ bool ov::pass::ConstantFolding::run_on_model(const std::shared_ptr<ov::Model>& m
copy_runtime_info_from_input_values(original_node);
// Propagate runtime info attributes to replacement
copy_runtime_info(original_node, replacement_ptr);
ov::copy_weightless_cache_attr(original_node, replacement_ptr);

rewritten = true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/preprocess/pre_post_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ std::shared_ptr<Model> PrePostProcessor::build() {
// MO path : [fw model conversion -> PrePostProcessing -> MOC] -> nncf
// OVC path: [fw model conversion -> MOC] -> PrePostProcessing -> nncf
//
// Since nncf is applied with a not fully optimized model, extra FQ ops might appear,
// Since nncf is applied to a not fully optimized model, extra FQ ops might appear,
// which can affect both accuracy and performance.
// PrePostProcessing is not part of OVC, so we have to insert an additional
// Transformation calls inside PrePostProcessing.
Expand Down
8 changes: 0 additions & 8 deletions src/inference/dev_api/openvino/runtime/system_conf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,6 @@ OPENVINO_RUNTIME_API void reserve_available_cpus(const std::vector<std::vector<i
*/
OPENVINO_RUNTIME_API void set_cpu_used(const std::vector<int>& cpu_ids, const int used);

/**
* @brief Get socket id by current numa node id
* @ingroup ov_dev_api_system_conf
* @param[in] numa_node_id numa node id
* @return socket id
*/
OPENVINO_RUNTIME_API int get_socket_by_numa_node(int numa_node_id);

/**
* @brief Get original socket id by current socket id, the input socket id is recalculated after filtering (like
* numactl), while the original socket id is the original id before filtering
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void get_cur_stream_info(const int stream_id,
int& concurrency,
int& core_type,
int& numa_node_id,
int& socket_id,
int& max_threads_per_core);

/**
Expand Down
8 changes: 6 additions & 2 deletions src/inference/src/dev/threading/cpu_streams_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ struct CPUStreamsExecutor::Impl {
const int concurrency,
const int core_type,
const int numa_node_id,
const int socket_id,
const int max_threads_per_core) {
auto stream_processors = _impl->_config.get_stream_processor_ids();
_numaNodeId = std::max(0, numa_node_id);
_socketId = get_socket_by_numa_node(_numaNodeId);
_numaNodeId = numa_node_id;
_socketId = socket_id;
if (stream_type == STREAM_WITHOUT_PARAM) {
_taskArena.reset(new custom::task_arena{custom::task_arena::constraints{}
.set_max_concurrency(concurrency)
Expand Down Expand Up @@ -159,6 +160,7 @@ struct CPUStreamsExecutor::Impl {
int concurrency;
int cpu_core_type;
int numa_node_id;
int socket_id;
int max_threads_per_core;
StreamCreateType stream_type;
const auto org_proc_type_table = get_org_proc_type_table();
Expand All @@ -173,6 +175,7 @@ struct CPUStreamsExecutor::Impl {
concurrency,
cpu_core_type,
numa_node_id,
socket_id,
max_threads_per_core);
if (concurrency <= 0) {
return;
Expand All @@ -182,6 +185,7 @@ struct CPUStreamsExecutor::Impl {
concurrency,
cpu_core_type,
numa_node_id,
socket_id,
max_threads_per_core);
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ void get_cur_stream_info(const int stream_id,
int& concurrency,
int& core_type,
int& numa_node_id,
int& socket_id,
int& max_threads_per_core) {
int stream_total = 0;
size_t stream_info_id = 0;
Expand All @@ -36,6 +37,7 @@ void get_cur_stream_info(const int stream_id,
concurrency = streams_info_table[stream_info_id][THREADS_PER_STREAM];
core_type = streams_info_table[stream_info_id][PROC_TYPE];
numa_node_id = streams_info_table[stream_info_id][STREAM_NUMA_NODE_ID];
socket_id = streams_info_table[stream_info_id][STREAM_SOCKET_ID];
max_threads_per_core = 1;
if (core_type == ALL_PROC) {
for (size_t i = stream_info_id + 1; i < streams_info_table.size(); i++) {
Expand Down
24 changes: 0 additions & 24 deletions src/inference/src/system_conf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,6 @@ void reserve_available_cpus(const std::vector<std::vector<int>> streams_info_tab
const int cpu_status) {}
void set_cpu_used(const std::vector<int>& cpu_ids, const int used) {}

int get_socket_by_numa_node(int numa_node_id) {
return -1;
};

int get_org_socket_id(int socket_id) {
return -1;
}
Expand Down Expand Up @@ -352,16 +348,6 @@ void reserve_available_cpus(const std::vector<std::vector<int>> streams_info_tab
const int cpu_status) {}
void set_cpu_used(const std::vector<int>& cpu_ids, const int used) {}

int get_socket_by_numa_node(int numa_node_id) {
CPU& cpu = cpu_info();
for (size_t i = 0; i < cpu._proc_type_table.size(); i++) {
if (cpu._proc_type_table[i][PROC_NUMA_NODE_ID] == numa_node_id) {
return cpu._proc_type_table[i][PROC_SOCKET_ID];
}
}
return -1;
};

int get_org_socket_id(int socket_id) {
CPU& cpu = cpu_info();
auto iter = cpu._socketid_mapping_table.find(socket_id);
Expand Down Expand Up @@ -522,16 +508,6 @@ void set_cpu_used(const std::vector<int>& cpu_ids, const int used) {
}
}

int get_socket_by_numa_node(int numa_node_id) {
CPU& cpu = cpu_info();
for (int i = 0; i < cpu._processors; i++) {
if (cpu._cpu_mapping_table[i][CPU_MAP_NUMA_NODE_ID] == numa_node_id) {
return cpu._cpu_mapping_table[i][CPU_MAP_SOCKET_ID];
}
}
return -1;
}

int get_number_of_logical_cpu_cores(bool bigCoresOnly) {
int logical_cores = parallel_get_max_threads();
# if (OV_THREAD == OV_THREAD_TBB || OV_THREAD == OV_THREAD_TBB_AUTO)
Expand Down
2 changes: 2 additions & 0 deletions src/inference/tests/unit/cpu_stream_info_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class LinuxCpuStreamTypeTests : public ov::test::TestsCommon,
int test_concurrency;
int test_core_type;
int test_numa_node_id;
int test_socket_id = 0;
int test_max_threads_per_core;
get_cur_stream_info(i,
test_data._cpu_pinning,
Expand All @@ -72,6 +73,7 @@ class LinuxCpuStreamTypeTests : public ov::test::TestsCommon,
test_concurrency,
test_core_type,
test_numa_node_id,
test_socket_id,
test_max_threads_per_core);
test_stream_types.push_back(test_stream_type);
test_concurrencys.push_back(test_concurrency);
Expand Down
4 changes: 0 additions & 4 deletions src/plugins/intel_cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ endif()

set(TARGET_NAME "openvino_intel_cpu_plugin")

if((CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) AND CMAKE_CXX_STANDARD GREATER_EQUAL 20)
set(CMAKE_CXX_FLAGS "-Wno-error=deprecated ${CMAKE_CXX_FLAGS}")
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# C4267, 4244 issues from oneDNN headers conversion from 'XXX' to 'YYY', possible loss of data
ov_add_compiler_flags(/wd4018)
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/intel_cpu/src/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
# -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: >
-*,
Expand All @@ -58,7 +57,6 @@ Checks: >
-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
Expand Down
6 changes: 2 additions & 4 deletions src/plugins/intel_cpu/src/allocation_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#include <unordered_map>
#include <vector>

namespace ov {
namespace intel_cpu {
namespace ov::intel_cpu {

class Node;
class Edge;
Expand All @@ -22,5 +21,4 @@ struct AllocationContext {
std::vector<size_t> syncPoints;
};

} // namespace intel_cpu
} // namespace ov
} // namespace ov::intel_cpu
6 changes: 2 additions & 4 deletions src/plugins/intel_cpu/src/cache/multi_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

#include "multi_cache.h"

namespace ov {
namespace intel_cpu {
namespace ov::intel_cpu {

std::atomic_size_t MultiCache::_typeIdCounter{0};

} // namespace intel_cpu
} // namespace ov
} // namespace ov::intel_cpu
8 changes: 3 additions & 5 deletions src/plugins/intel_cpu/src/compiled_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@

using namespace ov::threading;

namespace ov {
namespace intel_cpu {
namespace ov::intel_cpu {

struct ImmediateSerialExecutor : public ov::threading::ITaskExecutor {
void run(ov::threading::Task task) override {
Expand Down Expand Up @@ -153,7 +152,7 @@ CompiledModel::GraphGuard::Lock CompiledModel::get_graph() const {
auto streamsExecutor = std::dynamic_pointer_cast<IStreamsExecutor>(m_task_executor);
if (nullptr != streamsExecutor) {
streamId = streamsExecutor->get_stream_id();
socketId = streamsExecutor->get_socket_id();
socketId = std::max(0, streamsExecutor->get_socket_id());
}
auto graphLock = GraphGuard::Lock(m_graphs[streamId % m_graphs.size()]);
if (!graphLock._graph.IsReady()) {
Expand Down Expand Up @@ -362,5 +361,4 @@ void CompiledModel::release_memory() {
}
}

} // namespace intel_cpu
} // namespace ov
} // namespace ov::intel_cpu
6 changes: 2 additions & 4 deletions src/plugins/intel_cpu/src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
#include "utils/debug_capabilities.h"
#include "utils/precision_support.h"

namespace ov {
namespace intel_cpu {
namespace ov::intel_cpu {

using namespace ov::threading;
using namespace dnnl::impl::cpu::x64;
Expand Down Expand Up @@ -509,5 +508,4 @@ void Config::applyRtInfo(const std::shared_ptr<const ov::Model>& model) {
}
}

} // namespace intel_cpu
} // namespace ov
} // namespace ov::intel_cpu
6 changes: 2 additions & 4 deletions src/plugins/intel_cpu/src/cpu_map_scheduling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include "openvino/runtime/system_conf.hpp"
#include "openvino/runtime/threading/cpu_streams_info.hpp"

namespace ov {
namespace intel_cpu {
namespace ov::intel_cpu {

std::vector<std::vector<int>> apply_scheduling_core_type(ov::hint::SchedulingCoreType& input_type,
const std::vector<std::vector<int>>& proc_type_table) {
Expand Down Expand Up @@ -106,5 +105,4 @@ bool get_cpu_pinning(bool& input_value,
return result_value;
}

} // namespace intel_cpu
} // namespace ov
} // namespace ov::intel_cpu
6 changes: 2 additions & 4 deletions src/plugins/intel_cpu/src/cpu_map_scheduling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
#include "openvino/runtime/properties.hpp"
#include "openvino/runtime/threading/istreams_executor.hpp"

namespace ov {
namespace intel_cpu {
namespace ov::intel_cpu {

/**
* @brief Limit available CPU resource in processors type table according to scheduling core type property
Expand Down Expand Up @@ -55,5 +54,4 @@ bool get_cpu_pinning(bool& input_value,
const std::vector<std::vector<int>>& proc_type_table,
const std::vector<std::vector<int>>& streams_info_table);

} // namespace intel_cpu
} // namespace ov
} // namespace ov::intel_cpu
6 changes: 2 additions & 4 deletions src/plugins/intel_cpu/src/cpu_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
# include <utility>
#endif

namespace ov {
namespace intel_cpu {
namespace ov::intel_cpu {
template <>
DnnlMemoryDescPtr IMemory::getDescWithType<DnnlMemoryDesc, 0, 0>() const {
return MemoryDescUtils::convertToDnnlMemoryDesc(getDescPtr());
Expand Down Expand Up @@ -729,5 +728,4 @@ MemoryPtr split_vertical(const dnnl::engine& eng,
return ptr;
}

} // namespace intel_cpu
} // namespace ov
} // namespace ov::intel_cpu
6 changes: 2 additions & 4 deletions src/plugins/intel_cpu/src/cpu_shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

#include "utils/general_utils.h"

namespace ov {
namespace intel_cpu {
namespace ov::intel_cpu {

bool Shape::isCompatible(const VectorDims& vecDims) const {
if (getRank() != vecDims.size()) {
Expand Down Expand Up @@ -77,5 +76,4 @@ Shape mergeShapes(const Shape& lhs, const Shape& rhs) {
return Shape{resultMinDims, resultMaxDims};
}

} // namespace intel_cpu
} // namespace ov
} // namespace ov::intel_cpu
Loading

0 comments on commit 9ba35a5

Please sign in to comment.