From d5089527c47ecfe95c5c2c025d55f5c9983441fb Mon Sep 17 00:00:00 2001 From: Taylor Yeonbok Lee Date: Wed, 26 Jul 2023 08:38:26 +0900 Subject: [PATCH] Add new debug config disable_memory_reuse --- .../include/intel_gpu/runtime/debug_configuration.hpp | 1 + src/plugins/intel_gpu/src/graph/primitive_inst.cpp | 4 ++++ src/plugins/intel_gpu/src/runtime/debug_configuration.cpp | 5 ++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/debug_configuration.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/debug_configuration.hpp index 2f4eb3128be4ad..00c466325fbc67 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/runtime/debug_configuration.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/debug_configuration.hpp @@ -119,6 +119,7 @@ class debug_configuration { int max_kernels_per_batch; // Maximum number of kernels in a batch during compiling kernels int disable_async_compilation; // Disable async compilation int disable_dynamic_impl; // Disable dynamic implementation + int disable_memory_reuse; // Disable memmory reuse among layers std::set dump_iteration; // Dump n-th execution of network. static const debug_configuration *get_instance(); bool is_dumped_layer(const std::string& layerName, bool is_output = false) const; diff --git a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp index fdb6bb7a16e35b..62ff821371c272 100644 --- a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp +++ b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp @@ -1176,6 +1176,10 @@ memory::ptr primitive_inst::allocate_output(engine& _engine, memory_pool& pool, if (_node.is_in_shape_of_subgraph()) reusable_across_network = false; + GPU_DEBUG_GET_INSTANCE(debug_config); + GPU_DEBUG_IF(debug_config->disable_memory_reuse) { + reusable_across_network = false; + } // For outputs, cpu prim we want to have lockable alloc type // Also if the successor of a node is an cpu, then memory needs to be lockable. bool is_cpu = _node.get_selected_impl() ? _node.get_selected_impl()->is_cpu() : false; diff --git a/src/plugins/intel_gpu/src/runtime/debug_configuration.cpp b/src/plugins/intel_gpu/src/runtime/debug_configuration.cpp index ac92db226e99ca..059ed697f4d226 100644 --- a/src/plugins/intel_gpu/src/runtime/debug_configuration.cpp +++ b/src/plugins/intel_gpu/src/runtime/debug_configuration.cpp @@ -138,6 +138,7 @@ static void print_help_messages() { "the following order: number of iterations for pre-allocation(int), max size of single iteration in bytes(int), " "max per-dim allowed diff(int), unconditional buffers preallocation ratio(float). For example for disabling memory" "preallocation at all, you can use OV_GPU_MemPreallocationOptions='0 0 0 1.0'"); + message_list.emplace_back("OV_GPU_DisableMemoryReuse", "Disable memory reuse"); auto max_name_length_item = std::max_element(message_list.begin(), message_list.end(), [](std::pair& a, std::pair& b){ @@ -175,7 +176,8 @@ debug_configuration::debug_configuration() , serialize_compile(0) , max_kernels_per_batch(0) , disable_async_compilation(0) - , disable_dynamic_impl(0) { + , disable_dynamic_impl(0) + , disable_memory_reuse(0) { #ifdef GPU_DEBUG_CONFIG get_gpu_debug_env_var("Help", help); get_common_debug_env_var("Verbose", verbose); @@ -205,6 +207,7 @@ debug_configuration::debug_configuration() get_gpu_debug_env_var("MaxKernelsPerBatch", max_kernels_per_batch); get_gpu_debug_env_var("DisableAsyncCompilation", disable_async_compilation); get_gpu_debug_env_var("DisableDynamicImpl", disable_dynamic_impl); + get_gpu_debug_env_var("DisableMemoryReuse", disable_memory_reuse); std::string dump_iteration_str; get_gpu_debug_env_var("DumpIteration", dump_iteration_str); std::string mem_preallocation_params_str;