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 AllocateLikeTest gtests reading uninitialized null-mask #12643

Merged
merged 3 commits into from
Jan 31, 2023

Conversation

davidwendt
Copy link
Contributor

@davidwendt davidwendt commented Jan 30, 2023

Description

Fixes a bug found in the gtests AllocateLikeTest.ColumnNumericTestSameSize and AllocateLikeTest.ColumnNumericTestSpecifiedSize where uninitialized column null-masks are used to verify null-counts.
This error was found by running the following in the libcudf build directory:

gtests/COPYING_TEST --rmm_mode=cuda

The AllocateLikeTest tests cudf::allocate_like() which produces an uninitialized fixed-width column which is usually filled in by internal functions. The uninitialized column data includes its null-mask. The gtest uses CUDF_TEST_EXPECT_COLUMN_PROPERTIES_EQUAL to verify the column returned by allocate_like() which also includes the null_count(). The null-count property returned by allocate_like() sets the null-count to UNKNOWN_NULL_COUNT which causes a future call to null_count() to calculate the count by reading the bits in the null-mask. Since the null-mask is uninitialized (garbage), the null-count would be invalid and likely not match any predictable value.
The gtests are updated to check for appropriate column properties excluding the null-count.

While debugging this issue, the allocate_like() logic was found to also attempt to build child columns incorrectly assuming the children will contain the same size and null-mask. Since the allocate_like() only supports fixed-width types which do not have children, this logic was removed.

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 self-assigned this Jan 30, 2023
@github-actions github-actions bot added the libcudf Affects libcudf (C++/CUDA) code. label Jan 30, 2023
@davidwendt davidwendt added bug Something isn't working 2 - In Progress Currently a work in progress non-breaking Non-breaking change labels Jan 30, 2023
@codecov
Copy link

codecov bot commented Jan 30, 2023

Codecov Report

❗ No coverage uploaded for pull request base (branch-23.04@d715ac8). Click here to learn what that means.
Patch has no changes to coverable lines.

Additional details and impacted files
@@               Coverage Diff               @@
##             branch-23.04   #12643   +/-   ##
===============================================
  Coverage                ?   85.82%           
===============================================
  Files                   ?      158           
  Lines                   ?    25184           
  Branches                ?        0           
===============================================
  Hits                    ?    21614           
  Misses                  ?     3570           
  Partials                ?        0           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@davidwendt davidwendt added 3 - Ready for Review Ready for review by team and removed 2 - In Progress Currently a work in progress labels Jan 30, 2023
@davidwendt davidwendt marked this pull request as ready for review January 30, 2023 23:11
@davidwendt davidwendt requested a review from a team as a code owner January 30, 2023 23:11
@davidwendt davidwendt requested review from vyasr and vuule January 30, 2023 23:11
Copy link
Contributor

@vyasr vyasr left a comment

Choose a reason for hiding this comment

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

Nice find! I see two other uses of allocate_like in column_device_view_test.cu, but in that case it looks like the columns are filled before any comparison so I think this isn't an issue, right?

@davidwendt
Copy link
Contributor Author

Nice find! I see two other uses of allocate_like in column_device_view_test.cu, but in that case it looks like the columns are filled before any comparison so I think this isn't an issue, right?

Yes, it is not an issue there because the uninitialized data is not read and there is no null-mask.

@davidwendt
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit 6a67e8f into rapidsai:branch-23.04 Jan 31, 2023
@davidwendt davidwendt deleted the bug-allocate-like-test branch January 31, 2023 22:52
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.

3 participants