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
This commit is contained in:
parent
0c1845ced0
commit
5467664c23
tensorflow/c/experimental/stream_executor
@ -321,14 +321,12 @@ SP_DeviceMemoryBase DeviceMemoryBaseToC(const DeviceMemoryBase* mem) {
|
||||
device_memory_base.opaque = const_cast<void*>(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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user