diff options
author | Mark Heffernan <meheff@google.com> | 2018-08-15 20:24:16 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-08-15 20:27:36 -0700 |
commit | f9663ec81e968cc42aec36a190c56da3143f7d4f (patch) | |
tree | 0b02aa3e7f0bd213bb3577b5b5b2fa152248b0d3 /tensorflow/compiler/xla/service/hlo_instructions.cc | |
parent | 6c3e1f4bc803f2dc8a804f4f15ada0eda6c90a18 (diff) |
Require token operand for infeed and outfeed.
For expediency in rolling out support for tokens used for ordering side-effecting ops, infeed and outfeed *optionally* took a token operand. This CL removes that option so all infeed and outfeed instructions take a token operand.
PiperOrigin-RevId: 208927968
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_instructions.cc')
-rw-r--r-- | tensorflow/compiler/xla/service/hlo_instructions.cc | 40 |
1 files changed, 6 insertions, 34 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_instructions.cc b/tensorflow/compiler/xla/service/hlo_instructions.cc index 1de5032670..8d3ef57757 100644 --- a/tensorflow/compiler/xla/service/hlo_instructions.cc +++ b/tensorflow/compiler/xla/service/hlo_instructions.cc @@ -1528,13 +1528,6 @@ HloInfeedInstruction::HloInfeedInstruction(const Shape& infeed_shape, AppendOperand(token_operand); } -HloInfeedInstruction::HloInfeedInstruction(const Shape& infeed_shape, - const string& config) - : HloInstruction(HloOpcode::kInfeed, - ShapeUtil::MakeTupleShape( - {infeed_shape, ShapeUtil::MakeTokenShape()})), - infeed_config_(config) {} - HloInstructionProto HloInfeedInstruction::ToProto() const { HloInstructionProto proto = HloInstruction::ToProto(); proto.set_infeed_config(infeed_config_); @@ -1561,13 +1554,9 @@ std::unique_ptr<HloInstruction> HloInfeedInstruction::CloneWithNewOperandsImpl( const Shape& shape, tensorflow::gtl::ArraySlice<HloInstruction*> new_operands, HloCloneContext* context) const { - if (new_operands.empty()) { - return MakeUnique<HloInfeedInstruction>(infeed_shape(), infeed_config()); - } else { - CHECK_EQ(new_operands.size(), 1); - return MakeUnique<HloInfeedInstruction>(infeed_shape(), new_operands[0], - infeed_config()); - } + CHECK_EQ(new_operands.size(), 1); + return MakeUnique<HloInfeedInstruction>(infeed_shape(), new_operands[0], + infeed_config()); } HloOutfeedInstruction::HloOutfeedInstruction( @@ -1583,18 +1572,6 @@ HloOutfeedInstruction::HloOutfeedInstruction( AppendOperand(token_operand); } -HloOutfeedInstruction::HloOutfeedInstruction( - const Shape& outfeed_shape, HloInstruction* operand, - tensorflow::StringPiece outfeed_config) - : HloInstruction(HloOpcode::kOutfeed, ShapeUtil::MakeTokenShape()), - outfeed_shape_(outfeed_shape), - outfeed_config_(outfeed_config.begin(), outfeed_config.end()) { - CHECK(ShapeUtil::Compatible(operand->shape(), outfeed_shape)) - << "Outfeed shape " << outfeed_shape - << " must be compatible with operand shape " << operand->shape(); - AppendOperand(operand); -} - HloInstructionProto HloOutfeedInstruction::ToProto() const { HloInstructionProto proto = HloInstruction::ToProto(); proto.set_outfeed_config(outfeed_config()); @@ -1622,14 +1599,9 @@ std::unique_ptr<HloInstruction> HloOutfeedInstruction::CloneWithNewOperandsImpl( const Shape& shape, tensorflow::gtl::ArraySlice<HloInstruction*> new_operands, HloCloneContext* context) const { - if (new_operands.size() == 1) { - return MakeUnique<HloOutfeedInstruction>(outfeed_shape(), new_operands[0], - outfeed_config()); - } else { - CHECK_EQ(new_operands.size(), 2); - return MakeUnique<HloOutfeedInstruction>(outfeed_shape(), new_operands[0], - new_operands[1], outfeed_config()); - } + CHECK_EQ(new_operands.size(), 2); + return MakeUnique<HloOutfeedInstruction>(outfeed_shape(), new_operands[0], + new_operands[1], outfeed_config()); } HloConvolutionInstruction::HloConvolutionInstruction( |