Enable KV offloading for multi-node agentic sweeps / 为多节点 Agentic 扫描启用 KV 卸载#2141
Conversation
|
Claude finished @cquil11's task in 3m 32s —— View job Review: LGTM — no blocking issues found
The KV-offload propagation is correct and symmetric across the full-sweep and test-config paths: Note: I couldn't execute the test suite in this environment (pytest not in allowed tools), but CI and the PR description report all 96 matrix-logic tests passing, including the new |
| spec_decoding = bmk.get(Fields.SPEC_DECODING.value, "none") | ||
| kv_offloading = "none" | ||
| kv_offload_backend = None | ||
| kv_offloading = bmk.get(Fields.KV_OFFLOADING.value, "none") |
There was a problem hiding this comment.
📊 Line Count Report
- Total Lines: 1259
- Base Lines: 1239
- Change: 📈 +20 lines
There was a problem hiding this comment.
LGTM — focused change with good regression coverage; the inline nit is trivial to work around.
Extended reasoning...
Overview
This PR fixes a silent-dropping behavior in the multi-node agentic matrix generator: previously, both generate_full_sweep and generate_test_config_sweep hardcoded kv-offloading: 'none' and discarded any backend, even when the YAML search-space set kv-offloading: dram + kv-offload-backend: hicache. The change reads those fields from bmk, propagates them into the emitted multi-node agentic entries, appends an offload-name suffix only for non-none runs (preserving historical exp-names), widens the MultiNodeAgenticMatrixEntry schema to accept dram and kv-offload-backend, and reuses the existing _validate_kv_offload_fields pair-check. A focused regression test verifies dram + hicache round-trips through generate_test_config_sweep.
Security risks
None — the change is limited to matrix-configuration schema/validation and generator plumbing. No auth, crypto, permissions, or external input surface is touched.
Level of scrutiny
Low. This is shared benchmark-matrix infrastructure (offline config generation for CI sweeps), not production-critical serving code. The change is small, mechanical (single field pair passed through instead of hardcoded), and mirrors the equivalent single-node path that already existed. Behavior for existing kv-offloading: none recipes is preserved by the conditional suffix and the None-guarded backend emission.
Other factors
- Test coverage: new
test_multinode_agentic_preserves_kv_offload_fieldsexercises the exact new capability (dram+hicache, exp-name suffix, backend propagation), and the existing 96-test suite reportedly passes. - The one bug finding surfaced by the hunting system is a nit about
AgenticCodingConfig.validate_dram_offload_capacityrequiringdram-utilizationfor multi-node entries that don't actually consume it. The workaround (add any value in(0, 1]) is trivial and produces functionally correct output, and the finder itself flagged it as nit and suggested it could be addressed in the follow-up DSV4-MI355X recipe PR. - Change is intentionally decoupled from the DeepSeek-V4 MI355X recipe PR, keeping blast radius small.
| decode: WorkerConfig | ||
| conc: list[int] | ||
| kv_offloading: Literal["none"] = Field(alias=Fields.KV_OFFLOADING.value) | ||
| kv_offloading: Literal["none", "dram"] = Field(alias=Fields.KV_OFFLOADING.value) |
There was a problem hiding this comment.
🟡 Multi-node agentic configs with kv-offloading: dram + kv-offload-backend: hicache (the exact capability this PR enables) are rejected by AgenticCodingConfig.validate_dram_offload_capacity in utils/matrix_logic/validation.py unless the user also sets dram-utilization, but dram-utilization is unused for multi-node entries (both generate_full_sweep and generate_test_config_sweep hardcode total_cpu_dram_gb=0 for multi-node, so agentic_dram_offload_gb — the only consumer of dram-utilization — is never invoked). Users adopting this PR's new feature will hit ValueError: kv-offloading='dram' requires dram-utilization with runner hardware metadata at master-config validation and must add a bogus dram-utilization value that has no effect. Fix: in validate_dram_offload_capacity, gate the dram_utilization requirement on single-node entries only (e.g. skip entries where entry.tp is None).
Extended reasoning...
What the bug is
AgenticCodingConfig.validate_dram_offload_capacity in utils/matrix_logic/validation.py requires dram-utilization to be set whenever any search-space entry has kv-offloading: 'dram', regardless of whether the entry is single-node or multi-node. But for multi-node entries, dram-utilization is completely unused — it never affects the generated matrix.
Why the field is unused for multi-node
The only consumer of dram-utilization is agentic_dram_offload_gb in generate_sweep_configs.py. Both generate_full_sweep and generate_test_config_sweep hardcode:
total_cpu_dram_gb = (
0
if is_multinode
else agentic_dram_offload_gb(agentic_config, bmk, runner, runner_data)
)So for multi-node, agentic_dram_offload_gb is never called, dram-utilization is never read, and total-cpu-dram-gb is not part of MultiNodeAgenticMatrixEntry at all.
Why the PR's regression test doesn't catch it
The new test test_multinode_agentic_preserves_kv_offload_fields calls generate_test_config_sweep directly with a Python dict, bypassing load_config_files / validate_master_config entirely, so the config never sees the AgenticCodingConfig model.
Step-by-step proof
- Author writes a real YAML config using the capability the PR is introducing:
dsv4-agentic-hicache:
image: sglang-rocm
model: deepseek-ai/DeepSeek-V4-Pro
model-prefix: dsv4
precision: fp4
framework: sglang-disagg
runner: cluster:mi355x-amds
multinode: true
disagg: true
scenarios:
agentic-coding:
- search-space:
- conc-list: [16]
kv-offloading: dram
kv-offload-backend: hicache
prefill: { num-worker: 1, tp: 8, ep: 1, dp-attn: false }
decode: { num-worker: 1, tp: 8, ep: 1, dp-attn: false }-
load_config_filescallsvalidate_master_config, which instantiatesMultiNodeMasterConfigEntry→MultiNodeScenarios→AgenticCodingConfig. -
In
AgenticCodingConfig.validate_dram_offload_capacity(validation.py ~lines 700–720), the entry haskv_offloading == 'dram'andself.dram_utilization is None→ raisesValueError('kv-offloading="dram" requires dram-utilization with runner hardware metadata'). -
Author adds
dram-utilization: 0.80to make validation pass. The value flows throughAgenticCodingConfigand reachesgenerate_full_sweep/generate_test_config_sweep, but because the entry is multi-node,agentic_dram_offload_gbis skipped andtotal_cpu_dram_gbis hardcoded to 0. The bogus value has no effect on the generated matrix.
Impact
Real bug on the primary code path this PR is meant to unlock, but the workaround (add any value in (0, 1]) is trivial and produces functionally correct output. Marking as nit so the author can decide whether to fix here or in the follow-up DSV4-MI355X recipe PR.
Suggested fix
In AgenticCodingConfig.validate_dram_offload_capacity, gate the dram_utilization requirement on single-node entries only. AgenticCodingSearchSpaceEntry already distinguishes them: single-node has tp set, multi-node has prefill/decode:
for entry in self.search_space:
if entry.kv_offloading != "dram":
continue
if entry.tp is None: # multi-node — dram-utilization is unused
continue
if self.dram_utilization is None:
raise ValueError(...)
Summary
Enable multi-node agentic sweep entries to preserve
kv-offloadingandkv-offload-backendfrom their benchmark search-space configuration instead of always forcingkv-offloading: none.This PR is intentionally limited to the shared matrix infrastructure:
none;dramin the multi-node Agentic matrix schema and apply the existing KV-offload field-pair validation;dram+hicachepropagation.Motivation
The original AgentX multi-node generator explicitly disabled KV offloading even when the YAML search-space supplied
kv-offloading: dramandkv-offload-backend: hicache. As a result, multi-node disaggregated Agentic recipes could declare host KV offloading but the generated matrix silently replaced it withnoneand discarded the backend.This separates that general capability from the DeepSeek-V4 MI355X recipe PR.
Validation
PYTHONPATH=. pytest -q utils/matrix_logic/test_generate_sweep_configs.py— 96 passedpython -m py_compile utils/matrix_logic/generate_sweep_configs.py utils/matrix_logic/validation.pygit diff --check中文说明
本 PR 为多节点 Agentic 扫描补充通用的 KV 卸载配置透传能力。此前,多节点 Agentic 矩阵生成逻辑会无条件写入
kv-offloading: none,即使 YAML 搜索空间已经配置了kv-offloading: dram和kv-offload-backend: hicache,生成结果仍会静默丢弃这些配置。本 PR 的范围严格限定在共享矩阵基础设施:
none配置的历史命名不变;dram,并复用现有的 KV 卸载字段配对校验;dram+hicache透传行为的回归测试。这样可以把通用的多节点 Agentic KV 卸载能力与 DeepSeek-V4 MI355X 配方 PR 分离开来。
验证结果:矩阵逻辑测试 96 项全部通过,相关 Python 文件编译检查和
git diff --check均通过。