pr72-1-draft-dcp-config-propagation.patch 1.7 KB

1234567891011121314151617181920212223242526272829303132333435
  1. diff --git a/vllm/v1/spec_decode/llm_base_proposer.py b/vllm/v1/spec_decode/llm_base_proposer.py
  2. index 09e15c7b2..9a50c4c8d 100644
  3. --- a/vllm/v1/spec_decode/llm_base_proposer.py
  4. +++ b/vllm/v1/spec_decode/llm_base_proposer.py
  5. @@ -1332,10 +1332,29 @@ class SpecDecodeBaseProposer:
  6. Subclasses may override to apply additional config changes.
  7. """
  8. spec_cfg = self.speculative_config
  9. + draft_parallel_config = spec_cfg.draft_parallel_config
  10. + # create_draft_parallel_config() does not copy
  11. + # decode_context_parallel_size from the target, so the draft
  12. + # attention silently runs with dcp=1 (no q-allgather, no LSE merge)
  13. + # while its KV/metadata use DCP-local sharded semantics. The V2
  14. + # runner path (gpu/spec_decode/eagle/utils.py) restores the target
  15. + # DCP for native MTP drafts; mirror that here for the V1 path.
  16. + import os as _os
  17. +
  18. + default_shard_draft = "1" if spec_cfg.method == "mtp" else "0"
  19. + if _os.environ.get(
  20. + "VLLM_DCP_SHARD_DRAFT", default_shard_draft
  21. + ).lower() in ("1", "true", "yes"):
  22. + draft_parallel_config = replace(
  23. + draft_parallel_config,
  24. + decode_context_parallel_size=(
  25. + self.vllm_config.parallel_config.decode_context_parallel_size
  26. + ),
  27. + )
  28. config = replace(
  29. self.vllm_config,
  30. parallel_config=replace(
  31. - spec_cfg.draft_parallel_config,
  32. + draft_parallel_config,
  33. rank=self.vllm_config.parallel_config.rank,
  34. ),
  35. model_config=spec_cfg.draft_model_config,