Skip to content

vllm.utils.math_utils

Math utility functions for vLLM.

Functions:

cdiv(a, b)

Ceiling division.

largest_power_of_2_divisor(n)

Return the largest power-of-2 that divides n (isolate lowest set bit).

next_power_of_2(n)

The next power of 2 (inclusive).

prev_power_of_2(n)

The previous power of 2 (inclusive).

round_down(x, y)

Round down x to the nearest multiple of y.

round_up(x, y)

Round up x to the nearest multiple of y.

round_up_to(values, n)

Round n up to the smallest member of sorted values >= n, or None.