[PluggableDevice] fix typo: move platform.name platform.type to before since it will be moved, change CHECK->DCHECK, and remove useless comment
diff --git a/tensorflow/c/experimental/stream_executor/stream_executor.cc b/tensorflow/c/experimental/stream_executor/stream_executor.cc
index 02c0120..b90e5bd 100644
--- a/tensorflow/c/experimental/stream_executor/stream_executor.cc
+++ b/tensorflow/c/experimental/stream_executor/stream_executor.cc
@@ -809,6 +809,8 @@
TF_RETURN_IF_ERROR(ValidateSPTimerFns(timer_fns));
// Register new platform
+ *device_type = std::string(platform.type);
+ *platform_name = std::string(platform.name);
std::unique_ptr<stream_executor::CPlatform> cplatform(
new stream_executor::CPlatform(
std::move(platform), params.destroy_platform, std::move(platform_fns),
@@ -816,8 +818,6 @@
std::move(timer_fns)));
SE_CHECK_OK(stream_executor::MultiPlatformManager::RegisterPlatform(
std::move(cplatform)));
- *device_type = std::string(platform.type);
- *platform_name = std::string(platform.name);
return port::Status::OK();
}
} // namespace stream_executor
diff --git a/tensorflow/core/common_runtime/gpu/gpu_device.cc b/tensorflow/core/common_runtime/gpu/gpu_device.cc
index 43ff769..ce3ffdd 100644
--- a/tensorflow/core/common_runtime/gpu/gpu_device.cc
+++ b/tensorflow/core/common_runtime/gpu/gpu_device.cc
@@ -200,10 +200,11 @@
#if GOOGLE_CUDA
static void CUDART_CB asyncFree(gpuStream_t stream, cudaError_t status,
- void* userData) {
+ void* userData)
#elif TENSORFLOW_USE_ROCM
- static void asyncFree(gpuStream_t stream, hipError_t status, void* userData) {
+ static void asyncFree(gpuStream_t stream, hipError_t status, void* userData)
#endif
+ {
AsyncFreeData* data = static_cast<AsyncFreeData*>(userData);
if (LogMemory::IsEnabled()) {
LogMemory::RecordRawDeallocation(data->operation_, data->step_id_,
@@ -223,7 +224,7 @@
OpKernelContext* context_;
TF_DISALLOW_COPY_AND_ASSIGN(EigenGpuStreamDevice);
-}; // namespace tensorflow
+};
// This factory helps to ensure that different GPU device objects that refer to
// the same physical device and stream group id use the same stream group
diff --git a/tensorflow/core/common_runtime/pluggable_device/pluggable_device.cc b/tensorflow/core/common_runtime/pluggable_device/pluggable_device.cc
index 0338e33..b84fcfe 100644
--- a/tensorflow/core/common_runtime/pluggable_device/pluggable_device.cc
+++ b/tensorflow/core/common_runtime/pluggable_device/pluggable_device.cc
@@ -232,7 +232,7 @@
}
Allocator* PluggableDevice::GetAllocator(AllocatorAttributes attr) {
- CHECK(cpu_allocator_) << "bad place 1";
+ DCHECK(cpu_allocator_) << "bad place 1";
if (attr.on_host()) {
if (attr.gpu_compatible() || force_gpu_compatible_) {
PluggableDeviceProcessState* ps =
diff --git a/tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc b/tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc
index f6190a8..fdc3667 100644
--- a/tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc
+++ b/tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.cc
@@ -207,7 +207,7 @@
TF_RETURN_IF_ERROR(GetDeviceLocalities(num_tf_devices, &device_localities));
// Build the PluggableDevices.
- CHECK_EQ(next_tf_device_id, memory_limit_bytes.size());
+ DCHECK_EQ(next_tf_device_id, memory_limit_bytes.size());
for (int di = 0; di < num_tf_devices; ++di) {
TfDeviceId tf_device_id(di);
int64 bytes = memory_limit_bytes[di];
@@ -230,7 +230,7 @@
TfDeviceId tf_device_id, int64 memory_limit,
const DeviceLocality& dev_locality,
std::vector<std::unique_ptr<Device>>* devices) {
- CHECK_GE(tf_device_id.value(), 0);
+ DCHECK_GE(tf_device_id.value(), 0);
const string device_name = strings::StrCat(
name_prefix, "/device:", device_type_, ":", tf_device_id.value());
diff --git a/tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.h b/tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.h
index 1b0965b..97fbc94 100644
--- a/tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.h
+++ b/tensorflow/core/common_runtime/pluggable_device/pluggable_device_factory.h
@@ -13,8 +13,8 @@
limitations under the License.
==============================================================================*/
-#ifndef TENSORFLOW_CORE_COMMON_RUNTIME_PLUGGABLE_DEVICE_PLUGGABLE_DEVICEFACTORY_H_
-#define TENSORFLOW_CORE_COMMON_RUNTIME_PLUGGABLE_DEVICE_PLUGGABLE_DEVICEFACTORY_H_
+#ifndef TENSORFLOW_CORE_COMMON_RUNTIME_PLUGGABLE_DEVICE_PLUGGABLE_DEVICE_FACTORY_H_
+#define TENSORFLOW_CORE_COMMON_RUNTIME_PLUGGABLE_DEVICE_PLUGGABLE_DEVICE_FACTORY_H_
#include <memory>
#include <string>
@@ -57,4 +57,4 @@
};
} // namespace tensorflow
-#endif // TENSORFLOW_CORE_COMMON_RUNTIME_PLUGGABLE_DEVICE_PLUGGABLE_DEVICEFACTORY_H_
+#endif // TENSORFLOW_CORE_COMMON_RUNTIME_PLUGGABLE_DEVICE_PLUGGABLE_DEVICE_FACTORY_H_
diff --git a/tensorflow/core/common_runtime/pluggable_device/pluggable_device_process_state.cc b/tensorflow/core/common_runtime/pluggable_device/pluggable_device_process_state.cc
index 34758eb..6bc2473 100644
--- a/tensorflow/core/common_runtime/pluggable_device/pluggable_device_process_state.cc
+++ b/tensorflow/core/common_runtime/pluggable_device/pluggable_device_process_state.cc
@@ -74,7 +74,7 @@
Allocator* PluggableDeviceProcessState::GetPluggableDeviceAllocator(
const GPUOptions& options, TfDeviceId tf_device_id, size_t total_bytes) {
- CHECK(process_state_);
+ DCHECK(process_state_);
const string& allocator_type = options.allocator_type();
se::Platform* platform = PluggableDeviceMachineManager(platform_name_);
mutex_lock lock(mu_);
@@ -126,7 +126,7 @@
Allocator* PluggableDeviceProcessState::GetPluggableDeviceHostAllocator(
int numa_node) {
- CHECK(process_state_);
+ DCHECK(process_state_);
if (!HasPluggableDevice() ||
!process_state_->ProcessState::FLAGS_brain_mem_reg_gpu_dma) {
return process_state_->GetCPUAllocator(numa_node);
@@ -161,7 +161,7 @@
}
}
- CHECK_NE(nullptr, se);
+ DCHECK_NE(nullptr, se);
while (static_cast<int>(pluggable_device_host_allocators_.size()) <=
numa_node) {