vllm.model_executor.kernels.attention.dsa.dcp_topk_direct
¶
Direct DCP top-k candidate exchange over PyTorch symmetric memory.
Replaces the NCCL all-gather of the DCP indexer merge for small batches. Each rank packs its local (score, global token id) candidates, stores them into every peer's inbox slice, then publishes an epoch and waits for all peers. The stable top-k selector reads the completed local inbox directly. Two alternating inboxes let the next exchange start without a read acknowledgement: a rank can only overwrite a slot after every peer has published the exchange in between, i.e. after their selectors consumed it.
On SM90+, programmatic dependent launches overlap the dispatch of the pack, push, publish and select kernels; device-side waits keep the data dependencies.
Classes:
-
DirectDCPTopKWorkspace–Symmetric ping-pong inboxes for the DCP top-k candidate exchange.
Functions:
-
get_direct_dcp_topk_workspace–Collective on first call (symmetric-memory rendezvous): every DCP rank
DirectDCPTopKWorkspace
¶
Bases: DirectCPWorkspace
Symmetric ping-pong inboxes for the DCP top-k candidate exchange.
get_direct_dcp_topk_workspace(group, device, max_rows, candidates_per_rank, use_direct)
cached
¶
Collective on first call (symmetric-memory rendezvous): every DCP rank must call it with the same arguments, outside CUDA graph capture.