Skip to content

Commit

Permalink
Update cudf::detail::grid_1d to use thread_index_type (#16276)
Browse files Browse the repository at this point in the history
Updates the `cudf::detail::grid_1d` to use `thread_index_type` instead of `int` and `size_type` for the number threads and blocks.
This has become important for launching kernels with more threads than max `size_type` total bytes for warp-per-row and thread-per-byte algorithms.

Authors:
  - David Wendt (https://github.com/davidwendt)

Approvers:
  - Bradley Dice (https://github.com/bdice)
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Nghia Truong (https://github.com/ttnghia)

URL: #16276
  • Loading branch information
davidwendt authored Jul 17, 2024
1 parent 2f8d514 commit 093bcc9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cpp/include/cudf/detail/utilities/cuda.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ static constexpr size_type warp_size{32};
*/
class grid_1d {
public:
int const num_threads_per_block;
int const num_blocks;
thread_index_type const num_threads_per_block;
thread_index_type const num_blocks;
/**
* @param overall_num_elements The number of elements the kernel needs to
* handle/process, in its main, one-dimensional/linear input (e.g. one or more
Expand All @@ -55,9 +55,9 @@ class grid_1d {
* than a single element; this affects the number of threads the grid must
* contain
*/
grid_1d(cudf::size_type overall_num_elements,
cudf::size_type num_threads_per_block,
cudf::size_type elements_per_thread = 1)
grid_1d(thread_index_type overall_num_elements,
thread_index_type num_threads_per_block,
thread_index_type elements_per_thread = 1)
: num_threads_per_block(num_threads_per_block),
num_blocks(util::div_rounding_up_safe(overall_num_elements,
elements_per_thread * num_threads_per_block))
Expand Down

0 comments on commit 093bcc9

Please sign in to comment.