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 memset error in nvtext::edit_distance_matrix #14283

Merged

Conversation

davidwendt
Copy link
Contributor

Description

Fixes a bug in nvtext::edit_distance_matrix where the internal offsets vector is initialized to 0.
This error was introduced in #13912
The bug was found while working on a different PR which re-ordered the nvtext gtests execution causing device memory to be reused from the rmm pool in a different way.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@davidwendt davidwendt 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 Oct 13, 2023
@davidwendt davidwendt requested a review from a team as a code owner October 13, 2023 18:59
@davidwendt davidwendt self-assigned this Oct 13, 2023
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.

LGTM. Would we want to consider a using ... type declaration, or decltype, or rmm::device_uvector<T>::value_type, or something to reduce the hardcoded types?

@davidwendt
Copy link
Contributor Author

LGTM. Would we want to consider a using ... type declaration, or decltype, or rmm::device_uvector<T>::value_type, or something to reduce the hardcoded types?

I'm not sure it is worth doing. Every parameter to cudaMemsetAsync is really a potential error.
I came up with this

using offsets_vector_type = rmm::device_uvector<std::ptrdiff_t>;
offsets_vector_type offsets( count, stream );
cudaMemsetAsync( offsets.begin(), 0, count * sizeof(typename offsets_vector_type::value_type), stream.value() );

and realized that I could just have easily put in the wrong count variable too.

Copy link
Contributor

@ttnghia ttnghia left a comment

Choose a reason for hiding this comment

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

This looks like something that the compiler can detect and issue a warning :)

@davidwendt
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit ef92310 into rapidsai:branch-23.12 Oct 16, 2023
61 checks passed
@davidwendt davidwendt deleted the fix-edit-dist-matrix-memset branch October 16, 2023 19:04
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
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants