config: retire the alias-form process-global config reads

`sa = get_server_args()` followed by `sa.field` reads the same startup record as
the direct form; the read ratchet added in the previous slice pinned twelve of
them as the remaining surface. Eleven now read the accessor for what they
actually want:

- `is_enable_moe_cp_allgather` compares the attention-CP and MoE-DP sizes to
  decide whether a forward needs an allgather, so it reads the live topology
  through `get_parallel()` — the same source `get_moe_cp_size()` right above it
  already uses. Both groups exist once model-parallel init has run, which is
  before any forward.
- The DeepSeek MLA decode-backend gate and Inkling's attention paths read
  `get_exec().kernel`; Inkling's KV-dtype checks read `get_model()`. These are
  per-runner fields, and the value they get is the config published for the
  runner being built — unchanged from what the alias returned.
- The int8 mamba checkpoint pool reads `get_exec().mamba`. It keeps its guard
  for callers that construct the pool with no published config; that guard now
  catches the namespace accessor instead of the slot.

`model_loader`'s `moe_dp_size` stays on the instance and is exempt: the dict it
belongs to already reports the live size under `"dp"`, so that entry is the
configured intent, and `get_parallel()` shadows the name with the live value.

Alias-form baseline 12 -> 0. What remains on `get_server_args()` in the package
is the derived API (properties and methods computed from several fields plus the
HF config) and four config-intent reads of live-shadowed sizes, each exempt by
name with its reason.
This commit is contained in:
Cheng Wan
2026-08-05 19:29:20 -07:00
committed by GitHub
parent 1d47952c7c
commit bebebb8f6c
7 changed files with 49 additions and 34 deletions
@@ -21,7 +21,7 @@ from sglang.srt.multimodal.kimi_k3_vit_cuda_graph_runner import (
KimiK3ViTCudaGraphRunner,
)
from sglang.srt.multimodal.mm_utils import run_dp_sharded_mrope_vision_model
from sglang.srt.runtime_context import get_parallel
from sglang.srt.runtime_context import get_context, get_parallel
from sglang.test.ci.ci_register import register_cpu_ci
register_cpu_ci(est_time=1, suite="base-a-test-cpu")
@@ -357,7 +357,7 @@ def test_kimi_k3_position_interpolation_uses_contiguous_chw(monkeypatch):
assert torch.equal(actual, expected)
def test_kimi_k3_prepares_shared_attention_metadata_once(monkeypatch):
def test_kimi_k3_prepares_shared_attention_metadata_once(monkeypatch, request):
metadata_ids = []
values_are_contiguous = []
@@ -370,11 +370,13 @@ def test_kimi_k3_prepares_shared_attention_metadata_once(monkeypatch):
values_are_contiguous.append(v.is_contiguous())
return q
monkeypatch.setattr(
kimi_k3_vl,
"get_server_args",
lambda: SimpleNamespace(mm_attention_backend="flashinfer_cudnn"),
# Force the backend through the context, not by patching an import binding:
# production reads the published config bag (get_mm().mm_attention_backend).
override = get_context().override_server_args(
mm_attention_backend="flashinfer_cudnn"
)
override.install()
request.addfinalizer(override.restore)
monkeypatch.setitem(kimi_k3_vl.QKV_BACKEND_IMPL, "flashinfer_cudnn", FakeAttention)
encoder = MoonViT3dEncoder(
@@ -31,6 +31,12 @@ What legitimately remains:
reads ``get_dcp_group()``, and that group is only installed when DCP is on.
- ``cuda_ipc_transport_utils.tp_size`` runs in the tokenizer process, which has
no groups at all (the call site already guards for "not published yet").
- ``dp_attention.attn_cp_size`` / ``moe_dp_size``: the configuration the
predicate detects (``attn_cp_size > moe_dp_size``) is the one where
``initialize_model_parallel`` aliases ``_MOE_DP`` to ``_ATTN_CP``, so the live
sizes are equal there and a live comparison is always false.
- ``model_loader/loader.py`` reports both: the same dict carries the live
``moe_dp_size`` under ``"dp"``, so this entry is the configured intent.
- The alias-form baseline is not zero yet. Lowering it is the next slice; the
failure message lists the sites whenever the count moves.
"""
@@ -67,13 +73,16 @@ _DERIVED_MEMBERS = frozenset(
_CONFIG_INTENT_SIZES = frozenset(
{
("srt/layers/attention/dsa/dsa_indexer.py", "pp_size"),
("srt/layers/dp_attention.py", "attn_cp_size"),
("srt/layers/dp_attention.py", "moe_dp_size"),
("srt/mem_cache/allocation.py", "dcp_size"),
("srt/model_loader/loader.py", "moe_dp_size"),
("srt/utils/cuda_ipc_transport_utils.py", "tp_size"),
}
)
_DIRECT_BASELINE = 0
_ALIAS_BASELINE = 12
_ALIAS_BASELINE = 0
def _is_global_call(node) -> bool: