20-v1_worker_gpu_attn_utils.py.diff 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. --- baked-ours/v1/worker/gpu/attn_utils.py 2026-09-10 19:56:14.000000000 +0200
  2. +++ baked/v1/worker/gpu/attn_utils.py 2026-09-11 10:13:47.000000000 +0200
  3. @@ -20,6 +20,7 @@
  4. KVCacheConfig,
  5. KVCacheSpec,
  6. UniformTypeKVCacheSpecs,
  7. + is_dcp_replicated_spec,
  8. )
  9. from vllm.v1.worker.gpu.model_states.interface import ModelSpecificAttnMetadata
  10. from vllm.v1.worker.utils import (
  11. @@ -283,6 +284,13 @@
  12. for i in range(num_kv_cache_groups):
  13. block_table = block_tables[i]
  14. slot_mapping = slot_mappings[i]
  15. + # DCP-replicated groups hold every position on every rank: their
  16. + # builders must see the full seq_lens, not this rank's shard.
  17. + group_dcp_local_seq_lens = (
  18. + None
  19. + if is_dcp_replicated_spec(kv_cache_config.kv_cache_groups[i].kv_cache_spec)
  20. + else dcp_local_seq_lens
  21. + )
  22. # Per-group causal for hybrid drafters (mixed SWA/full attention).
  23. group_causal = (
  24. causal if isinstance(causal, (bool, torch.Tensor)) else causal.get(i, True)
  25. @@ -310,7 +318,7 @@
  26. block_table_tensor=block_table,
  27. slot_mapping=slot_mapping,
  28. causal=group_causal,
  29. - dcp_local_seq_lens=dcp_local_seq_lens,
  30. + dcp_local_seq_lens=group_dcp_local_seq_lens,
  31. positions=positions,
  32. is_prefilling=group_is_prefilling,
  33. mm_req_doc_ranges=mm_req_doc_ranges,