From 5467664c23d11808706f02a0a1fd1129719d1ca9 Mon Sep 17 00:00:00 2001 From: Anna R Date: Tue, 24 Nov 2020 16:43:08 -0800 Subject: [PATCH] Remove a few TODOs in stream_executor.cc. 1. I am thinking if `void* ext` is not really needed in DeviceMemoryBase. Additional data can probably be stored in the `void* opaque` handle. 2. AllocatorStats already appear to be validated. PiperOrigin-RevId: 344154575 Change-Id: I6cac6aa60979a0ee9116b586b9b16894fd57be7e --- tensorflow/c/experimental/stream_executor/stream_executor.cc | 3 --- tensorflow/c/experimental/stream_executor/stream_executor.h | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tensorflow/c/experimental/stream_executor/stream_executor.cc b/tensorflow/c/experimental/stream_executor/stream_executor.cc index ec2bada791e..0b7ed2a1ae5 100644 --- a/tensorflow/c/experimental/stream_executor/stream_executor.cc +++ b/tensorflow/c/experimental/stream_executor/stream_executor.cc @@ -321,14 +321,12 @@ SP_DeviceMemoryBase DeviceMemoryBaseToC(const DeviceMemoryBase* mem) { device_memory_base.opaque = const_cast(mem->opaque()); device_memory_base.size = mem->size(); device_memory_base.payload = mem->payload(); - // TODO(annarev): Add `ext` field to DeviceMemoryBase and set it here. return device_memory_base; } DeviceMemoryBase DeviceMemoryBaseFromC(const SP_DeviceMemoryBase& mem) { DeviceMemoryBase base(mem.opaque, mem.size); base.SetPayload(mem.payload); - // TODO(annarev): Add `ext` field to DeviceMemoryBase and set it here. return base; } @@ -426,7 +424,6 @@ class CStreamExecutor : public internal::StreamExecutorInterface { LOG(ERROR) << status.error_message(); return absl::nullopt; } - // TODO(annarev): validate SP_AllocatorStats. ::stream_executor::AllocatorStats stats; stats.num_allocs = c_stats.num_allocs; stats.bytes_in_use = c_stats.bytes_in_use; diff --git a/tensorflow/c/experimental/stream_executor/stream_executor.h b/tensorflow/c/experimental/stream_executor/stream_executor.h index bec77ef520b..2eb8900447f 100644 --- a/tensorflow/c/experimental/stream_executor/stream_executor.h +++ b/tensorflow/c/experimental/stream_executor/stream_executor.h @@ -140,8 +140,9 @@ typedef enum SE_EventStatus { // https://cs.opensource.google/tensorflow/tensorflow/+/refs/tags/v2.3.0:tensorflow/stream_executor/device_memory.h;l=57 typedef struct SP_DeviceMemoryBase { size_t struct_size; - void* ext; // free-form data set by plugin + void* ext; // Reserved for future use // Platform-dependent value representing allocated memory. + // Note that the pointer does not have to be to the virtual address itself. void* opaque; uint64_t size; // Size in bytes of this allocation. uint64_t payload; // Value for plugin's use