aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/hlo_evaluator.cc
diff options
context:
space:
mode:
authorGravatar Mark Heffernan <meheff@google.com>2018-06-08 12:50:16 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-08 12:52:42 -0700
commit278fbe4146b160980fec318187546d9d8870d244 (patch)
tree402e929ee51c089458fa7bfac1ae6826f73d71cd /tensorflow/compiler/xla/service/hlo_evaluator.cc
parent7bb79ee219d4efbd92d1ef4e0dbe45f4aee26654 (diff)
Add kGenerateToken HLO instruction.
The new HLO instruction serves two purposes. (1) It generates a new token value. This is the only way to create tokens. (2) The operation is variadic, taking zero or more token operands. The operation acts as a join of its operands. I considered initially using a kConstant constant as a method to create new tokens, but this ran into problems because of expectations in backends regarding constants and their materialization. This CL enables creation of generate-token instructions, but the new instruction is not supported yet in any backend. PiperOrigin-RevId: 199836205
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_evaluator.cc')
-rw-r--r--tensorflow/compiler/xla/service/hlo_evaluator.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_evaluator.cc b/tensorflow/compiler/xla/service/hlo_evaluator.cc
index 1e78d775c8..e0648e1467 100644
--- a/tensorflow/compiler/xla/service/hlo_evaluator.cc
+++ b/tensorflow/compiler/xla/service/hlo_evaluator.cc
@@ -910,6 +910,14 @@ Status HloEvaluator::HandleBroadcast(HloInstruction* broadcast) {
return Status::OK();
}
+Status HloEvaluator::HandleGenerateToken(HloInstruction* token) {
+ // Literals cannot represent a TOKEN shape so just create an empty tuple as
+ // the "result" of the kGenerateToken operation.
+ // TODO(b/109929053): Add support for TOKENs in Literals.
+ evaluated_[token] = Literal::MakeTuple({});
+ return Status::OK();
+}
+
Status HloEvaluator::HandleGetTupleElement(HloInstruction* get_tuple_element) {
const auto result_shape = get_tuple_element->shape();
const int64 index = get_tuple_element->tuple_index();