[Test] Enable KV cache events for HMA models in CPU offloading test (#47754)
Signed-off-by: Itay Etelis <92247226+Etelis@users.noreply.github.com> Co-authored-by: Or Ozeri <oro@il.ibm.com>
This commit is contained in:
@@ -251,23 +251,19 @@ def test_cpu_offloading(
|
|||||||
kv_connector_extra_config=extra_config,
|
kv_connector_extra_config=extra_config,
|
||||||
)
|
)
|
||||||
|
|
||||||
# KV events are incompatible with HMA (setting kv_events_config
|
|
||||||
# would force HMA off), so only enable them for non-HMA models.
|
|
||||||
subscriber: MockSubscriber | None = None
|
subscriber: MockSubscriber | None = None
|
||||||
kv_events_config: KVEventsConfig | None = None
|
port: int
|
||||||
if not uses_hma:
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||||
port: int
|
s.bind(("0.0.0.0", 0))
|
||||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
port = s.getsockname()[1]
|
||||||
s.bind(("0.0.0.0", 0))
|
|
||||||
port = s.getsockname()[1]
|
|
||||||
|
|
||||||
events_endpoint = f"tcp://*:{port}"
|
events_endpoint = f"tcp://*:{port}"
|
||||||
kv_events_config = KVEventsConfig(
|
kv_events_config = KVEventsConfig(
|
||||||
enable_kv_cache_events=True,
|
enable_kv_cache_events=True,
|
||||||
publisher="zmq",
|
publisher="zmq",
|
||||||
endpoint=events_endpoint,
|
endpoint=events_endpoint,
|
||||||
topic="test",
|
topic="test",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Attention-free / hybrid models disable prefix caching by default
|
# Attention-free / hybrid models disable prefix caching by default
|
||||||
# (ModelConfig.is_prefix_caching_supported returns False). Without it,
|
# (ModelConfig.is_prefix_caching_supported returns False). Without it,
|
||||||
@@ -289,9 +285,8 @@ def test_cpu_offloading(
|
|||||||
**({"max_num_seqs": 1} if current_platform.is_rocm() else {}),
|
**({"max_num_seqs": 1} if current_platform.is_rocm() else {}),
|
||||||
)
|
)
|
||||||
|
|
||||||
if kv_events_config is not None:
|
events_endpoint = events_endpoint.replace("*", "127.0.0.1")
|
||||||
events_endpoint = events_endpoint.replace("*", "127.0.0.1")
|
subscriber = MockSubscriber(events_endpoint, topic=kv_events_config.topic)
|
||||||
subscriber = MockSubscriber(events_endpoint, topic=kv_events_config.topic)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_latency_test(llm, subscriber)
|
_latency_test(llm, subscriber)
|
||||||
|
|||||||
Reference in New Issue
Block a user