cub icon indicating copy to clipboard operation
cub copied to clipboard

Eliminate max_dim_x checks

Open gevtushenko opened this issue 3 years ago • 0 comments

Currently, scan is organized as follows:

int max_dim_x;
if (CubDebug(error = cudaDeviceGetAttribute(&max_dim_x, cudaDevAttrMaxGridDimX, device_ordinal))) break;

// Run grids in epochs (in case number of tiles exceeds max x-dimension
int scan_grid_size = CUB_MIN(num_tiles, max_dim_x);
for (int start_tile = 0; start_tile < num_tiles; start_tile += scan_grid_size) {
  // scan a tile

Starting with SM35 (minimal supported version for CUB), the max_dim_x always matches the int max, so this loop is of no use. Moreover, scan by key uses the very same approach, but ignores start_tile variable in tile index computation.

If there's nothing I'm missing, I suggest we remove max_dim_x checks and simplify the code.

gevtushenko avatar May 25 '22 09:05 gevtushenko