[GPU] Update debug config verbose option to show the name of tensors allocated (#7407)
Signed-off-by: Andrew Kwangwoong Park <andrew.kwangwoong.park@intel.com>
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "cldnn_remote_context.h"
|
||||
#include "cldnn_executable_network.h"
|
||||
#include "cldnn_itt.h"
|
||||
#include "cldnn/runtime/debug_configuration.hpp"
|
||||
#include <ie_algorithm.hpp>
|
||||
#include <debug.h>
|
||||
|
||||
@@ -622,6 +623,10 @@ void CLDNNInferRequest::allocate_inputs() {
|
||||
IE_THROW() << "Input layout for " << name << " is not found";
|
||||
}
|
||||
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << name << ": input blob]" << std::endl;
|
||||
}
|
||||
if (desc.getPrecision() == Precision::I16 || desc.getPrecision() == Precision::U16) {
|
||||
TensorDesc desc_fp32 = desc;
|
||||
desc_fp32.setPrecision(Precision::FP32);
|
||||
@@ -673,6 +678,10 @@ void CLDNNInferRequest::allocate_outputs() {
|
||||
const cldnn::layout output_layout = m_graph->GetNetwork()->get_output_memory(outputID)->get_layout();
|
||||
const TensorDesc& desc = no.second->getTensorDesc();
|
||||
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << no.first << ": output blob]" << std::endl;
|
||||
}
|
||||
auto blobPtr = create_device_blob(desc, output_layout);
|
||||
_deviceOutputs[no.first] = blobPtr;
|
||||
_outputs[no.first] = blobPtr;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "ngraph/op/util/op_types.hpp"
|
||||
|
||||
#include "cldnn/primitives/data.hpp"
|
||||
#include "cldnn/runtime/debug_configuration.hpp"
|
||||
|
||||
namespace CLDNNPlugin {
|
||||
|
||||
@@ -169,6 +170,10 @@ void CreateConstantOp(Program& p, const std::shared_ptr<ngraph::op::v0::Constant
|
||||
if (bufIter != p.blobMemCache.end()) {
|
||||
constPrimID = bufIter->second;
|
||||
} else {
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << initialconstPrimID << ": constant]" << std::endl;
|
||||
}
|
||||
cldnn::memory::ptr mem = p.GetEngine().allocate_memory(constLayout, false);
|
||||
auto& stream = p.GetEngine().get_program_stream();
|
||||
cldnn::mem_lock<char> lock{mem, stream};
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "cldnn/primitives/ctc_greedy_decoder.hpp"
|
||||
#include "cldnn/primitives/reorder.hpp"
|
||||
#include "cldnn/primitives/mutable_data.hpp"
|
||||
#include "cldnn/runtime/debug_configuration.hpp"
|
||||
|
||||
#include "transformations/utils/utils.hpp"
|
||||
|
||||
@@ -73,6 +74,10 @@ void CreateCommonCTCGreedyDecoderOp(Program& p, const std::shared_ptr<ngraph::No
|
||||
DefaultFormatForDims(op->get_output_shape(1).size()),
|
||||
CldnnTensorFromIEDims(op->get_output_shape(1)));
|
||||
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << layer_type_name_ID(op) << ": mutable data]" << std::endl;
|
||||
}
|
||||
shared_memory.emplace_back(p.GetEngine().allocate_memory(mutableLayout));
|
||||
|
||||
cldnn::primitive_id ctc_gd_mutable_id_w = layer_type_name_ID(op) + "_md_write";
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "cldnn/primitives/reorder.hpp"
|
||||
#include "cldnn/primitives/mutable_data.hpp"
|
||||
#include "cldnn/primitives/non_max_suppression.hpp"
|
||||
#include "cldnn/runtime/debug_configuration.hpp"
|
||||
|
||||
namespace CLDNNPlugin {
|
||||
|
||||
@@ -66,6 +67,7 @@ void CreateNonMaxSuppressionIEInternalOp(Program& p, const std::shared_ptr<ngrap
|
||||
std::size_t num_output = op->get_output_size();
|
||||
|
||||
std::vector<cldnn::memory::ptr> shared_memory;
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
switch (num_output) {
|
||||
case 3: {
|
||||
auto mutable_precision_second = op->get_output_element_type(2);
|
||||
@@ -77,6 +79,9 @@ void CreateNonMaxSuppressionIEInternalOp(Program& p, const std::shared_ptr<ngrap
|
||||
DefaultFormatForDims(op->get_output_shape(2).size()),
|
||||
CldnnTensorFromIEDims(op->get_output_shape(2)));
|
||||
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << layer_type_name_ID(op) << ": mutable data]" << std::endl;
|
||||
}
|
||||
shared_memory.emplace_back(p.GetEngine().allocate_memory(mutableLayoutSecond));
|
||||
|
||||
cldnn::primitive_id non_max_supression_mutable_id_w_second = layer_type_name_ID(op) + "_md_write_second";
|
||||
@@ -95,6 +100,9 @@ void CreateNonMaxSuppressionIEInternalOp(Program& p, const std::shared_ptr<ngrap
|
||||
cldnn::format::bfyx,
|
||||
cldnn::tensor(static_cast<int32_t>(outputIndices), 3, 1, 1));
|
||||
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << layer_type_name_ID(op) << ": mutable data]" << std::endl;
|
||||
}
|
||||
shared_memory.emplace_back(p.GetEngine().allocate_memory(mutableLayoutFirst));
|
||||
|
||||
cldnn::primitive_id non_max_supression_mutable_id_w_first = layer_type_name_ID(op) + "_md_write_first";
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "cldnn/primitives/proposal.hpp"
|
||||
#include "cldnn/primitives/mutable_data.hpp"
|
||||
#include "cldnn/runtime/debug_configuration.hpp"
|
||||
|
||||
namespace CLDNNPlugin {
|
||||
|
||||
@@ -62,6 +63,10 @@ void CreateProposalOp(Program& p, const std::shared_ptr<ngraph::op::v0::Proposal
|
||||
DefaultFormatForDims(op->get_output_shape(1).size()),
|
||||
CldnnTensorFromIEDims(op->get_output_shape(1)));
|
||||
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << layer_type_name_ID(op) << ": mutable data]" << std::endl;
|
||||
}
|
||||
auto shared_memory = p.GetEngine().allocate_memory(mutableLayout);
|
||||
|
||||
cldnn::primitive_id proposal_mutable_id_w = layer_type_name_ID(op) + "_md_write";
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "cldnn/primitives/arg_max_min.hpp"
|
||||
#include "cldnn/primitives/mutable_data.hpp"
|
||||
#include "cldnn/runtime/debug_configuration.hpp"
|
||||
|
||||
namespace CLDNNPlugin {
|
||||
|
||||
@@ -71,6 +72,10 @@ void CreateTopKOp(Program& p, const std::shared_ptr<ngraph::op::v1::TopK>& op) {
|
||||
DefaultFormatForDims(op->get_output_shape(1).size()),
|
||||
CldnnTensorFromIEDims(op->get_output_shape(1)));
|
||||
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << layer_type_name_ID(op) << ": mutable data]" << std::endl;
|
||||
}
|
||||
auto shared_memory = p.GetEngine().allocate_memory(mutableLayout);
|
||||
|
||||
cldnn::primitive_id argmax_mutable_id_w = layer_type_name_ID(op) + "_md_write";
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
#define GPU_DEBUG_IF(cond) if (0)
|
||||
#endif
|
||||
|
||||
#define GPU_DEBUG_COUT std::cout << debug_configuration::prefix
|
||||
#define GPU_DEBUG_COUT std::cout << cldnn::debug_configuration::prefix
|
||||
// Macro below is inserted to avoid unused variable warning when GPU_DEBUG_CONFIG is OFF
|
||||
#define GPU_DEBUG_GET_INSTANCE(name) auto name = cldnn::debug_configuration::get_instance(); (void)(name);
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "cldnn/runtime/memory.hpp"
|
||||
#include "cldnn/runtime/engine.hpp"
|
||||
#include "cldnn/runtime/memory_pool.hpp"
|
||||
#include "cldnn/runtime/debug_configuration.hpp"
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
@@ -136,6 +137,10 @@ memory::ptr memory_pool::get_from_non_padded_pool(const layout& layout,
|
||||
++it;
|
||||
}
|
||||
}
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << id << ": output]" << std::endl;
|
||||
}
|
||||
// didn't find anything for you? create new resource
|
||||
auto mem = alloc_memory(layout, type);
|
||||
{
|
||||
@@ -174,6 +179,10 @@ memory::ptr memory_pool::get_from_padded_pool(const layout& layout,
|
||||
memory_record({{id, network_id}}, mem, network_id, type));
|
||||
return mem;
|
||||
}
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << id << ": output]" << std::endl;
|
||||
}
|
||||
auto mem = alloc_memory(layout, type);
|
||||
std::list<memory_record> list = {memory_record({{id, network_id}}, mem, network_id, type)};
|
||||
_padded_pool.emplace(layout, std::move(list));
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "primitive_inst.h"
|
||||
#include "cldnn/graph/program.hpp"
|
||||
#include "cldnn/runtime/error_handler.hpp"
|
||||
#include "cldnn/runtime/debug_configuration.hpp"
|
||||
#include "kernel_selector_helper.h"
|
||||
#include "cldnn/graph/network.hpp"
|
||||
#include "register.hpp"
|
||||
@@ -46,6 +47,10 @@ struct typed_primitive_impl_ocl : public typed_primitive_impl<PType> {
|
||||
_kernels.emplace_back(other._kernels[k]->clone());
|
||||
}
|
||||
for (auto& mem : other._intermediates_memory) {
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << _kernel_data.params->layerID << ": internal buf]" << std::endl;
|
||||
}
|
||||
auto& engine = _outer.get_program().get_engine();
|
||||
auto new_mem = engine.allocate_memory(mem->get_layout(), mem->get_allocation_type());
|
||||
_intermediates_memory.push_back(new_mem);
|
||||
@@ -75,6 +80,10 @@ struct typed_primitive_impl_ocl : public typed_primitive_impl<PType> {
|
||||
{1, 1, 1, (tensor::value_type)(size / bpp)}};
|
||||
|
||||
auto& eimpl = arg.get_program().get_engine();
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << _kernel_data.params->layerID << ": internal buf]" << std::endl;
|
||||
}
|
||||
_intermediates_memory.push_back(eimpl.allocate_memory(expected_layout));
|
||||
}
|
||||
}
|
||||
|
||||
+14
-1
@@ -15,6 +15,7 @@
|
||||
#include "cldnn/runtime/memory.hpp"
|
||||
|
||||
#include "cldnn/runtime/error_handler.hpp"
|
||||
#include "cldnn/runtime/debug_configuration.hpp"
|
||||
#include "json_object.h"
|
||||
#include <string>
|
||||
#include <stack>
|
||||
@@ -174,8 +175,11 @@ memory::ptr primitive_inst::allocate_output() {
|
||||
allocation_type alloc_type = use_lockable_memory ?
|
||||
engine.get_lockable_preffered_memory_allocation_type(layout.format.is_image_2d())
|
||||
: allocation_type::usm_device;
|
||||
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
if (!_network.is_internal() && (_node.can_be_optimized() || _node.is_type<generic_layer>())) {
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << _node.id() << ": output]" << std::endl;
|
||||
}
|
||||
return _network.get_memory_from_pool(layout,
|
||||
_node.id(),
|
||||
_node.get_memory_dependencies(),
|
||||
@@ -183,12 +187,21 @@ memory::ptr primitive_inst::allocate_output() {
|
||||
false);
|
||||
} else if (_network.is_internal() && _node.is_output() && _node.is_type<generic_layer>() &&
|
||||
engine.supports_allocation(allocation_type::usm_device)) {
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << _node.id() << ": output]" << std::endl;
|
||||
}
|
||||
return engine.allocate_memory(layout, allocation_type::usm_device, false);
|
||||
} else if (_network.is_internal() && !_node.is_output() && _node.is_type<input_layout>()) {
|
||||
// Skip memory reset for input_layout primitives, since data will be copied from cldnn::data primitive
|
||||
// or just reuse primitive's memory
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << _node.id() << ": constant]" << std::endl;
|
||||
}
|
||||
return engine.allocate_memory(layout, alloc_type, false);
|
||||
} else if (_network.is_internal() || (!_node.can_share_buffer()) || _node.can_be_optimized() || _node.is_output()) {
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << _node.id() << ": output]" << std::endl;
|
||||
}
|
||||
return engine.allocate_memory(layout, alloc_type);
|
||||
} else {
|
||||
return _network.get_memory_from_pool(layout,
|
||||
|
||||
@@ -602,6 +602,10 @@ void program::transfer_memory_to_device() {
|
||||
|
||||
|
||||
if (alloc_type == allocation_type::usm_host || alloc_type == allocation_type::usm_shared) {
|
||||
GPU_DEBUG_GET_INSTANCE(debug_config);
|
||||
GPU_DEBUG_IF(debug_config->verbose >= 2) {
|
||||
GPU_DEBUG_COUT << "[" << data_node.id() << ": constant]" << std::endl;
|
||||
}
|
||||
// Allocate and transfer memory
|
||||
auto device_mem = mem.get_engine()->allocate_memory(data_node_layout, allocation_type::usm_device, false);
|
||||
device_mem->copy_from(get_stream(), mem);
|
||||
|
||||
Reference in New Issue
Block a user