Workflow

Example

PP4 async depth = 0

PP0  mb0  mb1  mb2  mb3
PP1       mb0  mb1  mb2  mb3
PP2            mb0  mb1  mb2  mb3
PP3                 mb0  mb1  mb2  mb3

PP4 async depth = 2

PP0  mb0  mb1  mb2  mb3  mb4  mb5
PP1       mb0  mb1  mb2  mb3  mb4  mb5
PP2            mb0  mb1  mb2  mb3  mb4  mb5
PP3                 mb0  mb1  mb2  mb3  mb4  mb5

以 PP1 处理 mb1 和 mb2 的流程为例:

prev mb current mb next mb next_first_rank_mb
recv_meta(mb1)
commit_meta(mb0)
prefill_chunk(mb1)
get_new_prefill_batch(mb1)
recv_hs(mb1)
commit_output(next_first) if async_depth > 0
commit_hs(mb0)
launch(mb1)
commit_output(next_first) if async_depth == 0
send_consensus(next_first)
commit_consensus(next_first)
commit_release(next_first)
harvest_wait(mb2)
harvest(mb2)
process_inflight(mb2)
send_req(mb1)
send_hs(mb1)

async depth

如果 async depth == 0,那么在 launch 下一个 loop 的 current_mb 时,必须同步等待上一个 loop 的 current_mb 完成。

PP 和 TP 对比

讨论 PP 和 TP 方案在 Prefill 阶段的优劣