Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
ch-wan
left a comment
There was a problem hiding this comment.
Summary
This PR cleanly finishes the direct get_server_args().<field> burndown inside srt/: bag migrations use the right namespaces (exec.kernel.attention_backend, serving.skip_tokenizer_init, model.load_format), DSA’s pp_size correctly moves to live get_parallel() (already paired with get_pp_group()), and the multimodal base_gpu_id / rl_on_policy_target fix to self.server_args is the right multi-Engine / per-worker shape. The processor device unit test actually fails on a last-publish-wins regression, and the allocation test correctly publishes real config instead of monkeypatching get_server_args. Dominant residual risk is the new ratchet’s narrow AST shape: it pins only bare get_server_args().attr, so intermediate rebinding (and a few pre-existing config-intent size reads written that way) can still grow without tripping CI.
Issue counts by severity
- bugs: 0
- suggestions: 1
- nits: 1
Issues outside the diff
These findings reference lines that are not present in the diff and could not be posted as inline comments:
- [suggestion] test/registered/unit/test_global_config_read_ratchet.py:462 -- The ratchet only matches
get_server_args().<attr>when the call is a bareast.Name(value.func.id == "get_server_args"). Process-global field reads still exist via intermediate rebinding and are invisible to the pin, e.g.server_args = get_server_args(); … server_args.speculative_algorithminspec_utils.py, and the config-intenttp_sizeread inmm_utils._acknowledge_deferred_cuda_ipc_cache_hits(server_args = get_server_args()thengetattr(server_args, "tp_size", …)). The same shape also escapes if written asruntime_context.get_server_args().field. Baseline_BASELINE = 0therefore overstates “zero field reads”: it is zero for one syntactic form, while config-intent size exemptions only list the two direct sites (allocation.dcp_size,cuda_ipc.tp_size) and not the intermediatemm_utilstp_sizesibling. A future “simple” reintroduction of a field read viasa = get_server_args(); sa.foowould pass CI.- Suggestion: Either (a) expand the walk to treat
Name = get_server_args()then laterName.attras a field read (with the same derived/config-intent exemptions, and addmm_utilstp_sizeto_CONFIG_INTENT_SIZES), and/or (b) document in the module docstring that only the direct call form is ratcheted and that intermediate rebinding is an intentional remaining escape that code review must catch. Prefer (a) if the goal is a real zero pin.
- Suggestion: Either (a) expand the walk to treat
- [nit] test/registered/unit/test_global_config_read_ratchet.py:425 -- The scan root is
sglang/srtonly. That matches the burndown surface of this PR, but a package-wideget_server_args().<field>still remains outside it (e.g.python/sglang/kernels/ops/layernorm/mhc.pyreadschunked_prefill_size). Not a regression in the migrated sites; just a scope gap relative to the “last process-global config field reads” framing.- Suggestion: Either extend the walk to
sglang(or at leastsglang/kernels) once ready, or note the srt-only scope explicitly next to_SRT_ROOTso the next burndown PR knows what is still open.
- Suggestion: Either extend the walk to
45d8dd6 to
67e501a
Compare
|
Round 2 — you and @chatgpt-codex-connector are both right, and this one was my misjudgement: fixed in I flipped Reverted to |
Summary
Testing
|
Re-review (Round 2 —
|
67e501a to
0eda345
Compare
0eda345 to
3b73eff
Compare
3b73eff to
b11f075
Compare
b11f075 to
ca946e9
Compare
ca946e9 to
f006f8a
Compare
f006f8a to
8b9dde9
Compare
8b9dde9 to
3e23b41
Compare
|
Review-round fixes pushed ( The body claimed a The exemption rationale was wrong, though not for the reason given. The review argues the PP group must exist because
Also from the review: |
`get_server_args().<field>` reads one process's startup record. Nine sites still did that for a value that has a namespace: the attention backend (5), `skip_tokenizer_init` (2), the draft-aware `load_format`, and a chunked-prefill size in `sglang.kernels`. They now read `get_exec().kernel` / `get_serving()` / `get_model()` / `get_schedule()`, so they see the resolved value including post-publish overrides. The multimodal processor's device selection moves to the instance it was constructed with rather than to a namespace: `base_gpu_id` differs per worker (the encode-server DP workers each specialise their own copy), so no process-global value can stand in for it, and engines sharing a tokenizer process each need their own. Branch order, the NPU preprocess patches, and the case that leaves "device" unset are unchanged. What stays on `get_server_args()` is the derived API — `@property` and method members computed from several fields plus the HF config (`mamba_cache_chunk_size`, `get_model_config()`, `enable_mamba_extra_buffer*`) — plus three config-intent reads of live-shadowed sizes, each of which needs an answer the live topology property cannot give (the DSA indexer's PP gate must short-circuit before touching the PP group, `allocation`'s DCP gate asks whether DCP was configured at all, and the CUDA-IPC recycler runs where no group exists). A new AST ratchet pins both shapes it can see — the direct call and an alias bound from it in the same function — at 0 and 12 respectively, exempting the derived APIs and those three sites by name. The alias-form baseline is not zero: those reads are mostly per-runner fields in model code, and lowering them is the next slice. Two fixtures stopped faking config: `test_dllm_fdfo_kv_reuse` rebound `allocation.get_server_args` to a SimpleNamespace, which silently stops intercepting the moment a reader migrates; it publishes a real config instead.
3e23b41 to
006d669
Compare
|
Closing unmerged and reopening against GitHub classifies a chained-base series as a stack, and in that mode it refuses base retargeting ( The replacement PR carries the identical commit; the review history, the six rounds of comment triage and the validation notes stay here for reference. Link posted below. |
|
Reopened as #33338 (base |
What
get_server_args().<field>reads the startup record of one process. Twenty-six ofthose reads were left in
srt; this removes every one that has somewhere better togo, and pins the rest.
Nine reads move to the namespace accessors — the value they want is the resolved
one, including post-publish overrides:
attention_backend×5 →get_exec().kernel,skip_tokenizer_init×2 →get_serving(), the draft-awareload_format→get_model(), and a PP size →get_parallel()(live topology, whichis what the DSA indexer wants).
Two reads move to the instance instead of a namespace. The multimodal processor
picked its fast-image-processor device from the process-global config, but
base_gpu_iddiffers per worker — the encode-server DP workers each specialise theirown copy — so no process-global value can stand in for it, and several
Engines canshare a tokenizer process. The decision moves into
BaseMultimodalProcessor._fast_image_processor_device, reading the instance theprocessor was constructed with, like the ten other config reads in that class. Branch
order, the NPU preprocess patches and the case that leaves
deviceunset areunchanged.
What stays is the derived API:
mamba_cache_chunk_size(@property),get_model_config(),enable_mamba_extra_buffer{,_lazy}()— computed from severalfields plus the HF config, so they are not namespace leaves and
ServerArgsis theironly home. Two config-intent reads of live-shadowed sizes also stay:
get_parallel()shadows
tp/pp/dcp/attn_cp/moe_dp_sizewith the live topology, and both sites runwhere no process group exists (
cuda_ipc_transport_utilseven guards for "notpublished yet").
A new AST ratchet pins field reads at zero and exempts the above by name, with the
reasoning in its docstring.
Test changes
test_dllm_fdfo_kv_reusereboundallocation.get_server_argsto aSimpleNamespace. That kind of stand-in stops intercepting the moment a readermigrates — which is exactly what happened here — so it publishes a real config now.
New
test_processor_device_selection.pypins the per-instance device resolutionagainst a conflicting published config.
Validation
Per-area unit suites (
mem_cache,multimodal,batch_overlap,layers/attention,managers) and all ratchets pass. Full registered CPU battery(16 partitions) against
main: seven branch-only failures, each re-run serially andgreen — two were port collisions from the parallel run itself, the rest are the
box's standing environment failures. No new failures.
Not covered locally: the flipped reads sit in model and attention paths that need a
GPU to execute; the flips are value-preserving (the bags are projected from the same
published config), but the speculative and model CI suites are the real check.
CI States
Latest PR Test (Base): ❌ Run #30771346854
Latest PR Test (Extra): ❌ Run #30781140569