aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/stream_executor/stream_executor_pimpl.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2017-01-17 12:28:27 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-01-17 12:51:25 -0800
commit21c0fa9e2dd966c242a4e89f1cac9e3e0f146ea8 (patch)
treedafb27008ba040280825c18d10e0bef02d68187c /tensorflow/stream_executor/stream_executor_pimpl.cc
parentc276876a4ab1ebedf2b847d9ac12d019d6a16cff (diff)
Plumb port::Status through the internal synchronous memcopy routines.
Now, at least for the public APIs that return port::Status, they can grab the port::Status that the implementation would like to return and use its additional information in reporting to the user. Change: 144741667
Diffstat (limited to 'tensorflow/stream_executor/stream_executor_pimpl.cc')
-rw-r--r--tensorflow/stream_executor/stream_executor_pimpl.cc39
1 files changed, 29 insertions, 10 deletions
diff --git a/tensorflow/stream_executor/stream_executor_pimpl.cc b/tensorflow/stream_executor/stream_executor_pimpl.cc
index 7739d31662..71a5a45b67 100644
--- a/tensorflow/stream_executor/stream_executor_pimpl.cc
+++ b/tensorflow/stream_executor/stream_executor_pimpl.cc
@@ -491,7 +491,12 @@ bool StreamExecutor::SynchronousMemcpy(DeviceMemoryBase *gpu_dst,
// Tracing overloaded methods is very difficult due to issues with type
// inference on template args. Since use of these overloaded methods is
// discouraged anyway, this isn't a huge deal.
- return implementation_->SynchronousMemcpy(gpu_dst, host_src, size);
+ port::Status status =
+ implementation_->SynchronousMemcpy(gpu_dst, host_src, size);
+ if (!status.ok()) {
+ LOG(ERROR) << "synchronous memcpy: " << status;
+ }
+ return status.ok();
}
bool StreamExecutor::SynchronousMemcpy(void *host_dst,
@@ -501,7 +506,12 @@ bool StreamExecutor::SynchronousMemcpy(void *host_dst,
<< ", gpu_src=" << gpu_src.opaque() << ", size=" << size << ") D2H"
<< StackTraceIfVLOG10();
- return implementation_->SynchronousMemcpy(host_dst, gpu_src, size);
+ port::Status status =
+ implementation_->SynchronousMemcpy(host_dst, gpu_src, size);
+ if (!status.ok()) {
+ LOG(ERROR) << "synchronous memcpy: " << status;
+ }
+ return status.ok();
}
bool StreamExecutor::SynchronousMemcpy(DeviceMemoryBase *gpu_dst,
@@ -511,8 +521,12 @@ bool StreamExecutor::SynchronousMemcpy(DeviceMemoryBase *gpu_dst,
<< gpu_dst->opaque() << ", gpu_src=" << gpu_src.opaque()
<< ", size=" << size << ") D2D" << StackTraceIfVLOG10();
- return implementation_->SynchronousMemcpyDeviceToDevice(gpu_dst, gpu_src,
- size);
+ port::Status status =
+ implementation_->SynchronousMemcpyDeviceToDevice(gpu_dst, gpu_src, size);
+ if (!status.ok()) {
+ LOG(ERROR) << "synchronous memcpy: " << status;
+ }
+ return status.ok();
}
port::Status StreamExecutor::SynchronousMemcpyD2H(
@@ -525,13 +539,15 @@ port::Status StreamExecutor::SynchronousMemcpyD2H(
SCOPED_TRACE(TraceListener::SynchronousMemcpyD2H,
&result, gpu_src, size, host_dst);
- if (!implementation_->SynchronousMemcpy(host_dst, gpu_src, size)) {
+ port::Status status =
+ implementation_->SynchronousMemcpy(host_dst, gpu_src, size);
+ if (!status.ok()) {
return port::Status{
port::error::INTERNAL,
port::Printf(
"failed to synchronously memcpy device-to-host: GPU %p to host %p "
- "size %lld",
- gpu_src.opaque(), host_dst, size)};
+ "size %lld: %s",
+ gpu_src.opaque(), host_dst, size, status.ToString().c_str())};
}
return result;
@@ -548,12 +564,15 @@ port::Status StreamExecutor::SynchronousMemcpyH2D(const void *host_src,
SCOPED_TRACE(TraceListener::SynchronousMemcpyH2D,
&result, host_src, size, gpu_dst);
- if (!implementation_->SynchronousMemcpy(gpu_dst, host_src, size)) {
+ port::Status status =
+ implementation_->SynchronousMemcpy(gpu_dst, host_src, size);
+ if (!status.ok()) {
result = port::Status{
port::error::INTERNAL,
port::Printf("failed to synchronously memcpy host-to-device: host "
- "%p to GPU %p size %lld",
- host_src, gpu_dst->opaque(), size)};
+ "%p to GPU %p size %lld: %s",
+ host_src, gpu_dst->opaque(), size,
+ status.ToString().c_str())};
}
return result;