flashinfer.comm.prepare_fp8_rowwise_gemm_allreduce¶
- flashinfer.comm.prepare_fp8_rowwise_gemm_allreduce(a: Tensor, a_scale: Tensor, w: Tensor, w_scale: Tensor, group: ProcessGroup, *, backend: str = 'auto', max_rows: int | None = None)¶
Bind
group,N,K_land a row capacity once; return a capturable launcher.The sample operands fix
NandK_l;max_rows(default: the rows ofa) sizes the symmetric workspace in this single collective and must be identical on every rank: the preparation checks it in that collective and raisesValueErroron every rank when it differs. The returnedlauncher(a, a_scale, w, w_scale, *, out=None)serves any operands of the boundNandK_lwith at mostmax_rowsrows without another collective and is CUDA-graph capturable. Bothbackend="auto"andbackend="cake"select the Cake route (SM100, four-rank NCCL groups, torch’s default CUDA or NVSHMEM symmetric-memory backend). Unsupported inputs raise during preparation instead of falling back to another implementation.- Parameters:
a (torch.Tensor) – Sample contiguous FP8 (e4m3) activation shard of shape
[M, K_l].a,a_scale,w, andw_scalemust be CUDA tensors on one shared device.a_scale (torch.Tensor) – Sample contiguous FP32 row scales of shape
[M].w (torch.Tensor) – Sample contiguous FP8 (e4m3) weight shard of shape
[N, K_l].w_scale (torch.Tensor) – Sample contiguous FP32 column scales of shape
[N].group (torch.distributed.ProcessGroup) – Four-rank NCCL process group on one SM100 node.
backend (str, optional) –
"auto"and"cake"both select the Cake backend.max_rows (int, optional) – Maximum row count accepted by the returned launcher. Must be at least the sample input’s row count. Defaults to the sample input’s row count and must match on every rank.
- Returns:
A CUDA-graph-capturable launcher with signature
launcher(a, a_scale, w, w_scale, *, out=None).- Return type:
Callable