-
Notifications
You must be signed in to change notification settings - Fork 914
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 some possible thread-id overflow calculations #17473
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6ba8176
Fix some possible thread-id overflow calculations
davidwendt d5f028a
add copy-if-else
davidwendt a86ae23
Merge branch 'branch-25.02' into tid-overflow
davidwendt 5a48d96
Merge branch 'branch-25.02' into tid-overflow
davidwendt 29246b3
Merge branch 'branch-25.02' into tid-overflow
davidwendt 5ad53ff
add tdigest change
davidwendt 356eb3b
Merge branch 'branch-25.02' into tid-overflow
davidwendt 0eeb9a1
Merge branch 'branch-25.02' into tid-overflow
davidwendt 5d58e2f
Merge branch 'branch-25.02' into tid-overflow
davidwendt 3547734
Merge branch 'branch-25.02' into tid-overflow
davidwendt fc284b0
Merge branch 'branch-25.02' into tid-overflow
davidwendt 3c6357d
Merge branch 'tid-overflow' of github.com:davidwendt/cudf into tid-ov…
davidwendt d2c302e
Merge branch 'branch-25.02' into tid-overflow
davidwendt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,8 +38,9 @@ CUDF_KERNEL void kernel(cudf::size_type size, TypeOut* out_data, TypeIn* in_data | |
{ | ||
// cannot use global_thread_id utility due to a JIT build issue by including | ||
// the `cudf/detail/utilities/cuda.cuh` header | ||
thread_index_type const start = threadIdx.x + blockIdx.x * blockDim.x; | ||
thread_index_type const stride = blockDim.x * gridDim.x; | ||
auto const block_size = static_cast<thread_index_type>(blockDim.x); | ||
thread_index_type const start = threadIdx.x + blockIdx.x * block_size; | ||
thread_index_type const stride = block_size * gridDim.x; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is explicit up-casting for multiplication. |
||
|
||
for (auto i = start; i < static_cast<thread_index_type>(size); i += stride) { | ||
GENERIC_UNARY_OP(&out_data[i], in_data[i]); | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -413,7 +413,7 @@ CUDF_KERNEL void compute_segment_sizes(device_span<column_device_view const> col | |
size_type max_branch_depth) | ||
{ | ||
extern __shared__ row_span thread_branch_stacks[]; | ||
int const tid = threadIdx.x + blockIdx.x * blockDim.x; | ||
auto const tid = static_cast<size_type>(cudf::detail::grid_1d::global_thread_id()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Merely for clarity. Prefer the type be |
||
|
||
auto const num_segments = static_cast<size_type>(output.size()); | ||
if (tid >= num_segments) { return; } | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
num_partitions
is close tomax<size_type>
thenpartition_number += blockDim.x
could overlfowsize_type
.