Skip to content

Commit

Permalink
fixing thread index overflow issue (#14290)
Browse files Browse the repository at this point in the history
Ran across this issue during the review of NVIDIA/spark-rapids-jni#1502 and since the code was modeled after this code, I am pushing the fix here as well.

Authors:
  - Mike Wilson (https://github.com/hyperbolic2346)

Approvers:
  - David Wendt (https://github.com/davidwendt)
  - Nghia Truong (https://github.com/ttnghia)

URL: #14290
  • Loading branch information
hyperbolic2346 authored Oct 24, 2023
1 parent 19d791c commit bc4d38d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cpp/src/strings/convert/convert_urls.cu
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ __global__ void url_decode_char_counter(column_device_view const in_strings,
char* in_chars_shared = temporary_buffer[local_warp_id];

// Loop through strings, and assign each string to a warp.
for (size_type row_idx = global_warp_id; row_idx < in_strings.size(); row_idx += nwarps) {
for (thread_index_type tidx = global_warp_id; tidx < in_strings.size(); tidx += nwarps) {
auto const row_idx = static_cast<size_type>(tidx);
if (in_strings.is_null(row_idx)) {
out_counts[row_idx] = 0;
continue;
Expand Down Expand Up @@ -296,7 +297,8 @@ __global__ void url_decode_char_replacer(column_device_view const in_strings,
char* in_chars_shared = temporary_buffer[local_warp_id];

// Loop through strings, and assign each string to a warp
for (size_type row_idx = global_warp_id; row_idx < in_strings.size(); row_idx += nwarps) {
for (thread_index_type tidx = global_warp_id; tidx < in_strings.size(); tidx += nwarps) {
auto const row_idx = static_cast<size_type>(tidx);
if (in_strings.is_null(row_idx)) continue;

auto const in_string = in_strings.element<string_view>(row_idx);
Expand Down

0 comments on commit bc4d38d

Please sign in to comment.