aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/stream_executor/stream_executor_pimpl.cc
diff options
context:
space:
mode:
authorGravatar Smit Hinsu <hinsu@google.com>2018-05-09 12:07:05 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-05-09 13:13:59 -0700
commit69bc455e699ba5d3b3227aff1932b556c93974d8 (patch)
tree5744b90de0c2bf1a6719063487e830d10e1b755d /tensorflow/stream_executor/stream_executor_pimpl.cc
parentd3c2b54c6f10c3bdf0b7001d54556e9e7a8438c6 (diff)
Use parenthesis based construction instead of brace initialization
Updates all the construction calls for Status, ScopedActivateContext and mutexes withing stream_executor to follow the recommendation in https://abseil.io/tips/88 PiperOrigin-RevId: 196007931
Diffstat (limited to 'tensorflow/stream_executor/stream_executor_pimpl.cc')
-rw-r--r--tensorflow/stream_executor/stream_executor_pimpl.cc32
1 files changed, 16 insertions, 16 deletions
diff --git a/tensorflow/stream_executor/stream_executor_pimpl.cc b/tensorflow/stream_executor/stream_executor_pimpl.cc
index 20579790ef..eecd5bfe1f 100644
--- a/tensorflow/stream_executor/stream_executor_pimpl.cc
+++ b/tensorflow/stream_executor/stream_executor_pimpl.cc
@@ -232,7 +232,7 @@ void StreamExecutor::Deallocate(DeviceMemoryBase *mem) {
}
void StreamExecutor::GetMemAllocs(std::map<void *, AllocRecord> *records_out) {
- tf_shared_lock lock{mu_};
+ tf_shared_lock lock(mu_);
*records_out = mem_allocs_;
}
@@ -256,13 +256,13 @@ port::Status StreamExecutor::SetDeviceSharedMemoryConfig(
string error_msg = port::Printf(
"Invalid shared memory config specified: %d", static_cast<int>(config));
LOG(ERROR) << error_msg;
- return port::Status{port::error::INVALID_ARGUMENT, error_msg};
+ return port::Status(port::error::INVALID_ARGUMENT, error_msg);
}
return implementation_->SetDeviceSharedMemoryConfig(config);
}
const DeviceDescription &StreamExecutor::GetDeviceDescription() const {
- mutex_lock lock{mu_};
+ mutex_lock lock(mu_);
if (device_description_ != nullptr) {
return *device_description_;
}
@@ -393,7 +393,7 @@ StreamExecutor::createRnnStateTensorDescriptor(int num_layer, int batch_size,
}
dnn::DnnSupport *StreamExecutor::AsDnn() {
- mutex_lock lock{mu_};
+ mutex_lock lock(mu_);
if (dnn_ != nullptr) {
return dnn_.get();
}
@@ -403,7 +403,7 @@ dnn::DnnSupport *StreamExecutor::AsDnn() {
}
blas::BlasSupport *StreamExecutor::AsBlas() {
- mutex_lock lock{mu_};
+ mutex_lock lock(mu_);
if (blas_ != nullptr) {
return blas_.get();
}
@@ -413,7 +413,7 @@ blas::BlasSupport *StreamExecutor::AsBlas() {
}
fft::FftSupport *StreamExecutor::AsFft() {
- mutex_lock lock{mu_};
+ mutex_lock lock(mu_);
if (fft_ != nullptr) {
return fft_.get();
}
@@ -423,7 +423,7 @@ fft::FftSupport *StreamExecutor::AsFft() {
}
rng::RngSupport *StreamExecutor::AsRng() {
- mutex_lock lock{mu_};
+ mutex_lock lock(mu_);
if (rng_ != nullptr) {
return rng_.get();
}
@@ -582,12 +582,12 @@ port::Status StreamExecutor::SynchronousMemcpyD2H(
result = implementation_->SynchronousMemcpy(host_dst, device_src, size);
if (!result.ok()) {
- result = port::Status{port::error::INTERNAL,
+ result = port::Status(port::error::INTERNAL,
port::Printf("failed to synchronously memcpy "
"device-to-host: device %p to host %p "
"size %lld: %s",
device_src.opaque(), host_dst, size,
- result.ToString().c_str())};
+ result.ToString().c_str()));
}
return result;
@@ -605,12 +605,12 @@ port::Status StreamExecutor::SynchronousMemcpyH2D(
result = implementation_->SynchronousMemcpy(device_dst, host_src, size);
if (!result.ok()) {
- result = port::Status{
+ result = port::Status(
port::error::INTERNAL,
port::Printf("failed to synchronously memcpy host-to-device: host "
"%p to device %p size %lld: %s",
host_src, device_dst->opaque(), size,
- result.ToString().c_str())};
+ result.ToString().c_str()));
}
return result;
@@ -723,7 +723,7 @@ void StreamExecutor::EnqueueOnBackgroundThread(std::function<void()> task) {
void StreamExecutor::CreateAllocRecord(void *opaque, uint64 bytes) {
if (FLAGS_check_device_leaks && opaque != nullptr && bytes != 0) {
- mutex_lock lock{mu_};
+ mutex_lock lock(mu_);
mem_allocs_[opaque] = AllocRecord{
bytes, ""};
}
@@ -731,7 +731,7 @@ void StreamExecutor::CreateAllocRecord(void *opaque, uint64 bytes) {
void StreamExecutor::EraseAllocRecord(void *opaque) {
if (FLAGS_check_device_leaks && opaque != nullptr) {
- mutex_lock lock{mu_};
+ mutex_lock lock(mu_);
if (mem_allocs_.find(opaque) == mem_allocs_.end()) {
LOG(ERROR) << "Deallocating unknown pointer: "
<< port::Printf("0x%p", opaque);
@@ -745,7 +745,7 @@ void StreamExecutor::EnableTracing(bool enabled) { tracing_enabled_ = enabled; }
void StreamExecutor::RegisterTraceListener(TraceListener *listener) {
{
- mutex_lock lock{mu_};
+ mutex_lock lock(mu_);
if (listeners_.find(listener) != listeners_.end()) {
LOG(INFO) << "Attempt to register already-registered listener, "
<< listener;
@@ -759,7 +759,7 @@ void StreamExecutor::RegisterTraceListener(TraceListener *listener) {
bool StreamExecutor::UnregisterTraceListener(TraceListener *listener) {
{
- mutex_lock lock{mu_};
+ mutex_lock lock(mu_);
if (listeners_.find(listener) == listeners_.end()) {
LOG(INFO) << "Attempt to unregister unknown listener, " << listener;
return false;
@@ -776,7 +776,7 @@ void StreamExecutor::SubmitTrace(TraceCallT trace_call, ArgsT &&... args) {
if (tracing_enabled_) {
{
// instance tracers held in a block to limit the lock lifetime.
- tf_shared_lock lock{mu_};
+ tf_shared_lock lock(mu_);
for (TraceListener *listener : listeners_) {
(listener->*trace_call)(std::forward<ArgsT>(args)...);
}