diff options
author | 2017-08-30 11:45:21 -0700 | |
---|---|---|
committer | 2017-08-30 11:52:57 -0700 | |
commit | b3fbb9c81b4065d66829457b8f15ea7c02f30049 (patch) | |
tree | 9708e7f6371c26df0ab914083e357ade5d0ea076 /tensorflow/compiler/xla/service/instruction_fusion.h | |
parent | e410fe82aafd5125ee0db4edc0a801ef0fea4a98 (diff) |
[XLA] Make some static functions in InstructionFusion members.
PiperOrigin-RevId: 167025880
Diffstat (limited to 'tensorflow/compiler/xla/service/instruction_fusion.h')
-rw-r--r-- | tensorflow/compiler/xla/service/instruction_fusion.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/service/instruction_fusion.h b/tensorflow/compiler/xla/service/instruction_fusion.h index 3ac13ffda0..0eb8d03489 100644 --- a/tensorflow/compiler/xla/service/instruction_fusion.h +++ b/tensorflow/compiler/xla/service/instruction_fusion.h @@ -70,6 +70,19 @@ class InstructionFusion : public HloPassInterface { virtual HloInstruction* Fuse(HloInstruction* producer, HloInstruction* consumer); + // An "effectively unary" operation is one that has one "large" + // input with the others being negligible in terms of memory usage. + // We use "has a smaller true rank than the output" as a heuristic + // for "negligible" memory usage. + bool EffectivelyUnary(HloInstruction* hlo); + + // Returns true if fusing producer into consumer would cause producer to be + // duplicated. This is the case if producer has uses other than consumer. + bool FusionWouldDuplicate(const HloInstruction& producer, + const HloInstruction& consumer) { + return !(producer.users().size() == 1 && consumer.IsUserOf(&producer)); + } + // Current HloComputation instance the loop fuser is traversing. HloComputation* computation_; HloModule* module_; |