01-distributed_communication_op.py.diff 869 B

1234567891011121314151617181920
  1. --- baked-ours/distributed/communication_op.py 2026-09-10 19:56:14.000000000 +0200
  2. +++ baked/distributed/communication_op.py 2026-09-11 10:13:47.000000000 +0200
  3. @@ -9,8 +9,17 @@
  4. from .parallel_state import get_tp_group
  5. +_DSV41_PREFILL_TIMING = __import__("os").environ.get("DSV41_PREFILL_TIMING", "0") == "1"
  6. +
  7. +
  8. def tensor_model_parallel_all_reduce(input_: torch.Tensor) -> torch.Tensor:
  9. """All-reduce the input tensor across model parallel group."""
  10. + if _DSV41_PREFILL_TIMING and input_.dim() >= 2 and input_.shape[0] >= 1024:
  11. + # Stage 7: phase "allreduce" of the prefill budget.
  12. + from vllm.model_executor.kernels.attention.dsa.candidate_blocks import _PrefillTimer
  13. +
  14. + with _PrefillTimer("allreduce", int(input_.shape[0])):
  15. + return get_tp_group().all_reduce(input_)
  16. return get_tp_group().all_reduce(input_)