Class DevMemInfo#
Defined in File dev_mem_info.hpp
Class Documentation#
-
class DevMemInfo#
Simple object that describes a buffer in device memory.
Public Functions
- void *data,
- DType dtype,
- std::shared_ptr<MemoryDescriptor> md,
- ShapeType shape,
- ShapeType stride,
- TensorSize offset_bytes = 0
Construct a new DevMemInfo object.
- Parameters:
data –
dtype –
shape –
stride –
offset_bytes –
stream –
memory_resource –
- std::shared_ptr<rmm::device_buffer> buffer,
- DType dtype,
- ShapeType shape,
- ShapeType stride,
- TensorSize offset_bytes = 0
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
-
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
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>