[BugFix] Fix implicit and incorrect assumption on ECConnector is_producer (#34783)
Signed-off-by: Qi Wang <qiwa@nvidia.com>
This commit is contained in:
@@ -141,8 +141,10 @@ class ECExampleConnector(ECConnectorBase):
|
||||
Update ECConnector state after encoder cache allocation.
|
||||
"""
|
||||
mm_hash = request.mm_features[index].identifier
|
||||
# Only load cache if it is consumer and cache exists
|
||||
if not self.is_consumer or not self.has_cache_item(mm_hash):
|
||||
return
|
||||
num_encoder_token = request.get_num_encoder_embeds(index)
|
||||
# Insert mm_hash only if this block has not been recorded yet.
|
||||
self._mm_datas_need_loads[mm_hash] = num_encoder_token
|
||||
|
||||
def build_connector_meta(
|
||||
|
||||
@@ -515,6 +515,8 @@ class Scheduler(SchedulerInterface):
|
||||
# Allocate the encoder cache.
|
||||
for i in encoder_inputs_to_schedule:
|
||||
self.encoder_cache_manager.allocate(request, i)
|
||||
if self.ec_connector is not None:
|
||||
self.ec_connector.update_state_after_alloc(request, i)
|
||||
encoder_compute_budget = new_encoder_compute_budget
|
||||
if external_load_encoder_input:
|
||||
for i in external_load_encoder_input:
|
||||
@@ -803,6 +805,8 @@ class Scheduler(SchedulerInterface):
|
||||
# Allocate the encoder cache.
|
||||
for i in encoder_inputs_to_schedule:
|
||||
self.encoder_cache_manager.allocate(request, i)
|
||||
if self.ec_connector is not None:
|
||||
self.ec_connector.update_state_after_alloc(request, i)
|
||||
encoder_compute_budget = new_encoder_compute_budget
|
||||
# Allocate for external load encoder cache
|
||||
if external_load_encoder_input:
|
||||
|
||||
@@ -193,9 +193,9 @@ class EngineCore:
|
||||
logger.debug("Batch queue is enabled with size %d", self.batch_queue_size)
|
||||
self.batch_queue = deque(maxlen=self.batch_queue_size)
|
||||
|
||||
self.is_ec_producer = (
|
||||
vllm_config.ec_transfer_config is not None
|
||||
and vllm_config.ec_transfer_config.is_ec_producer
|
||||
self.is_ec_consumer = (
|
||||
vllm_config.ec_transfer_config is None
|
||||
or vllm_config.ec_transfer_config.is_ec_consumer
|
||||
)
|
||||
self.is_pooling_model = vllm_config.model_config.runner_type == "pooling"
|
||||
|
||||
@@ -449,7 +449,7 @@ class EngineCore:
|
||||
exec_future = self.model_executor.execute_model(
|
||||
scheduler_output, non_block=True
|
||||
)
|
||||
if not self.is_ec_producer:
|
||||
if self.is_ec_consumer:
|
||||
model_executed = scheduler_output.total_num_scheduled_tokens > 0
|
||||
|
||||
if self.is_pooling_model or not model_executed:
|
||||
|
||||
@@ -100,7 +100,7 @@ class RayDistributedExecutor(Executor):
|
||||
|
||||
self.uses_sampler = self.vllm_config.model_config.runner_type != "pooling" and (
|
||||
self.vllm_config.ec_transfer_config is None
|
||||
or not self.vllm_config.ec_transfer_config.is_ec_producer
|
||||
or self.vllm_config.ec_transfer_config.is_ec_consumer
|
||||
)
|
||||
|
||||
self.scheduler_output: SchedulerOutput | None = None
|
||||
|
||||
@@ -3409,7 +3409,7 @@ class GPUModelRunner(
|
||||
# Update persistent batch states.
|
||||
self._update_states(scheduler_output)
|
||||
|
||||
if has_ec_transfer() and get_ec_transfer().is_producer:
|
||||
if has_ec_transfer() and not get_ec_transfer().is_consumer:
|
||||
with self.maybe_get_ec_connector_output(
|
||||
scheduler_output,
|
||||
encoder_cache=self.encoder_cache,
|
||||
@@ -6182,7 +6182,7 @@ class GPUModelRunner(
|
||||
KVCacheSpec: A dictionary mapping layer names to their KV cache
|
||||
format. Layers that do not need KV cache are not included.
|
||||
"""
|
||||
if has_ec_transfer() and get_ec_transfer().is_producer:
|
||||
if has_ec_transfer() and not get_ec_transfer().is_consumer:
|
||||
return {}
|
||||
kv_cache_spec: dict[str, KVCacheSpec] = {}
|
||||
layer_type = cast(type[Any], AttentionLayerBase)
|
||||
|
||||
Reference in New Issue
Block a user