Repository navigation
Conversation
fbusato
left a comment
There was a problem hiding this comment.
I'm not in favor of that. This can change the performance. If we know that two values are positive (and within the range), we can compare int and unsigned
I think in that case we should assert that at compile-time by using appropriate types. So storing strictly positive values in unsigned types etc |
|
Since most of these are in CUB-land, I would ask that @bernhardmgruber or other CUB maintainers please take a close look at this PR and let me know which values could be made unsigned. I see that a lot of CUB tuning parameters just use |
This comment has been minimized.
This comment has been minimized.
| T addend = temp_storage[HALF_WARP_THREADS + lane_id - offset]; | ||
| // Update partial if addend is in range | ||
| if ((lane_id >= offset) && (static_cast<int>(lane_id) < valid_items)) | ||
| if (::cuda::std::cmp_greater_equal(lane_id, offset) && ::cuda::std::cmp_less(lane_id, valid_items)) |
There was a problem hiding this comment.
I agree with @fbusato, we should be careful about changes in cub. lane_id will always be in range [0;31), we should be fine here
There was a problem hiding this comment.
OK I await decisions then on which values can have their types changed to unsigned, otherwise I will just // NOLINT everything in CUB.
Co-authored-by: David Bayer <[email protected]>
🥳 CI Workflow Results🟩 Finished in 3h 16m: Pass: 100%/331 | Total: 8d 09h | Max: 1h 22m | Hits: 86%/409842See results here. |
There was a problem hiding this comment.
I am also not in favor off those changes.
I believe those a generally a win in user code, but we have to also consider other constraints than user code.
- Does this affect runtime performance in a tight loop?
- Does this affect compile times? We are a template heavy library and using
_Width <= __warp_sizeis much faster to compile than::cuda::std::cmp_less_equal(_Width, __warp_size) - Does this affect debug experience? An integer comparison is just an instruction, but now we have to traverse into a nontrivial function.
So if we can get away with a simple cast, because we know that it will not overflow it is generally
I had a quick look and agree with @fbusato and @miscco that these changes are highly dangerous to affect performance in unpredictable ways. Any change to kernel code must be thoroughly benchmarked. I would leave this clang-tidy check disabled for now. |
|
Tabling for CCCL 4.0 |
Description
closes
Checklist