[CP V1 Deprecation 4/5] Canonicalize prefill CP API names (#36229)
This commit is contained in:
@@ -28,7 +28,7 @@ from sglang.srt.layers.cp.utils import (
|
||||
cp_gather_after_forward,
|
||||
cp_shard_model_inputs,
|
||||
get_cp_strategy,
|
||||
is_cp_v2_active,
|
||||
is_cp_active,
|
||||
prepare_cp_forward,
|
||||
)
|
||||
from sglang.srt.layers.pooler import EmbeddingPoolerOutput
|
||||
@@ -281,8 +281,8 @@ class EagerRunner(BaseRunner):
|
||||
if not self.enable_pdmux:
|
||||
forward_batch = self.load_batch(forward_batch, pp_proxy_tensors)
|
||||
|
||||
cp_v2_active = is_cp_v2_active(forward_batch)
|
||||
if cp_v2_active:
|
||||
cp_active = is_cp_active(forward_batch)
|
||||
if cp_active:
|
||||
prepare_cp_forward(forward_batch)
|
||||
|
||||
# Target verify can arrive with ``forward_metadata_ready`` set by an
|
||||
@@ -293,7 +293,7 @@ class EagerRunner(BaseRunner):
|
||||
# directly from the live ``spec_info`` tensors.
|
||||
if (
|
||||
forward_batch.needs_forward_metadata_init()
|
||||
or cp_v2_active
|
||||
or cp_active
|
||||
or forward_batch.forward_mode.is_target_verify()
|
||||
):
|
||||
if model_runner.ps.attn_dcp_size > 1 and hasattr(
|
||||
@@ -330,7 +330,7 @@ class EagerRunner(BaseRunner):
|
||||
torch.get_device_module(model_runner.device),
|
||||
)
|
||||
|
||||
if not cp_v2_active:
|
||||
if not cp_active:
|
||||
forward_batch.attn_cp_metadata = None
|
||||
|
||||
category = (
|
||||
@@ -344,7 +344,7 @@ class EagerRunner(BaseRunner):
|
||||
_is_hip
|
||||
and pcg_runner is not None
|
||||
and not isinstance(pcg_runner, EagerRunner)
|
||||
and not cp_v2_active
|
||||
and not cp_active
|
||||
):
|
||||
# HIP PCG eager fallback: enter the PCG context so Dynamo guards
|
||||
# and PCG-specific MoE/attention paths stay consistent.
|
||||
@@ -366,8 +366,8 @@ class EagerRunner(BaseRunner):
|
||||
forward_batch,
|
||||
**kwargs,
|
||||
)
|
||||
elif cp_v2_active:
|
||||
ret = self._execute_extend_cp_v2(forward_batch, kwargs)
|
||||
elif cp_active:
|
||||
ret = self._execute_extend_cp(forward_batch, kwargs)
|
||||
else:
|
||||
ret = model_runner.model.forward(
|
||||
forward_batch.input_ids,
|
||||
@@ -377,7 +377,7 @@ class EagerRunner(BaseRunner):
|
||||
)
|
||||
return ret
|
||||
|
||||
def _execute_extend_cp_v2(
|
||||
def _execute_extend_cp(
|
||||
self, forward_batch: ForwardBatch, kwargs: dict
|
||||
) -> Union[LogitsProcessorOutput, PPProxyTensors]:
|
||||
"""CP extend: shard inputs at the model boundary, run the body on the
|
||||
|
||||
Reference in New Issue
Block a user