-
Notifications
You must be signed in to change notification settings - Fork 915
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
Use cudf::thread_index_type
in cuIO to prevent overflow in row indexing
#13910
Use cudf::thread_index_type
in cuIO to prevent overflow in row indexing
#13910
Conversation
…bug-prevent-overflow-tidx
…cudf into bug-prevent-overflow-tidx
while (cur_row < end_row) { | ||
auto const is_valid = cur_row < col.size() and col.is_valid(cur_row); |
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.
redundant check with cur_row < end_row
cpp/src/io/csv/csv_gpu.cu
Outdated
@@ -317,8 +316,8 @@ __global__ void __launch_bounds__(csvparse_block_dim) | |||
auto const raw_csv = data.data(); | |||
// thread IDs range per block, so also need the block id. | |||
// this is entry into the field array - tid is an elements within the num_entries array | |||
long const rec_id = threadIdx.x + (blockDim.x * blockIdx.x); | |||
long const rec_id_next = rec_id + 1; | |||
auto const rec_id = cudf::thread_index_type{threadIdx.x} + (blockDim.x * blockIdx.x); |
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.
Promoting just the threadId.x
does not appear to be enough to promote the multiplication
https://godbolt.org/z/coqPKqfWe
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.
moved the promotion to the multiplication
…bug-prevent-overflow-tidx
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.
Looks good, just a couple of comments.
…bug-prevent-overflow-tidx
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.
Looks great!
/merge |
This PR adds `grid_1d::grid_stride()` and uses it in a handful of kernels. Follow-up to #13910, which added a `grid_1d::global_thread_id()`. We'll need to do a later PR that catches any missing instances where this should be used, since there are a large number of PRs in flight touching thread indexing code in various files. See #10368. Authors: - Bradley Dice (https://github.com/bdice) Approvers: - Yunsong Wang (https://github.com/PointKernel) - Vyas Ramasubramani (https://github.com/vyasr) URL: #13996
Description
Use wider type for indexing when rows are indexed in pattern
or
Overflow can happen when the number of rows is so close to
max<size_type>
that adding block size pushes the index over the max.Also sprinkled auto where increased size is not needed.
Also removed a few redundant conditions.
Checklist