Skip to content

Commit

Permalink
[GPU] Draft, clean oneDNN cache in plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
p-durandin committed Jan 6, 2025
1 parent 552ba66 commit 8882fc8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/plugins/intel_gpu/src/plugin/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -852,8 +852,30 @@ uint32_t Plugin::get_optimal_batch_size(const ov::AnyMap& options) const {
return batch;
}

class PluginSentry {
public:
PluginSentry() {
#ifdef ENABLE_ONEDNN_FOR_GPU
// touch oneDNN mutex for correct static objects destruction
auto capacity = dnnl::get_primitive_cache_capacity();
dnnl::set_primitive_cache_capacity(0);
dnnl::set_primitive_cache_capacity(capacity);
#endif
}

~PluginSentry() {
#ifdef ENABLE_ONEDNN_FOR_GPU
// reset the capacity when plugin deleted
auto capacity = dnnl::get_primitive_cache_capacity();
dnnl::set_primitive_cache_capacity(0);
dnnl::set_primitive_cache_capacity(capacity);
#endif
}
};

} // namespace intel_gpu
} // namespace ov

static const ov::Version version = { CI_BUILD_NUMBER, "Intel GPU plugin" };
static ov::intel_gpu::PluginSentry sentry;
OV_DEFINE_PLUGIN_CREATE_FUNCTION(ov::intel_gpu::Plugin, version)

0 comments on commit 8882fc8

Please sign in to comment.