Speed up segmented_bitmask_and for tall tables - #23686
Conversation
…blocks The kernel gave each segment a single warp, so the whole null mask of a column was walked by 32 threads: reducing 192 masks of 500k rows was only 6144 threads for 3M words and ran at roughly a tenth of achievable bandwidth. Blocks now cooperate on a segment when there are few of them, with the per-segment null count accumulated across the blocks. The existing benchmark axes only cover masks of up to 128 bits, which fit in a handful of words and cannot show this, so add a case with mask sizes in the range of real table row counts.
2c852ca to
8bed98e
Compare
|
Rebased onto The rebase took the identity seed and the guard ordering from #23689, so this branch no longer carries the bounds-check move. Only the parallelization is left. Updated after review: the multi-block path now has a test, the null counts are zeroed with Performance, A100 80GB PCIe
These are from the pre-review measurement session; the review changes do not affect this path. The launch configuration here is identical before and after, and I re-checked the kernel itself under
These are larger than the numbers I posted before the rebase because #23689 switched the benchmark to Poisson-distributed segment sizes. With one warp per segment all segments run concurrently, so the kernel takes as long as the largest segment, and the spread that Poisson introduces lands entirely on the critical path. Spreading a segment across blocks makes that imbalance mostly irrelevant. The existing narrow axes (
Choosing the grid capReview asked why the cap on total blocks was a hardcoded
A single wave costs up to 38% on the microbenchmarks, because at 512 segments it collapses Eight waves is within noise of the tuned constant on every shape measured. So the device-independent constant is gone and the target is now Validation
The new |
segmented_bitmask_and for tall tables
Add a test with a segment wide enough to span several blocks, so the cross-block null count accumulation and the partial last word are exercised. Scale the grid cap to the device instead of hardcoding it, and zero the null counts at the declaration site.
…com/vuule/cudf into segmented-bitmask-binop-parallelism
Description
segmented_offset_bitmask_binopassigns one warp to each segment, so a segment's entire null mask is walked by 32 threads regardless of how long it is. For the struct null mask reduction this kernel exists to serve, a segment is one column's mask and its length is the table's row count, so a handful of columns over a million rows runs on a few hundred threads and reaches a fraction of a percent of achievable bandwidth.Blocks now cooperate on a segment when there are few segments, with each segment's null count accumulated across its blocks.
blocks_per_segmentis chosen so that a batch of a few wide segments splits each segment across enough blocks to fill the device, while a batch of many segments keeps one block each.Also added benchmark cases that show the improvement. Result are posted in a comment.
Checklist