Skip to content

Commit

Permalink
[GPU] fix compilation context to use kernel_impl_params as key (openv…
Browse files Browse the repository at this point in the history
…inotoolkit#18470)

* fixed aompilation context to use kernel_impl_params for key

* fixed the argument for push_task
  • Loading branch information
e-ddykim authored Jul 17, 2023
1 parent 5b522b5 commit 2c73916
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/plugins/intel_gpu/src/graph/compilation_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CompilationContext : public ICompilationContext {
_task_executor = std::make_shared<ov::threading::CPUStreamsExecutor>(_task_executor_config);
}

void push_task(size_t key, Task&& task) override {
void push_task(kernel_impl_params key, Task&& task) override {
if (_stop_compilation)
return;

Expand All @@ -29,7 +29,7 @@ class CompilationContext : public ICompilationContext {
}
}

void remove_keys(std::vector<size_t>&& keys) override {
void remove_keys(std::vector<kernel_impl_params>&& keys) override {
std::lock_guard<std::mutex> lock(_mutex);
if (!_task_keys.empty()) {
for (auto key : keys) {
Expand Down Expand Up @@ -65,7 +65,7 @@ class CompilationContext : public ICompilationContext {
ov::threading::IStreamsExecutor::Config _task_executor_config;
std::shared_ptr<ov::threading::IStreamsExecutor> _task_executor;
std::mutex _mutex;
std::unordered_set<size_t> _task_keys;
std::unordered_set<kernel_impl_params, kernel_impl_params::Hasher> _task_keys;
std::atomic_bool _stop_compilation{false};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
#include "openvino/runtime/threading/cpu_streams_executor.hpp"
#include <functional>
#include <memory>
#include "intel_gpu/graph/kernel_impl_params.hpp"

namespace cldnn {

class ICompilationContext {
public:
using Task = std::function<void()>;
virtual void push_task(size_t key, Task&& task) = 0;
virtual void remove_keys(std::vector<size_t>&& keys) = 0;
virtual void push_task(kernel_impl_params key, Task&& task) = 0;
virtual void remove_keys(std::vector<kernel_impl_params>&& keys) = 0;
virtual ~ICompilationContext() = default;
virtual bool is_stopped() = 0;
virtual void cancel() = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/primitive_inst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ bool primitive_inst::update_impl() {
};
if (use_async_compilation()) {
auto& compilation_context = get_network().get_program()->get_compilation_context();
compilation_context.push_task(updated_params_no_dyn_pad.hash(), [this, &compilation_context, updated_params_no_dyn_pad]() {
compilation_context.push_task(updated_params_no_dyn_pad, [this, &compilation_context, updated_params_no_dyn_pad]() {
if (compilation_context.is_stopped())
return;
auto _program = get_network().get_program();
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/src/graph/program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void program::init_program() {
// Remove items of compilation context's internal queue when some impl is popped in kernels_cache
// compilation context's queue check duplication of inserted task
_impls_cache->set_remove_item_callback([this](ImplementationsCache::ItemType& item) {
get_compilation_context().remove_keys({item.first.hash()});
get_compilation_context().remove_keys({item.first});
});
}

Expand Down

0 comments on commit 2c73916

Please sign in to comment.