[GPU] updated to enqueue only fully_connected layers for async build (#18891)
* updated to enqueue only fc for async build * updated use_async_compilation(), make_task_executor_config() and disabled gemm_onednn.impl_replacement_with_cldnn * added _num_async_build_threads * added gemm to the async compliation targets
This commit is contained in:
1 parent
70c8cf2a5f
commit
d278ff5786
5 files changed
+22
-14
No files matched your search
@@ -283,6 +283,7 @@ private:
|
||||
bool is_body_program;
|
||||
std::unique_ptr<ImplementationsCache> _impls_cache;
|
||||
const size_t _impls_cache_capacity = 10000;
|
||||
const int _num_async_build_threads = 1;
|
||||
std::unique_ptr<ICompilationContext> _compilation_context;
|
||||
|
||||
std::map<primitive_id, std::shared_ptr<program_node>> nodes_map;
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace cldnn {
|
||||
class CompilationContext : public ICompilationContext {
|
||||
public:
|
||||
CompilationContext(ov::threading::IStreamsExecutor::Config task_executor_config) : _task_executor_config(task_executor_config) {
|
||||
_task_executor_config._streams = 4;
|
||||
_task_executor = std::make_shared<ov::threading::CPUStreamsExecutor>(_task_executor_config);
|
||||
}
|
||||
|
||||
|
||||
@@ -351,6 +351,7 @@ protected:
|
||||
|
||||
virtual void update_shape();
|
||||
virtual event::ptr update_weights();
|
||||
bool use_async_compilation();
|
||||
// if primitive_inst doesn't replace impl to new impl(static impl with opt kerenl or dynamic impl), return false
|
||||
bool update_impl();
|
||||
event::ptr realloc_if_needed();
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "eltwise_inst.h"
|
||||
#include "deconvolution_inst.h"
|
||||
#include "shape_of_inst.h"
|
||||
#include "softmax_inst.h"
|
||||
#include "gemm_inst.h"
|
||||
#include "assign_inst.h"
|
||||
#include "read_value_inst.h"
|
||||
@@ -478,6 +479,17 @@ event::ptr primitive_inst::realloc_if_needed() {
|
||||
return ev;
|
||||
}
|
||||
|
||||
bool primitive_inst::use_async_compilation() {
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
GPU_DEBUG_IF(debug_config->disable_async_compilation) {
|
||||
return false;
|
||||
}
|
||||
return (_node->is_type<convolution>() ||
|
||||
_node->is_type<fully_connected>() ||
|
||||
_node->is_type<gemm>() ||
|
||||
_node->is_type<softmax>());
|
||||
}
|
||||
|
||||
bool primitive_inst::update_impl() {
|
||||
GPU_DEBUG_PROFILED_STAGE(instrumentation::pipeline_stage::update_implementation);
|
||||
auto prev_impl_str = _impl != nullptr ? _impl->get_kernel_name() : "nullptr";
|
||||
@@ -590,13 +602,6 @@ bool primitive_inst::update_impl() {
|
||||
}
|
||||
if (!cached_impl) {
|
||||
if (_dynamic_impl) {
|
||||
auto use_async_compilation = [&]() {
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
GPU_DEBUG_IF(debug_config->disable_async_compilation) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
if (use_async_compilation()) {
|
||||
auto& compilation_context = get_network().get_program()->get_compilation_context();
|
||||
compilation_context.push_task(updated_params_no_dyn_pad, [this, &compilation_context, updated_params_no_dyn_pad]() {
|
||||
@@ -611,10 +616,12 @@ bool primitive_inst::update_impl() {
|
||||
return;
|
||||
}
|
||||
|
||||
auto impl = _node->type()->choose_impl(*_node, updated_params_no_dyn_pad);
|
||||
if (!can_be_optimized()) {
|
||||
auto kernels = _program->get_kernels_cache().compile(updated_params_no_dyn_pad, impl->get_kernels_source());
|
||||
impl->set_kernels(kernels);
|
||||
auto impl = _node->type()->choose_impl(*_node, updated_params_no_dyn_pad);
|
||||
if (impl->get_kernels_source().size() > 0) {
|
||||
auto kernels = _program->get_kernels_cache().compile(updated_params_no_dyn_pad, impl->get_kernels_source());
|
||||
impl->set_kernels(kernels);
|
||||
}
|
||||
cache.add(updated_params_no_dyn_pad, impl->clone());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -124,9 +124,9 @@ static void adjust_num_cores(ov::threading::IStreamsExecutor::Config& config) {
|
||||
config._streams = std::min(config._streams, num_cores);
|
||||
}
|
||||
|
||||
static ov::threading::IStreamsExecutor::Config make_task_executor_config(const ExecutionConfig& config, std::string tags) {
|
||||
static ov::threading::IStreamsExecutor::Config make_task_executor_config(const ExecutionConfig& config, std::string tags, int num_streams = 0) {
|
||||
ov::threading::IStreamsExecutor::Config task_executor_config(tags, 1);
|
||||
task_executor_config._streams = config.get_property(ov::compilation_num_threads);
|
||||
task_executor_config._streams = (num_streams > 0) ? num_streams : config.get_property(ov::compilation_num_threads);
|
||||
auto priority = config.get_property(ov::intel_gpu::hint::host_task_priority);
|
||||
switch (priority) {
|
||||
case ov::hint::Priority::LOW: task_executor_config._threadPreferredCoreType = ov::threading::IStreamsExecutor::Config::LITTLE; break;
|
||||
@@ -214,7 +214,7 @@ void program::init_program() {
|
||||
kernel_selector::KernelBase::get_db().get_batch_header_str()));
|
||||
|
||||
_compilation_context = ICompilationContext::create(make_task_executor_config(_config,
|
||||
"Task executor config for CompilationContext in GPU plugin"));
|
||||
"Task executor config for CompilationContext in GPU plugin", _num_async_build_threads));
|
||||
|
||||
_impls_cache = cldnn::make_unique<ImplementationsCache>(_impls_cache_capacity);
|
||||
// Remove items of compilation context's internal queue when some impl is popped in kernels_cache
|
||||
|
||||
Reference in new issue
Block a user