[XLA] [Copy insertion] Deterministically iterate through instructions to copy
authorYunxing Dai <yunxing@google.com>
Mon, 12 Mar 2018 18:49:36 +0000 (11:49 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Mon, 12 Mar 2018 18:53:36 +0000 (11:53 -0700)
- Use HloInstructionMap to get deterministic iteration order.

PiperOrigin-RevId: 188755375

tensorflow/compiler/xla/service/copy_insertion.cc

index df73c28..e9c974a 100644 (file)
@@ -960,7 +960,7 @@ Status AddSpecialCaseCopies(const CallGraph& call_graph, HloModule* module) {
 
   // Identify which shape indices of which instructions need to be copied. Store
   // these results in 'instructions_to_copy'.
-  std::unordered_map<HloInstruction*, ShapeTree<bool>> instructions_to_copy;
+  HloInstructionMap<ShapeTree<bool>> instructions_to_copy;
   auto add_index_to_copy = [&instructions_to_copy](HloInstruction* instruction,
                                                    const ShapeIndex& index) {
     auto it = instructions_to_copy.find(instruction);