From b94ad71153e7345152ddc6b400e98017f2a53fd5 Mon Sep 17 00:00:00 2001 From: xufang Date: Sat, 21 Oct 2023 17:40:13 +0800 Subject: [PATCH] set callback executor to nullptr for GPU plugin --- .../src/dev/threading/istreams_executor.cpp | 53 ++++++++++++++++--- .../intel_gpu/src/plugin/compiled_model.cpp | 3 +- 2 files changed, 48 insertions(+), 8 deletions(-) diff --git a/src/inference/src/dev/threading/istreams_executor.cpp b/src/inference/src/dev/threading/istreams_executor.cpp index 0842a3cc753ea2..156d8e6f075b4d 100644 --- a/src/inference/src/dev/threading/istreams_executor.cpp +++ b/src/inference/src/dev/threading/istreams_executor.cpp @@ -559,14 +559,12 @@ IStreamsExecutor::Config IStreamsExecutor::Config::update_executor_config( int stream_nums_per_thread, IStreamsExecutor::Config::PreferredCoreType core_type, bool cpu_pinning) { - if ((core_type == ov::threading::IStreamsExecutor::Config::BIG || - core_type == ov::threading::IStreamsExecutor::Config::LITTLE) && - ov::get_available_cores_types().size() == 1) { + const auto proc_type_table = ov::get_proc_type_table(); + + if (proc_type_table.empty()) { return initial; } - const auto proc_type_table = ov::get_org_proc_type_table(); - IStreamsExecutor::Config config = initial; config._threadPreferredCoreType = core_type; @@ -585,7 +583,11 @@ IStreamsExecutor::Config IStreamsExecutor::Config::update_executor_config( config._streams = std::min(stream_nums, num_cores); - //create stream_info_table based on core type + if (config._streams == 0) { + return initial; + } + + // create stream_info_table based on core type std::vector stream_info(ov::CPU_STREAMS_TABLE_SIZE, 0); stream_info[ov::THREADS_PER_STREAM] = config._threadsPerStream; stream_info[ov::STREAM_NUMA_NODE_ID] = 0; @@ -607,9 +609,46 @@ IStreamsExecutor::Config IStreamsExecutor::Config::update_executor_config( stream_info[ov::PROC_TYPE] = ov::EFFICIENT_CORE_PROC; stream_info[ov::NUMBER_OF_STREAMS] = config._streams; config._streams_info_table.push_back(stream_info); + } else { + int total_streams = 0; + if (proc_type_table.size() == 1) { + for (int i = ov::MAIN_CORE_PROC; i <= ov::HYPER_THREADING_PROC; i++) { + if (proc_type_table[0][i] > 0) { + stream_info[ov::NUMBER_OF_STREAMS] = + (total_streams + proc_type_table[0][i] > config._streams ? config._streams - total_streams + : proc_type_table[0][i]); + stream_info[ov::PROC_TYPE] = i; + stream_info[ov::STREAM_NUMA_NODE_ID] = proc_type_table[0][PROC_NUMA_NODE_ID]; + stream_info[ov::STREAM_SOCKET_ID] = proc_type_table[0][PROC_SOCKET_ID]; + config._streams_info_table.push_back(stream_info); + total_streams += stream_info[ov::NUMBER_OF_STREAMS]; + } + if (total_streams >= config._streams) + break; + } + } else { + for (size_t i = 1; i < proc_type_table.size(); i++) { + for (size_t j = ov::MAIN_CORE_PROC; j < ov::HYPER_THREADING_PROC; j++) { + if (proc_type_table[i][j] > 0) { + stream_info[ov::NUMBER_OF_STREAMS] = + (total_streams + proc_type_table[i][j] > config._streams ? config._streams - total_streams + : proc_type_table[i][j]); + stream_info[ov::PROC_TYPE] = j; + stream_info[ov::STREAM_NUMA_NODE_ID] = proc_type_table[i][PROC_NUMA_NODE_ID]; + stream_info[ov::STREAM_SOCKET_ID] = proc_type_table[i][PROC_SOCKET_ID]; + config._streams_info_table.push_back(stream_info); + total_streams += stream_info[ov::NUMBER_OF_STREAMS]; + } + if (total_streams >= config._streams) + break; + } + if (total_streams >= config._streams) + break; + } + } } - if(cpu_pinning) { + if (cpu_pinning) { config._cpu_reservation = cpu_pinning; auto new_config = reserve_cpu_threads(config); config = new_config; diff --git a/src/plugins/intel_gpu/src/plugin/compiled_model.cpp b/src/plugins/intel_gpu/src/plugin/compiled_model.cpp index fc04e35748fe6c..ff2aaad57f4e8e 100644 --- a/src/plugins/intel_gpu/src/plugin/compiled_model.cpp +++ b/src/plugins/intel_gpu/src/plugin/compiled_model.cpp @@ -86,7 +86,8 @@ CompiledModel::CompiledModel(cldnn::BinaryInputBuffer ib, : ov::ICompiledModel(nullptr, plugin, wrap_if_old_api(context, plugin->is_new_api()), - create_task_executor(plugin, config)) + create_task_executor(plugin, config), + nullptr) , m_context(context) , m_config(config) , m_wait_executor(std::make_shared(ov::threading::IStreamsExecutor::Config{"Intel GPU plugin wait executor"}))