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 | None = None, cft_max_tokens_for_combine: int | None = None, lamport: bool | None = None, lamport_max_tokens: int | None = None, timeout_sec: int = 300, enable_pdl: bool | None = None, *, sync_protocol: SyncProtocol = 'auto')¶
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.sync_protocolselects how a rank learns that the rows of a step have arrived:"fence": senders write their rows, then publish per-peer completion flags behind a system-scope fence, and receivers wait for the flags of every peer. Carries every step."sentinel": every landing row holds a sentinel word that no payload word takes, and every 16-byte vector a sender pushes replaces it, so receivers poll the data itself: no flags and no fence between data and its readiness. Takes every step it can carry, up tomax_tokens_per_ranktokens."auto"(default): the sentinel protocol for steps whose busiest rank sends at mostAUTO_SENTINEL_MAX_TOKENS(256) tokens, the fence protocol for the others.
sync_protocolmust be the same on every EP rank; constructing the communication raisesValueErrorotherwise. 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.The sentinel protocol needs compute capability 10.0, 10.3 or 10.7, at most 64 EP ranks, a BF16 combine and a BF16,
MXFP8,DeepSeekFp8orNVFP4dispatch format. Where a rank does not support it, every rank uses the fence protocol (logged as a warning under"sentinel"). It cannot carry steps witheplb_local_statsor with payloads outside the instance’s format; those take the fence protocol. Payload words equal to its sentinel arrive rewritten to the same value (NaN stays NaN), so callers sending other bytes in BF16 rows use"fence", as the split layer does for kernels that pack their dispatch rows. A sentinel 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 protocol, it needs every rank to passtopk_weightsin a step or none (seeNVLinkOneSidedAlltoAll.dispatch). Its landing, combine and receive regions holdep_sizerows per token of its largest step, next to the fence protocol’s regions in the workspace; rank 0 logs their size.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.Deprecated, each with a
DeprecationWarningwhen set:lamport:Falseselectssync_protocol="fence";Truekeeps"auto".lamport_max_tokens: the largest step the sentinel protocol takes under"auto", the same on every rank.cft: CFT counted writes are not available;Trueselectssync_protocol="fence",Falsehas no effect.cft_max_tokens_for_dispatch,cft_max_tokens_for_combine: no effect.
lamport,lamport_max_tokensandcftcannot be combined with async_protocolother than"auto", norlamport=Truewithcft=True; either raisesValueError.