Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GPU] Enable oneDNN primitive cache and apply cache cleanup at plugin…
Browse files Browse the repository at this point in the history
… destruction
sshlyapn committed Feb 8, 2024
1 parent 5b09cc7 commit 16e6aba
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/plugins/intel_gpu/include/intel_gpu/plugin/plugin.hpp
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ class Plugin : public ov::IPlugin {

public:
Plugin();
~Plugin();

std::shared_ptr<ov::ICompiledModel> compile_model(const std::shared_ptr<const ov::Model>& model,
const ov::AnyMap& properties) const override;
9 changes: 9 additions & 0 deletions src/plugins/intel_gpu/src/plugin/plugin.cpp
Original file line number Diff line number Diff line change
@@ -160,6 +160,15 @@ Plugin::Plugin() {
m_compiled_model_runtime_properties["OV_VERSION"] = ov_version.buildNumber;
}

Plugin::~Plugin() {
#ifdef ENABLE_ONEDNN_FOR_GPU
// To prevent hanging during oneDNN's primitive cache desctruction,
// trigger earlier cache cleanup by setting its capacity to 0.
// Related ticket: 106154.
dnnl::set_primitive_cache_capacity(0);
#endif
}

std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<const ov::Model>& model, const ov::AnyMap& orig_config) const {
OV_ITT_SCOPED_TASK(itt::domains::intel_gpu_plugin, "Plugin::compile_model");
std::string device_id = get_device_id(orig_config);
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ if(ENABLE_ONEDNN_FOR_GPU)
"-DDNNL_LIBRARY_NAME=${DNNL_GPU_LIBRARY_NAME}"
"-DCMAKE_INSTALL_PREFIX=${ONEDNN_INSTALL_DIR}"
"-DDNNL_ENABLE_CONCURRENT_EXEC=ON"
"-DDNNL_ENABLE_PRIMITIVE_CACHE=OFF"
"-DDNNL_ENABLE_PRIMITIVE_CACHE=ON"
"-DDNNL_ENABLE_WORKLOAD=INFERENCE"
"-DDNNL_ENABLE_JIT_PROFILING=${BUILD_SHARED_LIBS}"
"-DDNNL_ENABLE_ITT_TASKS=${BUILD_SHARED_LIBS}"

0 comments on commit 16e6aba

Please sign in to comment.