Class DevMemInfo
Defined in File dev_mem_info.hpp
-
class DevMemInfo
Simple object that describes a buffer in device memory.
Public Functions
Construct a new DevMemInfo object.
- Parameters
data –
dtype –
shape –
stride –
offset_bytes –
stream –
memory_resource –
Construct a new DevMemInfo object from an existing
rmm::device_buffer
.- Parameters
buffer –
dtype –
shape –
stride –
offset_bytes –
-
DevMemInfo(DevMemInfo &&other) = default
-
TensorSize bytes() const
Return the number of bytes stored in the underlying buffer.
- Returns
TensorSize
-
TensorSize count() const
Return the element count stored in the underlying buffer.
- Returns
TensorSize
-
TensorSize offset_bytes() const
Return the number of bytes offset from the head of the buffer.
- Returns
TensorSize
-
TypeId type_id() const
Return the type id of the data stored in the buffer.
- Returns
TypeId
-
const ShapeType &shape() const
Return a reference to the shape.
- Returns
const ShapeType&
-
TensorIndex shape(TensorIndex idx) const
Return a the dimension at
idx
- Parameters
idx –
- Returns
TensorIndex
-
const ShapeType &stride() const
Return a reference to the stride expressed in elements.
- Returns
const ShapeType&
-
TensorIndex stride(TensorIndex idx) const
Return the stride at
idx
- Parameters
idx –
- Returns
TensorIndex
-
void *data() const
Returns raw pointer to underlying buffer offset by the
offset
- Returns
void*
-
std::shared_ptr<MemoryDescriptor> memory() const
Return the memory descriptor.
- Returns
std::shared_ptr<MemoryDescriptor>
-
std::unique_ptr<rmm::device_buffer> make_new_buffer(TensorSize bytes) const
Constructs a new rmm buffer with the same stream and memory resource as the current buffer.
- Parameters
bytes –
- Returns
std::unique_ptr<rmm::device_buffer>