Iterate through snapshotted instructions in copy insertion.
Otherwise if a while feed into another while as init, the init (while) will be added back to the iteration list, which makes dataflow analysis confused. PiperOrigin-RevId: 300137503 Change-Id: I3d6d993d09a9f9cda1fa738c26a0bbb164b707e5
This commit is contained in:
parent
0bbfe8d95d
commit
c7ca2a45e6
@ -975,8 +975,9 @@ Status CopyInsertion::AddCopiesToResolveInterference(HloModule* module) {
|
|||||||
TF_ASSIGN_OR_RETURN(std::unique_ptr<HloAliasAnalysis> alias_analysis,
|
TF_ASSIGN_OR_RETURN(std::unique_ptr<HloAliasAnalysis> alias_analysis,
|
||||||
HloAliasAnalysis::Run(module, can_share_buffer_));
|
HloAliasAnalysis::Run(module, can_share_buffer_));
|
||||||
|
|
||||||
for (HloComputation* computation : module->computations()) {
|
for (HloComputation* computation : module->MakeComputationPostOrder()) {
|
||||||
for (HloInstruction* instruction : computation->instructions()) {
|
for (HloInstruction* instruction :
|
||||||
|
computation->MakeInstructionPostOrder()) {
|
||||||
if (instruction->opcode() == HloOpcode::kWhile) {
|
if (instruction->opcode() == HloOpcode::kWhile) {
|
||||||
TF_RETURN_IF_ERROR(AddCopiesForWhile(*alias_analysis, instruction));
|
TF_RETURN_IF_ERROR(AddCopiesForWhile(*alias_analysis, instruction));
|
||||||
} else if (instruction->opcode() == HloOpcode::kConditional) {
|
} else if (instruction->opcode() == HloOpcode::kConditional) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user