Skip to content

[FEA] Enable releasing ownership of rmm device buffers #2189

@nirandaperera

Description

@nirandaperera

Is your feature request related to a problem? Please describe.

Currently RMM device buffers underlying data ptr ownership can not be released/ transferred.

Describe the solution you'd like

I suggest a util method like,

template<typename BufferT>
static std::unique_ptr<BufferT> device_buffer::move_buffer(std::unique_ptr<rmm::device_buffer> src) {
  auto dest = std::make_unique<BufferT>(src->_data, src->_size, src->_stream, src->_mr);  
  src->_size     = 0;
  src->_capacity = 0;
  src->_data     = nullptr;
  return dest;
}

OR a release method that releases the contents. (I prefer the former, because the it will be clear that the src buffer needs to be moved into the util method. this will prevent usages-after-move).

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context, code examples, or references to existing implementations about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    To-do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions