flashinfer.moe_ep.NVLinkOneSidedConfig¶
- class flashinfer.moe_ep.NVLinkOneSidedConfig(backend_name: str = 'nvlink_one_sided', extra_payload_bytes_per_token: int = 0, eplb_stats_num_experts: int = 0, enable_rank_mask: bool = False, use_low_precision_combine: bool = False, comm_backend: 'CommBackend' | None = None, cft: bool | None = None, cft_max_tokens_for_dispatch: int = 128, cft_max_tokens_for_combine: int = 128, lamport: bool | None = None, lamport_max_tokens: int | None = None, timeout_sec: int = 300, enable_pdl: bool | None = None)¶
Bases:
objectOptions of
NVLinkOneSidedAlltoAll.Pass to
create_communication(..., backend=NVLinkOneSidedConfig(...))orMoEEpLayer(..., backend=SplitConfig(comm=NVLinkOneSidedConfig(...))).The dispatch workspace holds each token’s activations as described by
MoEEpCommParams.dispatch_formatplus its routing;extra_payload_bytes_per_tokenreserves room for anything else sent per token.eplb_stats_num_expertsenables all-gathering EPLB statistics of that many experts during dispatch.enable_rank_maskcompiles in rank-mask support foractive_rank_mask.use_low_precision_combinesends combine payloads as FP8.comm_backendexchanges the MNNVL memory handles and defaults to torch.distributed over the bootstrap process group.cftselects CFT counted writes, which push payloads over the NVLink fabric withfabric.try_put.countedand let the receiver wait on hardware byte counters. They need compute capability 10.0 or newer, a FlashInfer build against CUDA 13.4+ and a driver of the 615 branch or newer that exports the CUDA logical-endpoint API; payload rows must be multiples of 16 bytes.None(default) uses them where every rank supports them, for steps whose busiest rank sends at mostcft_max_tokens_for_dispatch(dispatch) orcft_max_tokens_for_combine(combine) tokens;Trueuses them for every step where supported;Falsenever uses them. Steps the Lamport transport takes (seelamport) do not use them. Only one workspace per process can bind CFT endpoints; further workspaces use the fence path.lamportselects the Lamport transport for small steps: one dispatch and one combine kernel in which every pushed vector carries its own arrival, so no rank waits for a completion flag or fence. It needs compute capability 10.0 or 10.3, at most 64 EP ranks, a BF16 combine and a BF16,MXFP8,DeepSeekFp8orNVFP4dispatch format. Where every rank supports it, it takes every step withouteplb_local_statswhose busiest rank sends at mostlamport_max_tokenstokens, ahead of CFT. A step’s busiest-rank count is theruntime_max_tokens_per_rankpassed to dispatch (the same on every rank, fixed in a captured CUDA graph), whichMoEEpSplitLayerpasses fromMoEEpTensors.runtime_max_tokens_per_rank; a step that passes none is compared at the capacity,max_tokens_per_rank.None(default) turns it on unlesscft=True;Trueturns it on and cannot be combined withcft=True;Falseleaves those steps to CFT or the fence path. A rank where it is off turns it off on every rank.lamport_max_tokensmust be the same on every rank; it defaults to the largest step whose dispatch grid stays below one wave of resident blocks and whose Lamport regions stay within 64 MiB per rank (a speed bound, not a memory budget), then clamped to 159 to 512 tokens and tomax_tokens_per_rank. The regions holdep_size * lamport_max_tokenslanding, combine and receive rows; rank 0 logs their size, about 420 MiB per rank at EP 64 for hidden size 7168 in BF16. Payload words equal to the transport’s sentinel arrive rewritten to the same value (NaN stays NaN), so callers sending other bytes in BF16 rows turn it off, as the split layer does for kernels that pack their dispatch rows. A Lamport step places the rows it receives from ranksrcfor its tokentatsrc * tokens_per_rank + t,tokens_per_rankbeing the step’sruntime_max_tokens_per_rank. Like the fence path, it needs every rank to passtopk_weightsin a step or none (seeNVLinkOneSidedAlltoAll.dispatch).timeout_secbounds every wait on a peer rank, in nominal seconds at a 2 GHz SM clock; a wait that exceeds it traps the kernel. It is recorded into CUDA graphs at capture time.enable_pdllaunches the dispatch and combine kernels with programmatic dependent launch;None(default) enables it on compute capability 9.0 and newer.