vllm.model_executor.layers.quantization.utils.w8a8_utils
CUTLASS_BLOCK_FP8_SUPPORTED
module-attribute
¶
CUTLASS_BLOCK_FP8_SUPPORTED = cutlass_block_fp8_supported()
USE_ROWWISE_TORCH_SCALED_MM
module-attribute
¶
USE_ROWWISE_TORCH_SCALED_MM = (
is_rocm()
and __version__[0:3] >= "2.7"
and has_device_capability(94)
)
Fp8LinearOp
¶
This class executes a FP8 linear layer using cutlass if supported and torch.scaled_mm otherwise. It needs to be a class instead of a method so that config can be read in the init method, as reading config is not allowed inside forward.
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 |
|
output_padding
instance-attribute
¶
__init__
¶
__init__(
cutlass_fp8_supported: bool = cutlass_fp8_supported(),
use_per_token_if_dynamic: bool = False,
pad_output: Optional[bool] = None,
)
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
apply
¶
apply(
input: Tensor,
weight: Tensor,
weight_scale: Tensor,
out_dtype: Optional[dtype] = None,
input_scale: Optional[Tensor] = None,
input_scale_ub: Optional[Tensor] = None,
bias: Optional[Tensor] = None,
use_per_token_if_dynamic: Optional[bool] = None,
) -> Tensor
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
all_close_1d
¶
convert_to_channelwise
¶
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
cutlass_block_fp8_supported
¶
cutlass_block_fp8_supported() -> bool
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
cutlass_fp8_supported
¶
cutlass_fp8_supported() -> bool
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
cutlass_group_gemm_supported
¶
cutlass_group_gemm_supported() -> bool
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
cutlass_w8a8_scaled_mm
¶
cutlass_w8a8_scaled_mm(
*,
qinput: Tensor,
weight: Tensor,
out_dtype: dtype,
scale_a: Tensor,
scale_b: Tensor,
bias: Tensor,
output_shape: list,
**kwargs,
) -> Tensor
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
dispatch_w8a8_scaled_mm
¶
dispatch_w8a8_scaled_mm(
cutlass_fp8_supported: bool,
per_tensor_weights: bool,
per_tensor_activations: bool,
use_per_token_if_dynamic: Optional[bool],
) -> Callable[..., Tensor]
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
maybe_create_device_identity
¶
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
normalize_e4m3fn_to_e4m3fnuz
¶
normalize_e4m3fn_to_e4m3fnuz(
weight: Tensor,
weight_scale: Tensor,
input_scale: Optional[Tensor] = None,
) -> tuple[Tensor, Tensor, Optional[Tensor]]
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
per_tensor_dequantize
¶
requantize_with_max_scale
¶
requantize_with_max_scale(
weight: Tensor,
weight_scale: Tensor,
logical_widths: list[int],
) -> tuple[Tensor, Tensor]
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
rocm_per_tensor_w8a8_scaled_mm
¶
rocm_per_tensor_w8a8_scaled_mm(
*,
qinput: Tensor,
weight: Tensor,
out_dtype: dtype,
scale_a: Tensor,
scale_b: Tensor,
bias: Tensor,
input_2d: Tensor,
output_shape: list,
) -> Tensor
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
sparse_cutlass_supported
¶
sparse_cutlass_supported() -> bool
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
torch_channelwise_w8a8_scaled_mm
¶
torch_channelwise_w8a8_scaled_mm(
*,
qinput: Tensor,
weight: Tensor,
out_dtype: dtype,
scale_a: Tensor,
scale_b: Tensor,
bias: Tensor,
input_2d: Tensor,
output_shape: list,
**kwargs,
) -> Tensor
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
torch_per_tensor_w8a8_scaled_mm
¶
torch_per_tensor_w8a8_scaled_mm(
*,
qinput: Tensor,
weight: Tensor,
out_dtype: dtype,
scale_a: Tensor,
scale_b: Tensor,
bias: Tensor,
input_2d: Tensor,
output_shape: list,
) -> Tensor
Source code in vllm/model_executor/layers/quantization/utils/w8a8_utils.py
torch_per_token_w8a8_scaled_mm
¶
torch_per_token_w8a8_scaled_mm(
*,
qinput: Tensor,
weight: Tensor,
out_dtype: dtype,
scale_a: Tensor,
scale_b: Tensor,
bias: Tensor,
input_2d: Tensor,
output_shape: list,
) -> Tensor