aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/hlo_computation.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-08-30 12:25:56 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-08-30 12:29:10 -0700
commit797ca0d482457185f35d46cbce4c430f55b8b66a (patch)
treefec434d70696ffb5bcb7bf44ab6891818443c198 /tensorflow/compiler/xla/service/hlo_computation.cc
parent8f1746c4b37441e5d6a080cd3c871bde913e9564 (diff)
[XLA] Teach HloComputation::Reparent to properly handle reparenting into fusion computations.
This also moves HloInstruction::CheckFusionInstruction() out of "private", and adds calls to it in the reduce-precision-insertion test to confirm that the reduce-precision-insertion pass maintains valid fusion computations. (These checks then fail without the fix to HloComputation::Reparent.) PiperOrigin-RevId: 167031741
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_computation.cc')
-rw-r--r--tensorflow/compiler/xla/service/hlo_computation.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_computation.cc b/tensorflow/compiler/xla/service/hlo_computation.cc
index b8133cda30..c030ceb72f 100644
--- a/tensorflow/compiler/xla/service/hlo_computation.cc
+++ b/tensorflow/compiler/xla/service/hlo_computation.cc
@@ -166,6 +166,10 @@ Status HloComputation::RemoveParameter(int64 param_no) {
void HloComputation::Reparent(HloInstruction* instruction) {
instruction->set_parent(this);
+ if (is_fusion_computation_ && instruction != root_instruction_) {
+ CHECK(root_instruction_->fusion_instruction() != nullptr);
+ instruction->SetParentFusion(root_instruction_->fusion_instruction());
+ }
}
bool HloComputation::IsRemovable(const HloInstruction* instruction) {