From d03d7afef847b4ce20f0f8918e4634941ea9827f Mon Sep 17 00:00:00 2001 From: Ryan Hill <38674843+RyanUnderhill@users.noreply.github.com> Date: Wed, 25 May 2022 10:08:33 -0700 Subject: [PATCH] Fix build errors when building with enable_memory_profile (#11617) --- onnxruntime/core/framework/allocation_planner.cc | 2 +- onnxruntime/core/framework/memory_info.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/onnxruntime/core/framework/allocation_planner.cc b/onnxruntime/core/framework/allocation_planner.cc index d1720c8037..842a5fef8d 100644 --- a/onnxruntime/core/framework/allocation_planner.cc +++ b/onnxruntime/core/framework/allocation_planner.cc @@ -886,7 +886,7 @@ class PlannerImpl { #if !defined(ORT_MINIMAL_BUILD) && defined(ORT_MEMORY_PROFILE) size_t max_pc = plan_.execution_plan.size(); std::string node_arg_name; - ort_value_name_idx_map_.GetName(static_cast(i), node_arg_name); + ORT_RETURN_IF_ERROR(ort_value_name_idx_map_.GetName(static_cast(i), node_arg_name)); auto node_arg = graph_viewer_.GetNodeArg(node_arg_name); plan_.allocation_plan[i].value_type = utils::GetMLDataType(*node_arg); plan_.allocation_plan[i].life_interval = std::pair(0, max_pc); diff --git a/onnxruntime/core/framework/memory_info.cc b/onnxruntime/core/framework/memory_info.cc index 2f09c90e50..ce69cd75eb 100644 --- a/onnxruntime/core/framework/memory_info.cc +++ b/onnxruntime/core/framework/memory_info.cc @@ -28,7 +28,7 @@ void MemoryInfo::GenerateTensorMap(const SequentialExecutionPlan* execution_plan continue; AllocInfoPerTensor mem_info; mem_info.mlvalue_index = value_idx; - value_name_idx_map.GetName(mem_info.mlvalue_index, mem_info.mlvalue_name); + ORT_THROW_IF_ERROR(value_name_idx_map.GetName(mem_info.mlvalue_index, mem_info.mlvalue_name)); mem_info.lifetime_interval = execution_plan->allocation_plan[value_idx].life_interval; mem_info.reused_buffer = (execution_plan->allocation_plan[value_idx].alloc_kind != AllocKind::kReuse) ? value_idx : execution_plan->allocation_plan[value_idx].reused_buffer; //If the tensor is using memory outside of the scope, do not store it