[XLA] Erase cloned instructions on the fly when merging fusion nodes.
This avoids the awkward situation where an RNG which is clearly eligible for fusion becomes ineligible mid-fusion because it suddenly has an extra (dead) user. PiperOrigin-RevId: 173141716
This commit is contained in:
parent
1038927c09
commit
5e23e0e67a
@ -716,10 +716,12 @@ void HloInstruction::MergeFusionInstructionIntoMultiOutput(
|
|||||||
|
|
||||||
// Fuse the root instruction and generate multiple outputs.
|
// Fuse the root instruction and generate multiple outputs.
|
||||||
FuseInstructionIntoMultiOutput(unfused_root);
|
FuseInstructionIntoMultiOutput(unfused_root);
|
||||||
|
TF_CHECK_OK(unfused_root->parent()->RemoveInstruction(unfused_root));
|
||||||
// The rest instructions are of normal fusing.
|
// The rest instructions are of normal fusing.
|
||||||
for (int64 i = 1; i < unfused_instructions.size(); i++) {
|
for (int64 i = 1; i < unfused_instructions.size(); i++) {
|
||||||
auto instruction = unfused_instructions[i];
|
auto instruction = unfused_instructions[i];
|
||||||
FuseInstruction(instruction);
|
FuseInstruction(instruction);
|
||||||
|
TF_CHECK_OK(instruction->parent()->RemoveInstruction(instruction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user