[Bugfix][KV Offload] Namespace persistent cache by model runner (#49440)
Signed-off-by: Jonguk Cheong <jdal3031@snu.ac.kr> Co-authored-by: Or Ozeri <oro@il.ibm.com>
Jonguk Cheong committed
Jul 26, 2026 at 14:21 UTC
7a29a3c54cc338b0103005978f38764e40299572
2 files changed
+22
-1
tests/v1/kv_offload/test_file_mapper.py
+20
-1
@@ -85,7 +85,7 @@ def test_get_file_name_full_structure():
85
path = fm.get_file_name(key)
86
87
expected_path = (
88
- "/tmp/cache/test-model_42b94bdc9933_r3/000/10_g2/0001020304050607.bin"
88
+ "/tmp/cache/test-model_de3bba26cf36_r3/000/10_g2/0001020304050607.bin"
89
)
90
assert path == expected_path
91
@@ -119,6 +119,7 @@ def test_get_run_config_fields():
119
}
120
],
121
"inference_engine": "vllm",
122
+ "parallel_agnostic": False,
123
}
124
125
@@ -164,6 +165,7 @@ def test_parallel_agnostic_collapses_namespace_when_config_allows():
165
assert fm.fields["pcp_size"] == 1
166
assert fm.fields["dcp_size"] == 1
167
assert fm.rank == 0
168
+ assert "parallel_agnostic" not in fm.fields
169
170
171
def test_parallel_agnostic_ignored_when_config_disallows():
@@ -175,6 +177,7 @@ def test_parallel_agnostic_ignored_when_config_disallows():
177
)
178
assert fm.fields["tp_size"] == 2
179
assert fm.rank == 1
180
+ assert fm.fields["parallel_agnostic"] is False
181
182
183
def test_namespace_kept_without_parallel_agnostic_opt_in():
@@ -186,3 +189,19 @@ def test_namespace_kept_without_parallel_agnostic_opt_in():
189
)
190
assert fm.fields["tp_size"] == 2
191
assert fm.rank == 1
192
+ assert fm.fields["parallel_agnostic"] is False
193
+
194
+
195
+def test_parallel_agnostic_separates_persistent_layouts():
196
+ agnostic = make_mapper_from_offloading_spec(
197
+ is_parallelism_agnostic=True,
198
+ parallel_agnostic=True,
199
+ )
200
+ specific = make_mapper_from_offloading_spec(
201
+ is_parallelism_agnostic=False,
202
+ parallel_agnostic=True,
203
+ )
204
+
205
+ assert agnostic.base_path != specific.base_path
206
+ assert "parallel_agnostic" not in agnostic.fields
207
+ assert specific.fields["parallel_agnostic"] is False
vllm/v1/kv_offload/file_mapper.py
+2
@@ -58,6 +58,8 @@ class FileMapper:
58
"kv_cache_groups": kv_cache_groups or [],
59
"inference_engine": inference_engine,
60
}
61
+ if not parallel_agnostic:
62
+ self.fields["parallel_agnostic"] = False
63
self.base_path: str = self._compute_base_path(root_dir, self.fields)
64
65
@classmethod