aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-09-27 08:26:48 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-09-27 08:31:26 -0700
commit9a68681c3e9bf7e51423dcdbefd25da9c365d256 (patch)
treecb06a23d140f5ef77310738d07deab1fef272263 /tensorflow/compiler
parent40a36ea2bd415f498baf3ec065a274ba8e712e84 (diff)
[XLA] Allow the stream to be used for host-to-device transfers to be specified separately from the compute stream in ServiceRunOptions
PiperOrigin-RevId: 214778267
Diffstat (limited to 'tensorflow/compiler')
-rw-r--r--tensorflow/compiler/xla/executable_run_options.cc10
-rw-r--r--tensorflow/compiler/xla/executable_run_options.h8
2 files changed, 18 insertions, 0 deletions
diff --git a/tensorflow/compiler/xla/executable_run_options.cc b/tensorflow/compiler/xla/executable_run_options.cc
index a472747bd1..0f9b591c70 100644
--- a/tensorflow/compiler/xla/executable_run_options.cc
+++ b/tensorflow/compiler/xla/executable_run_options.cc
@@ -45,6 +45,16 @@ stream_executor::Stream* ExecutableRunOptions::stream() const {
return stream_;
}
+ExecutableRunOptions& ExecutableRunOptions::set_host_to_device_stream(
+ stream_executor::Stream* stream) {
+ host_to_device_stream_ = stream;
+ return *this;
+}
+
+stream_executor::Stream* ExecutableRunOptions::host_to_device_stream() const {
+ return host_to_device_stream_;
+}
+
ExecutableRunOptions& ExecutableRunOptions::set_intra_op_thread_pool(
const Eigen::ThreadPoolDevice* intra_op_thread_pool) {
intra_op_thread_pool_ = intra_op_thread_pool;
diff --git a/tensorflow/compiler/xla/executable_run_options.h b/tensorflow/compiler/xla/executable_run_options.h
index 416131be00..ba3217f31b 100644
--- a/tensorflow/compiler/xla/executable_run_options.h
+++ b/tensorflow/compiler/xla/executable_run_options.h
@@ -65,6 +65,13 @@ class ExecutableRunOptions {
ExecutableRunOptions& set_stream(stream_executor::Stream* stream);
stream_executor::Stream* stream() const;
+ // If set, this is the stream to perform any pre-computation transfers on.
+ // The platform of the stream must match the platform the executable was
+ // built for. A value of nullptr indicates the option has not been set.
+ ExecutableRunOptions& set_host_to_device_stream(
+ stream_executor::Stream* stream);
+ stream_executor::Stream* host_to_device_stream() const;
+
// Sets the thread pool device on which to run Eigen subcomputations.
// Does not take ownership.
ExecutableRunOptions& set_intra_op_thread_pool(
@@ -90,6 +97,7 @@ class ExecutableRunOptions {
const Eigen::ThreadPoolDevice* intra_op_thread_pool_ = nullptr;
ExecutionProfile* execution_profile_ = nullptr;
int rng_seed_ = 0;
+ stream_executor::Stream* host_to_device_stream_ = nullptr;
};
} // namespace xla