[BugFix] Fix handling of num_computed_tokens with connector #91
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For async loading there are kind of two passes int the scheduler for the request. The first time, the connector methods are called and it goes into
WAITING_FOR_REMOTE_KVSstate.Once the async load is ready, it goes through the "waiting" part of the schedule() method again for that request... previously it was calling the connector methods again when this happened, even though we don't want to do any more since the computation is now done.
This originally wasn't causing a problem because the nixl connector unsets the flag in the transfer params to that it's ignored the second tim.
But in the multi-connector, when get_num_matched_tokens returns 0 from one of the connectors it moves on to the next one ... so in this second pass we were actually triggering the LMCache connector.
So this change makes things more explicit/robust in the scheduler w.r.t. when the connectors are invoked. Similarly it also only calls
update_state_after_alloc if get_num_matched_tokensreturned nonzero.. since in terms of the API contract it doesn't really make sense to invoke the connector after the allocation if it's saying that it is not providing any tokens.Same as upstream PR vllm-project#18232