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

Method InitializeFromShapedBuffer

tensorflow/compiler/xrt/xrt_state.cc:565–576  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

563}
564
565void XRTTupleAllocation::InitializeFromShapedBuffer(
566 const xla::ShapedBuffer& shaped_buffer,
567 se::DeviceMemoryAllocator* allocator, int device_ordinal) {
568 for (auto& index_buffer : buffers_) {
569 if (index_buffer.second != nullptr) {
570 index_buffer.second->Unref();
571 }
572 // Make a reference-counted version of the allocated buffer.
573 index_buffer.second = new XRTBufferAllocation(
574 shaped_buffer.buffer(index_buffer.first), device_ordinal, allocator);
575 }
576}
577
578xla::StatusOr<xla::ShapedBuffer> XRTTupleAllocation::ToShapedBuffer() {
579 xla::ShapedBuffer shaped_buffer(on_host_shape(), on_device_shape(),

Callers 3

CreateAndTransferMethod · 0.80
CreateUninitializedMethod · 0.80
CreateFromBufferMethod · 0.80

Calls 2

UnrefMethod · 0.45
bufferMethod · 0.45

Tested by

no test coverage detected