diff --git a/cub/grid/grid_even_share.cuh b/cub/grid/grid_even_share.cuh index fcbf370c89..badbfd62b7 100644 --- a/cub/grid/grid_even_share.cuh +++ b/cub/grid/grid_even_share.cuh @@ -78,7 +78,7 @@ struct GridEvenShare { private: - OffsetT total_tiles; + int total_tiles; int big_shares; OffsetT big_share_items; OffsetT normal_share_items; @@ -130,11 +130,11 @@ public: this->block_offset = num_items_; // Initialize past-the-end this->block_end = num_items_; // Initialize past-the-end this->num_items = num_items_; - this->total_tiles = cub::DivideAndRoundUp(num_items_, tile_items); - this->grid_size = CUB_MIN(static_cast(total_tiles), max_grid_size); - OffsetT avg_tiles_per_block = total_tiles / grid_size; - // leftover grains go to big blocks - this->big_shares = static_cast(total_tiles - (avg_tiles_per_block * grid_size)); + this->total_tiles = static_cast(cub::DivideAndRoundUp(num_items_, tile_items)); + this->grid_size = CUB_MIN(total_tiles, max_grid_size); + int avg_tiles_per_block = total_tiles / grid_size; + // leftover grains go to big blocks: + this->big_shares = total_tiles - (avg_tiles_per_block * grid_size); this->normal_share_items = avg_tiles_per_block * tile_items; this->normal_base_offset = big_shares * tile_items; this->big_share_items = normal_share_items + tile_items;