Fixes for stricter compilers#1703
Merged
rapids-bot[bot] merged 6 commits intorapidsai:mainfrom Feb 7, 2026
Merged
Conversation
Added [[fallthrough]] attribute to switch cases in team_sum function for clarity and correctness. Initialized seed_index to 0 to avoid potential uninitialized variable usage and remove an unused variable
Contributor
|
Thank you for your contribution. Much appreciated. Looking at your other PRs, would you be opposed to combining them into this PR (#1703)?
We can test these together. We can set the title for this PR to say |
mythrocks
reviewed
Jan 14, 2026
| for (uint32_t j = 0; j < num_distilation; j++) { | ||
| // Select a node randomly and compute the distance to it | ||
| IndexT seed_index; | ||
| IndexT seed_index = 0; |
Contributor
There was a problem hiding this comment.
I'm not completely convinced that there is a problem here. seed_index's uninitialized value isn't read.
But this does indicate that this can be tightened up.
mythrocks
reviewed
Jan 14, 2026
Comment on lines
-118
to
126
| IndexT seed_index; | ||
| IndexT seed_index = 0; | ||
| if (valid_i) { | ||
| // uint32_t gid = i + (num_pickup * (j + (num_distilation * block_id))); | ||
| uint32_t gid = block_id + (num_blocks * (i + (num_pickup * j))); | ||
| if (seed_ptr && (gid < num_seeds)) { | ||
| seed_index = seed_ptr[gid]; | ||
| } else { | ||
| seed_index = device::xorshift64(gid ^ rand_xor_mask) % dataset_desc.size; | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
An argument can be made to use an IIFE for this variable. That would also allow it to be const:
IndexT const seed_index = [&] {
if (valid_i) {
// uint32_t gid = i + (num_pickup * (j + (num_distilation * block_id)));
uint32_t gid = block_id + (num_blocks * (i + (num_pickup * j)));
if (seed_ptr && (gid < num_seeds)) {
return seed_ptr[gid];
} else {
return device::xorshift64(gid ^ rand_xor_mask) % dataset_desc.size;
}
}
}();
mythrocks
reviewed
Jan 14, 2026
| case 3: x += raft::shfl_xor(x, 4); | ||
| case 2: x += raft::shfl_xor(x, 2); | ||
| case 1: x += raft::shfl_xor(x, 1); | ||
| case 5: x += raft::shfl_xor(x, 16); [[fallthrough]]; |
Member
|
/ok to test 9827f5a |
mythrocks
reviewed
Jan 15, 2026
Updated copyright date.
Member
|
/ok to test 8db9f00 |
cjnolet
approved these changes
Jan 30, 2026
Member
|
/merge |
Member
|
/ok to test e5263f4 |
benfred
pushed a commit
to benfred/cuvs
that referenced
this pull request
Feb 10, 2026
Added [[fallthrough]] attribute to switch cases in team_sum function for clarity and correctness. Initialized seed_index to 0 to avoid potential uninitialized variable usage and remove an unused variable Authors: - Max Buckley (https://github.com/maxwbuckley) - MithunR (https://github.com/mythrocks) - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Corey J. Nolet (https://github.com/cjnolet) URL: rapidsai#1703
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added [[fallthrough]] attribute to switch cases in team_sum function for clarity and correctness. Initialized seed_index to 0 to avoid potential uninitialized variable usage and remove an unused variable