From fa0a9c876a960ec4fe9e768c1259a943cc91a4d5 Mon Sep 17 00:00:00 2001 From: Yuanzhong Xu Date: Tue, 26 May 2020 20:39:18 -0700 Subject: [PATCH] [XLA] Preserve replication info when cloning a parameter PiperOrigin-RevId: 313319423 Change-Id: Ic92f71d5bc78e0b0ab04264ba1ea0b4416c24159 --- tensorflow/compiler/xla/service/hlo_instructions.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tensorflow/compiler/xla/service/hlo_instructions.cc b/tensorflow/compiler/xla/service/hlo_instructions.cc index e33d5960894..9c5a66f0040 100644 --- a/tensorflow/compiler/xla/service/hlo_instructions.cc +++ b/tensorflow/compiler/xla/service/hlo_instructions.cc @@ -1867,8 +1867,14 @@ std::unique_ptr HloParameterInstruction::CloneWithNewOperandsImpl( const Shape& shape, absl::Span new_operands, HloCloneContext* context) const { - return absl::make_unique(parameter_number_, shape, - name()); + auto clone = absl::make_unique(parameter_number_, + shape, name()); + if (parameter_replicated_at_leaf_buffers_ && + ShapeUtil::Equal(shape, this->shape())) { + clone->set_parameter_replicated_at_leaf_buffers( + *parameter_replicated_at_leaf_buffers_); + } + return clone; } HloGetTupleElementInstruction::HloGetTupleElementInstruction(