diff options
author | Mark Heffernan <meheff@google.com> | 2018-07-09 14:53:47 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-07-09 14:57:15 -0700 |
commit | 596a7f0da818eb7c0cd27130c2d7133e4a8ca4af (patch) | |
tree | 3e4e6b0900c2485ddd5d9cd746a072b545074837 /tensorflow/compiler/xla/service/hlo_parser.cc | |
parent | 332124d4fe534045ec478f63c6dddb3c70482e45 (diff) |
Add WithToken variants to Send/Recv/Infeed/Outfeed ops in XLA builder.
In HLO side-effecting ops now take and produce a token-shaped value used for ordering. This CL exposes the tokens in the XLA builder interface by adding builder variants suffixed with "WithToken". These variants have an extra token-shaped operand and produce a token, sometimes as a element in the tuple-shaped output of the op.
Also, at the HLO level, add new method CreateToken for creating an instruction which produces token-shaped value out of thin air using an AfterAll instruction. This is explicitly broken out from CreateAfterAll to facilitate remove of zero-operand AfterAll instructions (b/110532604).
PiperOrigin-RevId: 203834271
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_parser.cc')
-rw-r--r-- | tensorflow/compiler/xla/service/hlo_parser.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_parser.cc b/tensorflow/compiler/xla/service/hlo_parser.cc index 54fc34b862..2c3dab0a45 100644 --- a/tensorflow/compiler/xla/service/hlo_parser.cc +++ b/tensorflow/compiler/xla/service/hlo_parser.cc @@ -622,8 +622,12 @@ bool HloParser::ParseInstruction(HloComputation::Builder* builder, if (!ParseOperands(&operands) || !ParseAttributes(attrs)) { return false; } - instruction = - builder->AddInstruction(HloInstruction::CreateAfterAll(operands)); + if (operands.empty()) { + instruction = builder->AddInstruction(HloInstruction::CreateToken()); + } else { + instruction = + builder->AddInstruction(HloInstruction::CreateAfterAll(operands)); + } break; } case HloOpcode::kSort: { |