fix: unreachable error check in retraction (#15433)
Co-authored-by: Liangsheng Yin <lsyincs@gmail.com>
This commit is contained in:
@@ -1746,21 +1746,7 @@ class ScheduleBatch(ScheduleBatchDisaggregationDecodeMixin):
|
||||
)
|
||||
):
|
||||
if len(sorted_indices) == 1:
|
||||
# Corner case: only one request left
|
||||
if self.is_hybrid_swa:
|
||||
full_available_size = (
|
||||
self.token_to_kv_pool_allocator.full_available_size()
|
||||
)
|
||||
swa_available_size = (
|
||||
self.token_to_kv_pool_allocator.swa_available_size()
|
||||
)
|
||||
assert (
|
||||
full_available_size > 0 and swa_available_size > 0
|
||||
), f"No space left for only one request in SWA mode {full_available_size=}, {swa_available_size=}"
|
||||
else:
|
||||
assert (
|
||||
self.token_to_kv_pool_allocator.available_size() > 0
|
||||
), f"No space left for only one request, {self.token_to_kv_pool_allocator.available_size()=}"
|
||||
# Always keep at least one request
|
||||
break
|
||||
|
||||
first_iter = False
|
||||
@@ -1770,11 +1756,13 @@ class ScheduleBatch(ScheduleBatchDisaggregationDecodeMixin):
|
||||
# release memory and don't insert into the tree because we need the space instantly
|
||||
self.release_req(idx, len(sorted_indices), server_args)
|
||||
|
||||
if len(retracted_reqs) == 0:
|
||||
# Corner case: only one request left
|
||||
raise ValueError(
|
||||
"Failed to retract any request. No space left for only one request."
|
||||
)
|
||||
if len(sorted_indices) <= 1 and not self.check_decode_mem(
|
||||
selected_indices=sorted_indices, buf_multiplier=buf_multiplier
|
||||
):
|
||||
# Retracting loops ends and still not enough memory
|
||||
raise ValueError(
|
||||
"Out of memory even after retracting all other requests in the decode batch."
|
||||
)
|
||||
|
||||
self.filter_batch(keep_indices=sorted_indices)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user