aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/copy_insertion.h
diff options
context:
space:
mode:
authorGravatar Mark Heffernan <meheff@google.com>2018-08-24 17:53:34 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-24 17:56:59 -0700
commit481266fa991ca2b08221214f535c6a8c546e2350 (patch)
tree343e79e0f0dc852886b33ebeb879b6efa9984779 /tensorflow/compiler/xla/service/copy_insertion.h
parentbe7a5e4b6e50842bc3c841daaa8dadadc793dd5f (diff)
Run AddSpecialCaseCopies in HloRematerialization.
RemoveUnnecessaryCopies which runs in rematerialization to take advantage of scheduling can sometimes remove copies which are needed to non-interference reasons. This requires running AddSpecialCaseCopies to add them back in. Furthermore, the schedule needs to be updated to account for the changes to the module, so add an UpdateSchedule function which can patch up a schedule in light a limited set of transformations to the module (addition and deletion of instructions). PiperOrigin-RevId: 210186375
Diffstat (limited to 'tensorflow/compiler/xla/service/copy_insertion.h')
-rw-r--r--tensorflow/compiler/xla/service/copy_insertion.h24
1 files changed, 19 insertions, 5 deletions
diff --git a/tensorflow/compiler/xla/service/copy_insertion.h b/tensorflow/compiler/xla/service/copy_insertion.h
index f797ee7e4d..d308f6bc84 100644
--- a/tensorflow/compiler/xla/service/copy_insertion.h
+++ b/tensorflow/compiler/xla/service/copy_insertion.h
@@ -77,15 +77,29 @@ class CopyInsertion : public HloPassInterface {
Status RemoveUnnecessaryCopies(const HloOrdering& ordering,
HloModule* module);
- private:
- // Verifies that no HLO values have interfering live ranged assuming the
- // ordering used by copy insertion.
- Status VerifyNoLiveRangeInterference(HloModule* module);
+ // Add copies to address special constraints on the roots of computations not
+ // related to live range interference:
+ //
+ // (1) Entry computation root must be unambiguous and distinct.
+ //
+ // (2) Any computation called by a kCall instruction must have an
+ // unambiguous root.
+ //
+ // (3) Constants and parameters cannot be live out of the entry computation
+ //
+ Status AddSpecialCaseCopies(HloModule* module);
- Status AddCopiesToResolveInterference(HloModule* module);
+ // Verifies that no HLO values have interfering live ranges using the given
+ // ordering.
+ Status VerifyNoLiveRangeInterference(const HloOrdering& ordering,
+ HloModule* module);
+ private:
+ // Override which requires the caller to pass in a call graph.
Status AddSpecialCaseCopies(const CallGraph& call_graph, HloModule* module);
+ Status AddCopiesToResolveInterference(HloModule* module);
+
// Backend specific function that decides whether a fusion can share buffer
// with its operand.
HloDataflowAnalysis::FusionCanShareBufferFunction fusion_can_share_buffer_;