How to use Cub::BlockHistogram when some of the values are not valid?

18 hours ago 1
ARTICLE AD BOX

I'm using cub::BlockHistogram<std::uint16_t, 256, items_per_thread, 256, cub::BLOCK_HISTO_ATOMIC>; and I was expecting an API with similar utility to cub::Warp* functions, however there doesn't appear to be a method parameter for creating the histogram to handle over provisioned threads (like valid_items). How do I deal with over-provisioned threads with block histogram, for example the length of my data is N, but the amount of threads I launched is more than N? The only way I can see to do this is to manually count the amount of invalid values and subtract from the 0th bin, but I'm trying to replace code that can already handle this with an if statement and __activethreads() which doesn't have this issue, and I don't see this mentioned in the documentation anywhere.

Krupip's user avatar

Read Entire Article