[XPU] Add W8A8 FP8 linear kernel with multi-granularity quant support (#43645)
Signed-off-by: Chaojun,Zhang <chaojun.zhang@intel.com> Signed-off-by: Chaojun Zhang <chaojun.zhang@intel.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -13,6 +13,7 @@ from compressed_tensors.quantization import (
|
||||
)
|
||||
from compressed_tensors.transform import TransformConfig
|
||||
|
||||
from vllm.config import get_current_vllm_config_or_none
|
||||
from vllm.distributed import (
|
||||
get_tensor_model_parallel_rank,
|
||||
get_tensor_model_parallel_world_size,
|
||||
@@ -747,9 +748,18 @@ class CompressedTensorsConfig(QuantizationConfig):
|
||||
act_quant_format = is_activation_quantization_format(format)
|
||||
if act_quant_format:
|
||||
if self._is_fp8_w8a8(weight_quant, input_quant):
|
||||
is_fp8_w8a8_supported = self._check_scheme_supported(
|
||||
CompressedTensorsW8A8Fp8.get_min_capability(), error=False
|
||||
)
|
||||
if current_platform.is_xpu():
|
||||
# On XPU, --linear-backend xpu opts into W8A8 FP8
|
||||
# linear kernel; otherwise default to W8A16.
|
||||
config = get_current_vllm_config_or_none()
|
||||
is_fp8_w8a8_supported = (
|
||||
config is not None
|
||||
and config.kernel_config.linear_backend == "xpu"
|
||||
)
|
||||
else:
|
||||
is_fp8_w8a8_supported = self._check_scheme_supported(
|
||||
CompressedTensorsW8A8Fp8.get_min_capability(), error=False
|
||||
)
|
||||
if is_fp8_w8a8_supported:
|
||||
return CompressedTensorsW8A8Fp8(
|
||||
weight_quant=weight_quant,
|
||||
|
||||
Reference in New Issue
Block a user