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

Fix hostdevice_vector::subspan #13187

Merged
merged 5 commits into from
Apr 21, 2023
Merged

Conversation

ttnghia
Copy link
Contributor

@ttnghia ttnghia commented Apr 20, 2023

This fixes a bug in hostdevice_vector::subspan that incorrectly constructs a hostdevice_span with the input parameters.

In particular, instead of passing the count parameter to hostdevice_span constructor, it (incorrectly) subtracts offset from count.

@ttnghia ttnghia added bug Something isn't working 3 - Ready for Review Ready for review by team libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change labels Apr 20, 2023
@ttnghia ttnghia self-assigned this Apr 20, 2023
@ttnghia ttnghia requested a review from a team as a code owner April 20, 2023 16:46
Copy link
Contributor

@bdice bdice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a proper fix. Part of me wishes subspan was a free function rather than a method, so that hostdevice_vector would be closer in API to std::vector. If it were a method, I think it could be written for any container with hostdevice semantics (hostdevice_vector or hostdevice_span).

edit: I see there's a method std::span<T>::subspan, and this is based on that but applied to hostdevice_vector. This is taking the wrong lesson about container design from the STL, in my view, where a method could have been avoided in favor of a free function accepting any span-like object and returning a subspan (a non-owning view of partial extent).

@ttnghia
Copy link
Contributor Author

ttnghia commented Apr 20, 2023

/merge

@rapids-bot rapids-bot bot merged commit eae1ed4 into rapidsai:branch-23.06 Apr 21, 2023
@ttnghia ttnghia deleted the fix_subspan branch April 21, 2023 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Ready for Review Ready for review by team bug Something isn't working libcudf Affects libcudf (C++/CUDA) code. non-breaking Non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants