aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/service/local_service.cc
diff options
context:
space:
mode:
authorGravatar Justin Lebar <jlebar@google.com>2018-05-30 17:00:50 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-05-30 17:03:41 -0700
commit49535c9da686ea24f4e755e90fdaaa97f9f91b9d (patch)
treeb7e201ecd9999d3cd81f466ffee349c3a1b38c3f /tensorflow/compiler/xla/service/local_service.cc
parent089571430135531664dbc12344d060d3252f38fa (diff)
[XLA] Switch replay_computation to use LocalClient.
This lets replay_computation build an executable once and run it multiple times. This is particularly important because in XLA:GPU, the first run of an executable does some autotuning and therefore is unrepresentative. This change removes --xla_hlo_profile_last_run, because I don't see how to support it in LocalClient -- LocalClient wants the do-profile bit to be set when we *compile*. (There may not be an easy fix for this; it worked with regular Client because we were recompiling every time we ran.) PiperOrigin-RevId: 198643577
Diffstat (limited to 'tensorflow/compiler/xla/service/local_service.cc')
-rw-r--r--tensorflow/compiler/xla/service/local_service.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/service/local_service.cc b/tensorflow/compiler/xla/service/local_service.cc
index 0fa4061738..41aef3920c 100644
--- a/tensorflow/compiler/xla/service/local_service.cc
+++ b/tensorflow/compiler/xla/service/local_service.cc
@@ -260,4 +260,15 @@ StatusOr<int> LocalService::ReplicaNumberToDeviceOrdinal(int replica_number) {
/*computation_count=*/1);
}
+StatusOr<const ShapedBuffer*> LocalService::GlobalDataToShapedBuffer(
+ const GlobalDataHandle& data, int replica_number) {
+ TF_ASSIGN_OR_RETURN(auto buffers, allocation_tracker_.Resolve(data));
+ if (replica_number >= buffers.size()) {
+ return InvalidArgument(
+ "replica_number %d out of range; must be less than num_replicas = %zu.",
+ replica_number, buffers.size());
+ }
+ return buffers[replica_number];
+}
+
} // namespace xla