Skip to content

Commit ba96b8f

Browse files
authored
Merge branch 'openvinotoolkit:master' into softmax_cross_entropy_loss_for_onnx_fe
2 parents 3e4d35f + a6cdc76 commit ba96b8f

File tree

21 files changed

+361
-220
lines changed

21 files changed

+361
-220
lines changed

src/common/transformations/src/transformations/convert_precision.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,13 +1417,7 @@ bool fuse_type_to_constant(const std::shared_ptr<ov::Node>& node,
14171417
new_const->validate_and_infer_types();
14181418
new_const->set_friendly_name(constant->get_friendly_name());
14191419
ov::copy_runtime_info(constant, new_const);
1420-
1421-
const auto& rt_info = node->get_rt_info();
1422-
auto weightless_caching_attr = rt_info.find(ov::WeightlessCacheAttribute::get_type_info_static());
1423-
if (weightless_caching_attr != rt_info.end()) {
1424-
new_const->get_rt_info()[ov::WeightlessCacheAttribute::get_type_info_static()] =
1425-
weightless_caching_attr->second;
1426-
}
1420+
ov::copy_weightless_cache_attr(constant, new_const);
14271421
return true;
14281422
}
14291423
return false;

src/core/dev_api/openvino/core/rt_info/weightless_caching_attributes.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
namespace ov {
1212

13+
OPENVINO_API void copy_weightless_cache_attr(const std::shared_ptr<Node>& from, const std::shared_ptr<Node>& to);
14+
1315
/**
1416
* @brief Holds weightless caching attributes of a single constant.
1517
*

src/core/src/op/util/weightless_caching_attributes.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,13 @@
77
bool ov::WeightlessCacheAttribute::is_copyable() const {
88
return false;
99
}
10+
11+
OPENVINO_API void ov::copy_weightless_cache_attr(const std::shared_ptr<ov::Node>& from,
12+
const std::shared_ptr<ov::Node>& to) {
13+
const auto& rt_info = from->get_rt_info();
14+
auto weightless_caching_attr = rt_info.find(ov::WeightlessCacheAttribute::get_type_info_static());
15+
16+
if (weightless_caching_attr != rt_info.end()) {
17+
to->get_rt_info()[ov::WeightlessCacheAttribute::get_type_info_static()] = weightless_caching_attr->second;
18+
}
19+
}

src/core/src/pass/constant_folding.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "openvino/cc/pass/itt.hpp"
88
#include "openvino/core/constant_fold_utils.hpp"
99
#include "openvino/core/rt_info.hpp"
10+
#include "openvino/core/rt_info/weightless_caching_attributes.hpp"
1011
#include "openvino/op/constant.hpp"
1112
#include "openvino/op/convert.hpp"
1213
#include "openvino/op/util/op_types.hpp"
@@ -153,6 +154,7 @@ bool ov::pass::ConstantFolding::run_on_model(const std::shared_ptr<ov::Model>& m
153154
copy_runtime_info_from_input_values(original_node);
154155
// Propagate runtime info attributes to replacement
155156
copy_runtime_info(original_node, replacement_ptr);
157+
ov::copy_weightless_cache_attr(original_node, replacement_ptr);
156158

157159
rewritten = true;
158160
}

src/inference/dev_api/openvino/runtime/system_conf.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -295,14 +295,6 @@ OPENVINO_RUNTIME_API void reserve_available_cpus(const std::vector<std::vector<i
295295
*/
296296
OPENVINO_RUNTIME_API void set_cpu_used(const std::vector<int>& cpu_ids, const int used);
297297

298-
/**
299-
* @brief Get socket id by current numa node id
300-
* @ingroup ov_dev_api_system_conf
301-
* @param[in] numa_node_id numa node id
302-
* @return socket id
303-
*/
304-
OPENVINO_RUNTIME_API int get_socket_by_numa_node(int numa_node_id);
305-
306298
/**
307299
* @brief Get original socket id by current socket id, the input socket id is recalculated after filtering (like
308300
* numactl), while the original socket id is the original id before filtering

src/inference/dev_api/openvino/runtime/threading/cpu_streams_executor_internal.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ void get_cur_stream_info(const int stream_id,
4242
int& concurrency,
4343
int& core_type,
4444
int& numa_node_id,
45+
int& socket_id,
4546
int& max_threads_per_core);
4647

4748
/**

src/inference/src/dev/threading/cpu_streams_executor.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,11 @@ struct CPUStreamsExecutor::Impl {
104104
const int concurrency,
105105
const int core_type,
106106
const int numa_node_id,
107+
const int socket_id,
107108
const int max_threads_per_core) {
108109
auto stream_processors = _impl->_config.get_stream_processor_ids();
109-
_numaNodeId = std::max(0, numa_node_id);
110-
_socketId = get_socket_by_numa_node(_numaNodeId);
110+
_numaNodeId = numa_node_id;
111+
_socketId = socket_id;
111112
if (stream_type == STREAM_WITHOUT_PARAM) {
112113
_taskArena.reset(new custom::task_arena{custom::task_arena::constraints{}
113114
.set_max_concurrency(concurrency)
@@ -159,6 +160,7 @@ struct CPUStreamsExecutor::Impl {
159160
int concurrency;
160161
int cpu_core_type;
161162
int numa_node_id;
163+
int socket_id;
162164
int max_threads_per_core;
163165
StreamCreateType stream_type;
164166
const auto org_proc_type_table = get_org_proc_type_table();
@@ -173,6 +175,7 @@ struct CPUStreamsExecutor::Impl {
173175
concurrency,
174176
cpu_core_type,
175177
numa_node_id,
178+
socket_id,
176179
max_threads_per_core);
177180
if (concurrency <= 0) {
178181
return;
@@ -182,6 +185,7 @@ struct CPUStreamsExecutor::Impl {
182185
concurrency,
183186
cpu_core_type,
184187
numa_node_id,
188+
socket_id,
185189
max_threads_per_core);
186190
}
187191
#endif

src/inference/src/dev/threading/cpu_streams_executor_internal.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ void get_cur_stream_info(const int stream_id,
2121
int& concurrency,
2222
int& core_type,
2323
int& numa_node_id,
24+
int& socket_id,
2425
int& max_threads_per_core) {
2526
int stream_total = 0;
2627
size_t stream_info_id = 0;
@@ -36,6 +37,7 @@ void get_cur_stream_info(const int stream_id,
3637
concurrency = streams_info_table[stream_info_id][THREADS_PER_STREAM];
3738
core_type = streams_info_table[stream_info_id][PROC_TYPE];
3839
numa_node_id = streams_info_table[stream_info_id][STREAM_NUMA_NODE_ID];
40+
socket_id = streams_info_table[stream_info_id][STREAM_SOCKET_ID];
3941
max_threads_per_core = 1;
4042
if (core_type == ALL_PROC) {
4143
for (size_t i = stream_info_id + 1; i < streams_info_table.size(); i++) {

src/inference/src/system_conf.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -285,10 +285,6 @@ void reserve_available_cpus(const std::vector<std::vector<int>> streams_info_tab
285285
const int cpu_status) {}
286286
void set_cpu_used(const std::vector<int>& cpu_ids, const int used) {}
287287

288-
int get_socket_by_numa_node(int numa_node_id) {
289-
return -1;
290-
};
291-
292288
int get_org_socket_id(int socket_id) {
293289
return -1;
294290
}
@@ -352,16 +348,6 @@ void reserve_available_cpus(const std::vector<std::vector<int>> streams_info_tab
352348
const int cpu_status) {}
353349
void set_cpu_used(const std::vector<int>& cpu_ids, const int used) {}
354350

355-
int get_socket_by_numa_node(int numa_node_id) {
356-
CPU& cpu = cpu_info();
357-
for (size_t i = 0; i < cpu._proc_type_table.size(); i++) {
358-
if (cpu._proc_type_table[i][PROC_NUMA_NODE_ID] == numa_node_id) {
359-
return cpu._proc_type_table[i][PROC_SOCKET_ID];
360-
}
361-
}
362-
return -1;
363-
};
364-
365351
int get_org_socket_id(int socket_id) {
366352
CPU& cpu = cpu_info();
367353
auto iter = cpu._socketid_mapping_table.find(socket_id);
@@ -522,16 +508,6 @@ void set_cpu_used(const std::vector<int>& cpu_ids, const int used) {
522508
}
523509
}
524510

525-
int get_socket_by_numa_node(int numa_node_id) {
526-
CPU& cpu = cpu_info();
527-
for (int i = 0; i < cpu._processors; i++) {
528-
if (cpu._cpu_mapping_table[i][CPU_MAP_NUMA_NODE_ID] == numa_node_id) {
529-
return cpu._cpu_mapping_table[i][CPU_MAP_SOCKET_ID];
530-
}
531-
}
532-
return -1;
533-
}
534-
535511
int get_number_of_logical_cpu_cores(bool bigCoresOnly) {
536512
int logical_cores = parallel_get_max_threads();
537513
# if (OV_THREAD == OV_THREAD_TBB || OV_THREAD == OV_THREAD_TBB_AUTO)

src/inference/tests/unit/cpu_stream_info_test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class LinuxCpuStreamTypeTests : public ov::test::TestsCommon,
6363
int test_concurrency;
6464
int test_core_type;
6565
int test_numa_node_id;
66+
int test_socket_id = 0;
6667
int test_max_threads_per_core;
6768
get_cur_stream_info(i,
6869
test_data._cpu_pinning,
@@ -72,6 +73,7 @@ class LinuxCpuStreamTypeTests : public ov::test::TestsCommon,
7273
test_concurrency,
7374
test_core_type,
7475
test_numa_node_id,
76+
test_socket_id,
7577
test_max_threads_per_core);
7678
test_stream_types.push_back(test_stream_type);
7779
test_concurrencys.push_back(test_concurrency);

0 commit comments

Comments
 (0)