diff --git a/onnxruntime/core/framework/allocation_planner.cc b/onnxruntime/core/framework/allocation_planner.cc index 2b287c89f2..3348f46fd4 100644 --- a/onnxruntime/core/framework/allocation_planner.cc +++ b/onnxruntime/core/framework/allocation_planner.cc @@ -325,6 +325,7 @@ class PlannerImpl { auto p_required_buffer_shape = context_.GetShape(output_arg); if (nullptr == p_required_buffer_shape) return false; auto& required_memory_info = AllocPlan(output_arg.Name()).location; + if (HasFence(&output_arg)) return false; for (auto it = freelist_.begin(); it != freelist_.end(); ++it) { size_t reusable = static_cast(it->ml_value);