-
Notifications
You must be signed in to change notification settings - Fork 198
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
Add device_buffer::ssize() and device_uvector::ssize() #966
Conversation
include/rmm/device_buffer.hpp
Outdated
@@ -315,11 +315,19 @@ class device_buffer { | |||
void* data() noexcept { return _data; } | |||
|
|||
/** | |||
* @brief Returns size in bytes that was requested for the device memory | |||
* allocation | |||
* @brief Returns size in bytes of the underlying device memory storage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The somewhat awkward original documentation was my attempt to differentiate size()
and capacity()
. With this change, I feel that nuance is lost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I updated the docs to be based more on the size() and capacity() docs of std::vector
, which is exactly what you had done in rmm::device_uvector
already.
@gpucibot merge |
After #966 builds with full warnings enabled as errors could fail with the following error: ``` /miniconda3/envs/cudf_dev/include/rmm/device_buffer.hpp: In member function ‘int64_t rmm::device_buffer::ssize() const’: /home/jlowe/miniconda3/envs/cudf_dev/include/rmm/device_buffer.hpp:327:19: error: comparison of integer expressions of different signedness: ‘std::size_t’ {aka ‘long unsigned int’} and ‘long int’ [-Werror=sign-compare] 327 | assert(size() < std::numeric_limits<int64_t>::max() && "Size overflows signed integer"); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors ``` This fixes the warning by casting the numerical limit to `std::size_t` before comparing. Authors: - Jason Lowe (https://github.com/jlowe) Approvers: - Jake Hemstad (https://github.com/jrhemstad) - Vyas Ramasubramani (https://github.com/vyasr) URL: #970
Fixes #927.
Adds signed size accessors (
ssize()
) tormm::device_buffer
andrmm::device_uvector
.