update scheduling core type value (#17771)
* update scheduling core type value * update for comments * update for comments * fix code style issue
This commit is contained in:
parent
2ec9fe915c
commit
4ca8d40e43
@ -10,34 +10,36 @@
|
|||||||
namespace ov {
|
namespace ov {
|
||||||
namespace intel_cpu {
|
namespace intel_cpu {
|
||||||
|
|
||||||
std::vector<std::vector<int>> apply_scheduling_core_type(const ov::hint::SchedulingCoreType input_type,
|
std::vector<std::vector<int>> apply_scheduling_core_type(ov::hint::SchedulingCoreType& input_type,
|
||||||
const std::vector<std::vector<int>>& proc_type_table) {
|
const std::vector<std::vector<int>>& proc_type_table) {
|
||||||
std::vector<std::vector<int>> result_table = proc_type_table;
|
std::vector<std::vector<int>> result_table = proc_type_table;
|
||||||
|
|
||||||
|
auto update_proc_type_table = [&]() {
|
||||||
switch (input_type) {
|
switch (input_type) {
|
||||||
case ov::hint::SchedulingCoreType::ANY_CORE:
|
|
||||||
break;
|
|
||||||
case ov::hint::SchedulingCoreType::PCORE_ONLY:
|
case ov::hint::SchedulingCoreType::PCORE_ONLY:
|
||||||
if (proc_type_table[0][EFFICIENT_CORE_PROC] > 0) {
|
|
||||||
for (auto& i : result_table) {
|
for (auto& i : result_table) {
|
||||||
i[ALL_PROC] -= i[EFFICIENT_CORE_PROC];
|
i[ALL_PROC] -= i[EFFICIENT_CORE_PROC];
|
||||||
i[EFFICIENT_CORE_PROC] = 0;
|
i[EFFICIENT_CORE_PROC] = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case ov::hint::SchedulingCoreType::ECORE_ONLY:
|
case ov::hint::SchedulingCoreType::ECORE_ONLY:
|
||||||
if ((proc_type_table[0][EFFICIENT_CORE_PROC] > 0) &&
|
|
||||||
(proc_type_table[0][EFFICIENT_CORE_PROC] != proc_type_table[0][ALL_PROC])) {
|
|
||||||
for (auto& i : result_table) {
|
for (auto& i : result_table) {
|
||||||
i[ALL_PROC] -= i[MAIN_CORE_PROC] + i[HYPER_THREADING_PROC];
|
i[ALL_PROC] -= i[MAIN_CORE_PROC] + i[HYPER_THREADING_PROC];
|
||||||
i[MAIN_CORE_PROC] = 0;
|
i[MAIN_CORE_PROC] = 0;
|
||||||
i[HYPER_THREADING_PROC] = 0;
|
i[HYPER_THREADING_PROC] = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
OPENVINO_THROW("Unsupported core type!");
|
break;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (((input_type == ov::hint::SchedulingCoreType::PCORE_ONLY) && (proc_type_table[0][MAIN_CORE_PROC] == 0)) ||
|
||||||
|
((input_type == ov::hint::SchedulingCoreType::ECORE_ONLY) && (proc_type_table[0][EFFICIENT_CORE_PROC] == 0))) {
|
||||||
|
input_type = ov::hint::SchedulingCoreType::ANY_CORE;
|
||||||
|
}
|
||||||
|
|
||||||
|
update_proc_type_table();
|
||||||
|
|
||||||
return result_table;
|
return result_table;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace intel_cpu {
|
|||||||
* @param[in] proc_type_table candidate processors available at this time
|
* @param[in] proc_type_table candidate processors available at this time
|
||||||
* @return updated proc_type_table which removed unmatched processors
|
* @return updated proc_type_table which removed unmatched processors
|
||||||
*/
|
*/
|
||||||
std::vector<std::vector<int>> apply_scheduling_core_type(const ov::hint::SchedulingCoreType input_type,
|
std::vector<std::vector<int>> apply_scheduling_core_type(ov::hint::SchedulingCoreType& input_type,
|
||||||
const std::vector<std::vector<int>>& proc_type_table);
|
const std::vector<std::vector<int>>& proc_type_table);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,6 +20,7 @@ struct SchedulingCoreTypeTestCase {
|
|||||||
ov::hint::SchedulingCoreType input_type;
|
ov::hint::SchedulingCoreType input_type;
|
||||||
std::vector<std::vector<int>> proc_type_table;
|
std::vector<std::vector<int>> proc_type_table;
|
||||||
std::vector<std::vector<int>> result_table;
|
std::vector<std::vector<int>> result_table;
|
||||||
|
ov::hint::SchedulingCoreType output_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SchedulingCoreTypeTests : public CommonTestUtils::TestsCommon,
|
class SchedulingCoreTypeTests : public CommonTestUtils::TestsCommon,
|
||||||
@ -27,11 +28,13 @@ class SchedulingCoreTypeTests : public CommonTestUtils::TestsCommon,
|
|||||||
public:
|
public:
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
const auto& test_data = std::get<0>(GetParam());
|
const auto& test_data = std::get<0>(GetParam());
|
||||||
|
auto test_input_type = test_data.input_type;
|
||||||
|
|
||||||
std::vector<std::vector<int>> test_result_table =
|
std::vector<std::vector<int>> test_result_table =
|
||||||
ov::intel_cpu::apply_scheduling_core_type(test_data.input_type, test_data.proc_type_table);
|
ov::intel_cpu::apply_scheduling_core_type(test_input_type, test_data.proc_type_table);
|
||||||
|
|
||||||
ASSERT_EQ(test_data.result_table, test_result_table);
|
ASSERT_EQ(test_data.result_table, test_result_table);
|
||||||
|
ASSERT_EQ(test_data.output_type, test_input_type);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -39,36 +42,53 @@ SchedulingCoreTypeTestCase _2sockets_ALL = {
|
|||||||
ov::hint::SchedulingCoreType::ANY_CORE,
|
ov::hint::SchedulingCoreType::ANY_CORE,
|
||||||
{{208, 104, 0, 104}, {104, 52, 0, 52}, {104, 52, 0, 52}},
|
{{208, 104, 0, 104}, {104, 52, 0, 52}, {104, 52, 0, 52}},
|
||||||
{{208, 104, 0, 104}, {104, 52, 0, 52}, {104, 52, 0, 52}},
|
{{208, 104, 0, 104}, {104, 52, 0, 52}, {104, 52, 0, 52}},
|
||||||
|
ov::hint::SchedulingCoreType::ANY_CORE,
|
||||||
};
|
};
|
||||||
|
|
||||||
SchedulingCoreTypeTestCase _2sockets_P_CORE_ONLY = {
|
SchedulingCoreTypeTestCase _2sockets_P_CORE_ONLY = {
|
||||||
ov::hint::SchedulingCoreType::PCORE_ONLY,
|
ov::hint::SchedulingCoreType::PCORE_ONLY,
|
||||||
{{208, 104, 0, 104}, {104, 52, 0, 52}, {104, 52, 0, 52}},
|
{{208, 104, 0, 104}, {104, 52, 0, 52}, {104, 52, 0, 52}},
|
||||||
{{208, 104, 0, 104}, {104, 52, 0, 52}, {104, 52, 0, 52}},
|
{{208, 104, 0, 104}, {104, 52, 0, 52}, {104, 52, 0, 52}},
|
||||||
|
ov::hint::SchedulingCoreType::PCORE_ONLY,
|
||||||
};
|
};
|
||||||
|
|
||||||
SchedulingCoreTypeTestCase _2sockets_E_CORE_ONLY = {
|
SchedulingCoreTypeTestCase _2sockets_E_CORE_ONLY = {
|
||||||
ov::hint::SchedulingCoreType::ECORE_ONLY,
|
ov::hint::SchedulingCoreType::ECORE_ONLY,
|
||||||
{{208, 104, 0, 104}, {104, 52, 0, 52}, {104, 52, 0, 52}},
|
{{208, 104, 0, 104}, {104, 52, 0, 52}, {104, 52, 0, 52}},
|
||||||
{{208, 104, 0, 104}, {104, 52, 0, 52}, {104, 52, 0, 52}},
|
{{208, 104, 0, 104}, {104, 52, 0, 52}, {104, 52, 0, 52}},
|
||||||
|
ov::hint::SchedulingCoreType::ANY_CORE,
|
||||||
|
// ov::hint::scheduling_core_type returns ANY_CORE because the platform has no Ecores available to satisfy the
|
||||||
|
// user's request.
|
||||||
};
|
};
|
||||||
|
|
||||||
SchedulingCoreTypeTestCase _1sockets_ALL = {
|
SchedulingCoreTypeTestCase _1sockets_ALL = {
|
||||||
ov::hint::SchedulingCoreType::ANY_CORE,
|
ov::hint::SchedulingCoreType::ANY_CORE,
|
||||||
{{20, 6, 8, 6}},
|
{{20, 6, 8, 6}},
|
||||||
{{20, 6, 8, 6}},
|
{{20, 6, 8, 6}},
|
||||||
|
ov::hint::SchedulingCoreType::ANY_CORE,
|
||||||
};
|
};
|
||||||
|
|
||||||
SchedulingCoreTypeTestCase _1sockets_P_CORE_ONLY = {
|
SchedulingCoreTypeTestCase _1sockets_P_CORE_ONLY = {
|
||||||
ov::hint::SchedulingCoreType::PCORE_ONLY,
|
ov::hint::SchedulingCoreType::PCORE_ONLY,
|
||||||
{{20, 6, 8, 6}},
|
{{20, 6, 8, 6}},
|
||||||
{{12, 6, 0, 6}},
|
{{12, 6, 0, 6}},
|
||||||
|
ov::hint::SchedulingCoreType::PCORE_ONLY,
|
||||||
|
};
|
||||||
|
|
||||||
|
SchedulingCoreTypeTestCase _1sockets_P_CORE_ONLY_1 = {
|
||||||
|
ov::hint::SchedulingCoreType::PCORE_ONLY,
|
||||||
|
{{8, 0, 8, 0}},
|
||||||
|
{{8, 0, 8, 0}},
|
||||||
|
ov::hint::SchedulingCoreType::ANY_CORE,
|
||||||
|
// ov::hint::scheduling_core_type returns ANY_CORE because the platform has no Pcore available to satisfy the
|
||||||
|
// user's request.
|
||||||
};
|
};
|
||||||
|
|
||||||
SchedulingCoreTypeTestCase _1sockets_E_CORE_ONLY = {
|
SchedulingCoreTypeTestCase _1sockets_E_CORE_ONLY = {
|
||||||
ov::hint::SchedulingCoreType::ECORE_ONLY,
|
ov::hint::SchedulingCoreType::ECORE_ONLY,
|
||||||
{{20, 6, 8, 6}},
|
{{20, 6, 8, 6}},
|
||||||
{{8, 0, 8, 0}},
|
{{8, 0, 8, 0}},
|
||||||
|
ov::hint::SchedulingCoreType::ECORE_ONLY,
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_P(SchedulingCoreTypeTests, SchedulingCoreType) {}
|
TEST_P(SchedulingCoreTypeTests, SchedulingCoreType) {}
|
||||||
@ -80,6 +100,7 @@ INSTANTIATE_TEST_SUITE_P(SchedulingCoreTypeTable,
|
|||||||
_2sockets_E_CORE_ONLY,
|
_2sockets_E_CORE_ONLY,
|
||||||
_1sockets_ALL,
|
_1sockets_ALL,
|
||||||
_1sockets_P_CORE_ONLY,
|
_1sockets_P_CORE_ONLY,
|
||||||
|
_1sockets_P_CORE_ONLY_1,
|
||||||
_1sockets_E_CORE_ONLY));
|
_1sockets_E_CORE_ONLY));
|
||||||
|
|
||||||
struct UseHTTestCase {
|
struct UseHTTestCase {
|
||||||
|
Loading…
Reference in New Issue
Block a user