[style] Extract init-static values in forward path (#30708)

This commit is contained in:
Liangsheng Yin
2026-07-09 19:35:00 -07:00
committed by GitHub
parent b5e75b9423
commit dda61b476e
8 changed files with 30 additions and 22 deletions
@@ -216,7 +216,7 @@ class EagerRunner(BaseRunner):
runs under. PDmux selects a per-stream backend and publishes it via an
active ForwardContext; non-pdmux uses attn_backend + the ambient ctx."""
model_runner = self.model_runner
if model_runner.server_args.enable_pdmux:
if self.enable_pdmux:
return model_runner.decode_attn_backend, forward_context(
ForwardContext(attn_backend=model_runner.decode_attn_backend)
)
@@ -228,7 +228,7 @@ class EagerRunner(BaseRunner):
pp_proxy_tensors=None,
) -> Union[LogitsProcessorOutput, PPProxyTensors]:
model_runner = self.model_runner
enable_pdmux = model_runner.server_args.enable_pdmux
enable_pdmux = self.enable_pdmux
attn_backend, pdmux_ctx = self._resolve_decode_pdmux()
if not enable_pdmux:
forward_batch = self.load_batch(forward_batch, pp_proxy_tensors)
@@ -263,7 +263,7 @@ class EagerRunner(BaseRunner):
model_runner = self.model_runner
kwargs = model_runner._extend_forward_kwargs(forward_batch, pp_proxy_tensors)
if not model_runner.server_args.enable_pdmux:
if not self.enable_pdmux:
forward_batch = self.load_batch(forward_batch, pp_proxy_tensors)
if forward_batch.needs_forward_metadata_init():
@@ -393,7 +393,7 @@ class EagerRunner(BaseRunner):
# Padded idle (DP-attn MLP sync) needs metadata reinit; unpadded must
# drop stale forward_metadata to avoid an SWA use-after-free on req_pool.
if forward_batch.batch_size > 0:
if not model_runner.server_args.enable_pdmux:
if not self.enable_pdmux:
forward_batch = self.load_batch(forward_batch, pp_proxy_tensors)
model_runner.attn_backend.init_forward_metadata(forward_batch)
else: