binding pcore for stream calculation (#19550)
* binding pcore for stream calculation * remove useless branch * modify the function of query cache size * fix compilation error * use MT2.0 interface * bind core when there is ecore * initialize Xbyak::util::Cpu object at the begining of compile_model * restore the file * initialize Xbyak::util::Cpu object at the beginning of cpu plugin * remove unused header * extract task executor creation into a separate function --------- Co-authored-by: Wanglei Shen <wanglei.shen@intel.com>
This commit is contained in:
@@ -72,6 +72,14 @@ public:
|
||||
* @endcond
|
||||
*/
|
||||
virtual ~ExecutorManager() = default;
|
||||
|
||||
/**
|
||||
* @brief create a temporary executor to execute the specific task
|
||||
* @param core_type cpu core type
|
||||
* @param task task to be performed
|
||||
*/
|
||||
virtual void execute_task_by_streams_executor(ov::threading::IStreamsExecutor::Config::PreferredCoreType core_type,
|
||||
ov::threading::Task task) = 0;
|
||||
};
|
||||
|
||||
OPENVINO_API std::shared_ptr<ExecutorManager> executor_manager();
|
||||
|
||||
@@ -34,6 +34,8 @@ public:
|
||||
void clear(const std::string& id = {}) override;
|
||||
void set_property(const ov::AnyMap& properties) override;
|
||||
ov::Any get_property(const std::string& name) const override;
|
||||
void execute_task_by_streams_executor(ov::threading::IStreamsExecutor::Config::PreferredCoreType core_type,
|
||||
ov::threading::Task task) override;
|
||||
|
||||
private:
|
||||
void reset_tbb();
|
||||
@@ -176,6 +178,18 @@ void ExecutorManagerImpl::clear(const std::string& id) {
|
||||
}
|
||||
}
|
||||
|
||||
void ExecutorManagerImpl::execute_task_by_streams_executor(
|
||||
ov::threading::IStreamsExecutor::Config::PreferredCoreType core_type,
|
||||
ov::threading::Task task) {
|
||||
ov::threading::IStreamsExecutor::Config streamsConfig("StreamsExecutor");
|
||||
streamsConfig.update_executor_config(1, 1, core_type, false);
|
||||
if (!streamsConfig._streams_info_table.empty()) {
|
||||
auto taskExecutor = std::make_shared<ov::threading::CPUStreamsExecutor>(streamsConfig);
|
||||
std::vector<Task> tasks{std::move(task)};
|
||||
taskExecutor->run_and_wait(tasks);
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class ExecutorManagerHolder {
|
||||
|
||||
@@ -592,12 +592,16 @@ void IStreamsExecutor::Config::update_executor_config(int stream_nums,
|
||||
stream_info[ov::STREAM_SOCKET_ID] = 0;
|
||||
if (core_type == ov::threading::IStreamsExecutor::Config::BIG) {
|
||||
if (proc_type_table[0][ov::MAIN_CORE_PROC] < _streams) {
|
||||
stream_info[ov::NUMBER_OF_STREAMS] = proc_type_table[0][ov::MAIN_CORE_PROC];
|
||||
stream_info[ov::PROC_TYPE] = ov::MAIN_CORE_PROC;
|
||||
_streams_info_table.push_back(stream_info);
|
||||
stream_info[ov::NUMBER_OF_STREAMS] = proc_type_table[0][ov::HYPER_THREADING_PROC];
|
||||
stream_info[ov::PROC_TYPE] = ov::HYPER_THREADING_PROC;
|
||||
_streams_info_table.push_back(stream_info);
|
||||
if (proc_type_table[0][ov::MAIN_CORE_PROC] > 0) {
|
||||
stream_info[ov::NUMBER_OF_STREAMS] = proc_type_table[0][ov::MAIN_CORE_PROC];
|
||||
stream_info[ov::PROC_TYPE] = ov::MAIN_CORE_PROC;
|
||||
_streams_info_table.push_back(stream_info);
|
||||
}
|
||||
if (proc_type_table[0][ov::HYPER_THREADING_PROC] > 0) {
|
||||
stream_info[ov::NUMBER_OF_STREAMS] = proc_type_table[0][ov::HYPER_THREADING_PROC];
|
||||
stream_info[ov::PROC_TYPE] = ov::HYPER_THREADING_PROC;
|
||||
_streams_info_table.push_back(stream_info);
|
||||
}
|
||||
} else {
|
||||
stream_info[ov::PROC_TYPE] = ov::MAIN_CORE_PROC;
|
||||
stream_info[ov::NUMBER_OF_STREAMS] = _streams;
|
||||
|
||||
@@ -171,6 +171,10 @@ Engine::Engine() :
|
||||
deviceFullName(getDeviceFullName()),
|
||||
specialSetup(new CPUSpecialSetup) {
|
||||
set_device_name("CPU");
|
||||
// Initialize Xbyak::util::Cpu object on Pcore for hybrid cores machine
|
||||
get_executor_manager()->execute_task_by_streams_executor(IStreamsExecutor::Config::PreferredCoreType::BIG, [] {
|
||||
dnnl::impl::cpu::x64::cpu();
|
||||
});
|
||||
extensionManager->AddExtension(std::make_shared<Extension>());
|
||||
#if defined(OV_CPU_WITH_ACL)
|
||||
scheduler_guard = SchedulerGuard::instance();
|
||||
|
||||
Reference in New Issue
Block a user