Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEA] Construct scalar by moving a free buffer #8427

Closed
ttnghia opened this issue Jun 2, 2021 · 0 comments · Fixed by #8428
Closed

[FEA] Construct scalar by moving a free buffer #8427

ttnghia opened this issue Jun 2, 2021 · 0 comments · Fixed by #8428
Assignees
Labels
feature request New feature or request improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change

Comments

@ttnghia
Copy link
Contributor

ttnghia commented Jun 2, 2021

Currently, scalar objects are constructed by some ways such as copying from another scalar object, or constructed by copying data from a representative object (for example, a string scalar can be constructed from a string_view). However, they (scalars) cannot be constructed from an orphaned buffer. Sometimes, we may want to create a scalar from some computation, which results in a large buffer (especially string_scalar), but we can only construct a scalar by copying that buffer into the scalar internal buffer. This is a waste of resources.

Solution: Add constructors for some scalar classes (such as string_scalar) that accept a free buffer and move it into the internal buffer.

@ttnghia ttnghia added feature request New feature or request libcudf Affects libcudf (C++/CUDA) code. improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Jun 2, 2021
@ttnghia ttnghia self-assigned this Jun 2, 2021
@ttnghia ttnghia changed the title [FEA] Construct scalar from an orphaned buffer [FEA] Construct scalar from a free buffer Jun 3, 2021
@ttnghia ttnghia changed the title [FEA] Construct scalar from a free buffer [FEA] Construct scalar by moving a free buffer Jun 3, 2021
@rapids-bot rapids-bot bot closed this as completed in #8428 Jun 8, 2021
rapids-bot bot pushed a commit that referenced this issue Jun 8, 2021
This PR adds some move constructors for `string_scalar` and `struct_scalar` that accept r-value references to existing buffers. By doing so, the input buffer is moved into the internal buffer of the newly constructed scalars instead of copying.

This also cleans up/rewrites doxygens for `scalar.hpp`.

Closes #8427.

Authors:
  - Nghia Truong (https://github.com/ttnghia)

Approvers:
  - Mike Wilson (https://github.com/hyperbolic2346)
  - MithunR (https://github.com/mythrocks)
  - David Wendt (https://github.com/davidwendt)
  - Mark Harris (https://github.com/harrism)
  - Karthikeyan (https://github.com/karthikeyann)

URL: #8428
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request improvement Improvement / enhancement to an existing function libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant