Skip to content

Fp8 cleanup #4

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions vllm/model_executor/layers/quantization/utils/w8a8_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,28 @@
out_dtype = input.dtype

# cutlass_scaled_mm supports per tensor/channel W and per tensor/token A
input_scale = torch.tensor([1.0], dtype=torch.float32, device=input_2d.device)
qinput, x_scale = input_2d, input_scale
if self.cutlass_fp8_supported and input.dtype != current_platform.fp8_dtype():

Check failure on line 347 in vllm/model_executor/layers/quantization/utils/w8a8_utils.py

View workflow job for this annotation

GitHub Actions / pre-commit

Ruff (E501)

vllm/model_executor/layers/quantization/utils/w8a8_utils.py:347:81: E501 Line too long (84 > 80)
assert input.dtype != current_platform.fp8_dtype(
), "FP8 input to cutlass is not currently implemented"
qinput, x_scale = ops.scaled_fp8_quant(
input_2d,
input_scale,
scale_ub=input_scale_ub,
use_per_token_if_dynamic=use_per_token_if_dynamic)
else:
if input.dtype != current_platform.fp8_dtype():
# Maybe apply padding to output, see comment in __init__
qinput, x_scale = ops.scaled_fp8_quant(
input_2d,
input_scale,
num_token_padding=self.output_padding,
use_per_token_if_dynamic=use_per_token_if_dynamic)
else:
if x_scale is not None:
qinput, x_scale = input_2d, input_scale
else:
qinput = input_2d
x_scale = torch.tensor([1.0], dtype=torch.float32, device=input_2d.device)

per_tensor_weights = (weight_scale.numel() == 1)
per_tensor_activations = (x_scale.numel() == 1)
Expand Down
Loading