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

[habana_main bugfix] Fix min bucket boundary calculation #239

Merged
merged 7 commits into from
Sep 5, 2024
14 changes: 6 additions & 8 deletions vllm/worker/habana_model_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ def warmup_buckets(bs_bucket_config, seq_bucket_config,
return captured_buckets, omitted_buckets


def next_pow2(value: int):
res = 1
def next_pow2(value: int, base: int):
res = base
while value > 1:
value = (value + 1) // 2
res *= 2
Expand All @@ -150,12 +150,10 @@ def round_up(value: int, k: int):


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


def subtuple(obj: object,
Expand Down
Loading