-
Notifications
You must be signed in to change notification settings - Fork 743
[Scheduler] Increase sleep interval in fetch loops and cancel schedule threashold for prefill instance #7871
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
base: release/2.6
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -248,10 +248,10 @@ def _fetch_loop(self, fetch_fn, thread_idx: int): | |
| with self._pause_cond: | ||
| self._pause_cond.wait_for(lambda: not self.is_paused) | ||
| fetch_fn() | ||
| time.sleep(0.002) | ||
| time.sleep(0.02) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ 疑问 PR 标题称 "reduce sleep time in loops",但此处 sleep 从 同样地,
|
||
| except Exception as e: | ||
| self.llm_logger.error(f"fetching request error in worker-{thread_idx}: {e} {traceback.format_exc()}") | ||
| time.sleep(0.002) | ||
| time.sleep(0.02) | ||
|
|
||
| def _prepare_request_v1(self): | ||
| """Prepare request and send to the queue for scheduling""" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -245,7 +245,7 @@ def get_new_block_nums(self, request: Request, num_new_tokens: int): | |
| block_num = ( | ||
| request.num_computed_tokens + num_new_tokens + self.config.cache_config.block_size - 1 | ||
| ) // self.config.cache_config.block_size - len(request.block_tables) | ||
|
|
||
| block_num = max(block_num, 0) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 建议 当 截断逻辑本身正确,但建议补充 warning 日志,便于排查潜在的 block 过度分配根因: if block_num < 0:
self.llm_logger.warning(
f"block_num negative ({block_num}) for req {request.request_id}, "
f"num_computed={request.num_computed_tokens}, num_new={num_new_tokens}, "
f"allocated={len(request.block_tables)}, clamping to 0"
)
block_num = max(block_num, 0) |
||
| if self.config.speculative_config.method is not None: | ||
| block_num = min(block_num + 1, self.config.cache_config.max_block_num_per_seq) | ||
| else: | ||
|
|
@@ -1001,7 +1001,13 @@ def _allocate_decode_and_extend(): | |
| req_index += 1 | ||
| continue | ||
| num_new_block = self.get_new_block_nums(request, num_new_tokens) | ||
| can_schedule_block_num_threshold = self._get_can_schedule_prefill_threshold_block(num_new_block) | ||
| if self.config.scheduler_config.splitwise_role == "prefill": | ||
| # for prefill instance, do not set threshold for running requests | ||
| can_schedule_block_num_threshold = 0 | ||
| else: | ||
| can_schedule_block_num_threshold = self._get_can_schedule_prefill_threshold_block( | ||
| num_new_block | ||
| ) | ||
| # Allocate blocks to prefill | ||
| if self.cache_manager.can_allocate_gpu_blocks(can_schedule_block_num_threshold): | ||
| request.block_tables.extend( | ||
|
|
||
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.