aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/rpc/xla_service.proto
blob: 551ae895e05586daec0ffcd425f4950f76bdd50d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/* Copyright 2018 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

// XLA service API.
//
// Users 1) build up computations and 2) create allocations via this API.
// Computations are composed of data flowing between arbitrarily-sized
// vector-oriented operations.
//
// Users build up computations using a ComputationHandle, and talk about
// allocations using GlobalDataHandles.
//
// There are currently no checkpointing capabilities or distribution/replication
// guarantees. The service runs on a single machine (e.g. one task) and that is
// its failure domain.
//
// Canonical example of "alpha * X + Y":
// * Make a computation.
// * Add alpha and X and Y as parameters.
// * Request the multiplication of alpha and X.
// * Request the addition of that result and Y.
//
// Then, pass the computation and appropriately shaped inputs to the XLA
// service's Execute method, which provides a result as a GlobalDataHandle.
//
// All data in XLA computations are conceptually immutable.
//
// Note: this API is subject to change / refinement over time -- use the
// provided client libraries to insulate code from changes to this service API.

syntax = "proto3";

import "tensorflow/compiler/xla/xla.proto";
import "tensorflow/compiler/xla/xla_data.proto";

package xla;

service XlaService {
  /////////////////////////
  // Global data requests

  // Unregisters a global allocation.
  //
  // If the handle given is not currently allocated, a NOT_FOUND status is
  // returned.
  rpc Unregister(UnregisterRequest) returns (UnregisterResponse) {
  }

  // Deconstructs a tuple. Returns a newly created GlobalDataHandle for each
  // element in the tuple.
  rpc DeconstructTuple(DeconstructTupleRequest)
      returns (DeconstructTupleResponse) {
  }

  // Unpack requests that a global data handle, with a tuple shape, has global
  // data handles created for each of its constituent members. This is the
  // equivalent of the "destructuring assignment" present in various programming
  // languages.
  rpc Unpack(UnpackRequest) returns (UnpackResponse) {
  }

  // Requests the shape of the referenced global data.
  rpc GetShape(GetShapeRequest) returns (GetShapeResponse) {
  }

  // Requests the statistics of the given computation.
  rpc GetComputationGraphStats(ComputationGraphStatsRequest)
      returns (ComputationStatsResponse) {
  }

  // Loads a variable number of values with a given element type from ColumnIO.
  rpc LoadData(LoadDataRequest) returns (LoadDataResponse) {
  }

  // Transfers the given global data to the client in the form of a Literal.
  rpc TransferToClient(TransferToClientRequest)
      returns (TransferToClientResponse) {
  }

  // Transfers the given literal to the server to be stored in a global
  // allocation, which is returned.
  rpc TransferToServer(TransferToServerRequest)
      returns (TransferToServerResponse) {
  }

  // Transfers the given literal to the Infeed buffer of the device.
  rpc TransferToInfeed(TransferToInfeedRequest)
      returns (TransferToInfeedResponse) {
  }

  // Transferred literal from the Outfeed buffer of the device.
  rpc TransferFromOutfeed(TransferFromOutfeedRequest)
      returns (TransferFromOutfeedResponse) {
  }

  // Resets the device, clearing all existing state on the device.
  rpc ResetDevice(ResetDeviceRequest) returns (ResetDeviceResponse) {
  }

  // Computes the value of a constant expression. The request contains the
  // computation graph for the constant expression.
  rpc ComputeConstantGraph(ComputeConstantGraphRequest)
      returns (ComputeConstantResponse) {
  }

  // Requests one or more device handles from the target. The returned device
  // handles can be used to specify the device on which to execute computations
  // or transfer data.
  rpc GetDeviceHandles(GetDeviceHandlesRequest)
      returns (GetDeviceHandlesResponse) {
  }

  // Creates a channel handle that can be used to transfer data between
  // two computations via a pair of Send and Recv instructions.
  rpc CreateChannelHandle(CreateChannelHandleRequest)
      returns (CreateChannelHandleResponse) {
  }

  // Invokes the provided computation with the provided global data passed as
  // immutable arguments. The request contains the whole computation graph.
  // Returns global data output and execution timing.
  rpc ExecuteGraph(ExecuteGraphRequest) returns (ExecuteResponse) {
  }

  // Invokes the provided list of computations in parallel with the provided
  // global data for each computation. Returns a list of global data output and
  // execution timing.
  rpc ExecuteGraphParallel(ExecuteGraphParallelRequest)
      returns (ExecuteParallelResponse) {
  }

  // Waits until the given execution (aysnchronously launched) is complete, and
  // returns the global data output.
  rpc WaitForExecution(WaitForExecutionRequest)
      returns (WaitForExecutionResponse) {
  }
}