Segmented Topk tuning on B200 indexed.cluster#9801
Conversation
Also avoid unnecessary grid sync in reduce-then-scan path
from gmem (L2)
Also remove ifdefs since perf is clearly worse with the alternative code paths.
Also fixes use of generic addressing due to spilling of smem addresses to local memory.
BlockLoadToShared seems to have some problems when used for pipelining. So for now it was replaced with direct PTX.
This might help on Hopper. Need to check that it does not pessimize Blackwell. Also some cleanup.
This is in preparation of implementing deterministic TopK (via counting scan)
Adds env-based dispatch and moves to new argument-framework.
It is too expensive to do it after every tile. Just try to avoid unnecessary global loads. Also avoid unnecessary global loads in the CTAs that don't straddle the candidate boundary. They do not have to care about iterating through keys in any special order.
Always put the unaligned part into the tail edge buffer and do not force the remaining laigned tail to be resident.
Use aligned cluster barrier instructions among other things.
If it fits a single chunk there isn't much latency hiding we can do.
This reverts commit 1a8e1bb.
Enable auto-tuning of the cluster backend.
Start ping-pong with the right direction from the start.
Mostly SASS neutral up to a SASS reduction from process_tiles dedup.
Slight SASS impact, need to benchmark.
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
| make_sm100_pairs_cluster_policy(::cuda::std::int64_t static_max_segment_size, ::cuda::std::int64_t max_k) | ||
| -> cluster_topk_policy | ||
| { | ||
| if (static_max_segment_size <= 512 && max_k <= 512) |
There was a problem hiding this comment.
I think our benchmark only covers k = max_seg_size = 512 which always takes the fast-path and just copies gmem->gmem. So I don't know if anything in this tuning is actually good for k < max_seg_size <= 512. For that copy fast path the only important parameters are threads_per_block, min_blocks_per_sm and copy_items_per_thread I think. The rest might be arbitrary.
| /*tie_break_items_per_thread=*/8, | ||
| /*copy_items_per_thread=*/9}; | ||
| } | ||
| if (static_max_segment_size <= 1024 && max_k <= 1024) |
There was a problem hiding this comment.
https://github.com/NVIDIA/cccl/pull/9801/changes#r3562779477 Same applies here.
|
Final full results for |
indexed.cluster
Adds tuning encodings for segmented TopK. It's based on top of https://github.com/NVIDIA/cccl/pull/9224/changes so I draft until #9224 gets merged.
I like the speedups, not sure if we expected more. This of course is using @bernhardmgruber's new (amazing) tuning API.
If anyone wants to review it pre-emptively see only the changes in this file
cub/cub/device/dispatch/tuning/tuning_batched_topk.cuhVerification benchmark below.