MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetSubBuffer

Method GetSubBuffer

tensorflow/stream_executor/stream_executor_pimpl.h:900–916  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

898
899template <typename T>
900DeviceMemory<T> StreamExecutor::GetSubBuffer(DeviceMemory<T> *parent,
901 uint64 element_offset,
902 uint64 element_count) {
903 if (element_offset + element_count > parent->ElementCount()) {
904 LOG(ERROR) << "requested sub-buffer allocation (offset + size) is greater "
905 << "than parent allocation size: (" << element_offset << " + "
906 << element_count << ") vs. (" << parent->ElementCount() << ")";
907 return DeviceMemory<T>{};
908 }
909
910 void *opaque = implementation_->GetSubBuffer(
911 parent, sizeof(T) * element_offset, sizeof(T) * element_count);
912 if (opaque == nullptr) {
913 return DeviceMemory<T>{};
914 }
915 return DeviceMemory<T>(DeviceMemoryBase(opaque, sizeof(T) * element_count));
916}
917
918template <typename... Params, typename... Args>
919inline Stream &Stream::ThenLaunch(ThreadDim thread_dims, BlockDim block_dims,

Callers

nothing calls this directly

Calls 2

DeviceMemoryBaseClass · 0.70
ElementCountMethod · 0.45

Tested by

no test coverage detected