aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/hlo_instruction.h
diff options
context:
space:
mode:
authorGravatar Mark Heffernan <meheff@google.com>2018-07-17 18:01:52 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-07-17 18:07:00 -0700
commit07cc6474b219ee3ad9f55860e621f61b34bb6bd1 (patch)
treec09bbe69d49db3b6a6acd6f38545915ae2369035 /tensorflow/compiler/xla/service/hlo_instruction.h
parent1662a105497e60d002e101161987cbbd48ba06c6 (diff)
Add single-sided host send and receive operations.
Adds a bit on kSend/kReceive instructions and their Done variants indicated whether the operations communicates with the host or another device (the default). Host send/recv operations are single-sided without a complementary recv/send instruction in another module. Host send/recv operations are exposed in the XLA builder API as SendToHost and RecvFromHost. PiperOrigin-RevId: 205008138
Diffstat (limited to 'tensorflow/compiler/xla/service/hlo_instruction.h')
-rw-r--r--tensorflow/compiler/xla/service/hlo_instruction.h23
1 files changed, 13 insertions, 10 deletions
diff --git a/tensorflow/compiler/xla/service/hlo_instruction.h b/tensorflow/compiler/xla/service/hlo_instruction.h
index 180b2fb359..c6faa69a78 100644
--- a/tensorflow/compiler/xla/service/hlo_instruction.h
+++ b/tensorflow/compiler/xla/service/hlo_instruction.h
@@ -485,27 +485,30 @@ class HloInstruction {
// Creates an asynchronous send instruction with the given channel id, which
// initiates sending the operand data to a unique receive instruction in
- // another computation that has the same channel id.
- static std::unique_ptr<HloInstruction> CreateSend(HloInstruction* operand,
- HloInstruction* token,
- int64 channel_id);
+ // another computation that has the same channel id. If is_host_transfer is
+ // true, then this Send operation transfers data to the host.
+ static std::unique_ptr<HloInstruction> CreateSend(
+ HloInstruction* operand, HloInstruction* token, int64 channel_id,
+ bool is_host_transfer = false);
// Blocks until data transfer for the Send instruction (operand) is complete.
// The operand must be kSend.
static std::unique_ptr<HloInstruction> CreateSendDone(
- HloInstruction* operand);
+ HloInstruction* operand, bool is_host_transfer = false);
// Creates an asynchronous receive instruction with the given channel id,
// which allocates resources to receive data of the given shape from a unique
- // send instruction in another computation that has the same channel id.
- static std::unique_ptr<HloInstruction> CreateRecv(const Shape& shape,
- HloInstruction* token,
- int64 channel_id);
+ // send instruction in another computation that has the same channel id. If
+ // is_host_transfer is true, then this Send operation transfers data from the
+ // host.
+ static std::unique_ptr<HloInstruction> CreateRecv(
+ const Shape& shape, HloInstruction* token, int64 channel_id,
+ bool is_host_transfer = false);
// Blocks until data transfer for the Recv instruction (operand) is complete
// and returns the receive buffer. The operand must be kRecv.
static std::unique_ptr<HloInstruction> CreateRecvDone(
- HloInstruction* operand);
+ HloInstruction* operand, bool is_host_transfer = false);
// Creates a slice instruction, where the operand is sliced by the given
// start/limit indices.