Skip to content

FIX: NixlConnector: do not skip short do_remote_prefill requests #18590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions tests/v1/kv_connector/unit/test_nixl_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ def test_prompt_less_than_block_size():
Test that we can handle case where prompt is < block.

In this case, the P worker will send empty remote_block_ids.
The D worker should not schedule an async read in this case,
since there is nothing to pull.
The D worker should not schedule the request but without
any async read (empty local_block_ids) since there is nothing to pull.
Keeping the request int connector metadata is for notifying the
prefill worker so that its remote blocks can be released.
"""
vllm_config = create_vllm_config()
scheduler = create_scheduler(vllm_config)
Expand All @@ -67,7 +69,11 @@ def test_prompt_less_than_block_size():
kv_connector_metadata = scheduler_output.kv_connector_metadata
assert kv_connector_metadata is not None
assert isinstance(kv_connector_metadata, NixlConnectorMetadata)
assert len(kv_connector_metadata.requests) == 0
assert len(kv_connector_metadata.requests) == 1
req_id, meta = next(iter(kv_connector_metadata.requests.items()))
# empty local_block_ids, so that async read will be skipped
assert hasattr(meta, "local_block_ids")
assert not meta.local_block_ids

# This request should be scheduled regularly.
assert len(scheduler_output.scheduled_new_reqs) == 1
assert len(scheduler_output.scheduled_new_reqs) == 1
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,6 @@ def build_connector_meta(
# Loop through scheduled reqs and convert to ReqMeta.
for req_id, (req, block_ids) in self._reqs_need_recv.items():
assert req.kv_transfer_params is not None
# For the case where there are no remote blocks to pull
# (block_ids is empty), we don't need to schedule
# an async read on the worker side.
if not block_ids:
logger.debug(
"Skipping adding request %s to NixlConnectorMetadata, "
"as there are no remote blocks to pull", req_id)
continue

meta.add_new_req(
request_id=req_id,
local_block_ids=block_ids,
Expand Down