flashinfer.cake_gdn_det_train_kcp.cake_gdn_det_train_kcp_partition¶
- flashinfer.cake_gdn_det_train_kcp.cake_gdn_det_train_kcp_partition(cu_seqlens_global_cpu: Any, world_size: int, layout: str = 'contiguous', fragments: Any | None = None, *, cut_points: Any | None = None) Any¶
Partition one packed batch of documents over the ranks of a context-parallel group.
- Parameters:
cu_seqlens_global_cpu – The packed documents’
cu_seqlens(CPU int64 tensor or a sequence of ints; first 0).world_size (int) – Ranks of the context-parallel group.
layout (str) –
"contiguous"(near-equal token intervals),"zigzag"(2 Wparts, rankrholds partsrand2W-1-r) or"zigzag_per_document"(every document cut into2 Wpieces atcut_points, default near-equal; rankrholds piecesrand2W-1-rof every document). Nototal % Wrequirement; cut points need not be multiples of 64; zero-length fragments are legal.fragments (optional) – An explicit (ragged) table
fragments[rank] = [(doc, offset_in_doc, length), ...]in local order, validated againstcu_seqlens.cut_points (optional) – Per document the
2 W + 1cut offsets of"zigzag_per_document".
- Returns:
CakeGDNDetKcpPartition: per rank the fragment table(doc, off, length, prev, next)in document order; reused across layers (metadata only).- Return type:
CakeGDNDetKcpPartition