Skip to content
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

Limit decode block size #532

Merged
merged 15 commits into from
Nov 25, 2024
12 changes: 8 additions & 4 deletions vllm/worker/hpu_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,11 @@ def round_up(value: int, k: int):


def find_bucket(value: int, config: Tuple[int, int, int]):
bmin, bstep, _ = config
bmin, bstep, bmax = config
next_step = round_up(value, bstep)
next_pow = next_pow2(value, bmin)
return max(bmin, min(next_step, next_pow))
b = max(bmin, min(next_step, next_pow))
return min(b, bmax)


def align_workers(value, op):
Expand Down Expand Up @@ -808,8 +809,11 @@ def _setup_buckets(self) -> None:
'block',
min=self.block_size,
step=self.block_size,
max=max(self.block_size,
self.max_num_seqs * max_decode_seq // self.block_size))
max=min(max(self.block_size,
self.max_num_seqs * max_decode_seq // self.block_size),
self.cache_config.num_gpu_blocks)
)

mfylcek marked this conversation as resolved.
Show resolved Hide resolved
self.graphed_buckets: Set[Any] = set()

msg = ("Prompt bucket config (min, step, max_warmup) "
Expand Down