[Quantization] Honor --linear-backend for ModelOpt W4A16 (#50273)
Signed-off-by: Netanel Haber <58652339+netanel-haber@users.noreply.github.com> Co-authored-by: OpenAI Codex <noreply@openai.com>
This commit is contained in:
co-authored by
OpenAI Codex
parent
c27b080d26
commit
70bd10930b
@@ -891,6 +891,7 @@ def init_nvfp4_linear_kernel(use_a16: bool = False) -> NvFp4LinearKernel:
|
||||
"""Select and instantiate the best NVFP4 linear kernel for the
|
||||
current platform."""
|
||||
config = NvFp4LinearLayerConfig()
|
||||
a16_kernels = (MarlinNvFp4LinearKernel, HummingNvFp4LinearKernel)
|
||||
|
||||
# VLLM_BATCH_INVARIANT forces deterministic execution. Prefer the
|
||||
# batch-invariant CUTLASS implementation when available, otherwise fall
|
||||
@@ -931,6 +932,8 @@ def init_nvfp4_linear_kernel(use_a16: bool = False) -> NvFp4LinearKernel:
|
||||
force_kernel = MarlinNvFp4LinearKernel
|
||||
|
||||
if force_kernel is not None:
|
||||
if use_a16 and force_kernel not in a16_kernels:
|
||||
raise ValueError(f"{force_kernel.__name__} does not support W4A16")
|
||||
is_supported, reason = force_kernel.is_supported()
|
||||
if not is_supported:
|
||||
raise ValueError(
|
||||
@@ -943,6 +946,8 @@ def init_nvfp4_linear_kernel(use_a16: bool = False) -> NvFp4LinearKernel:
|
||||
# Auto-select from registry (or --linear-backend filtered).
|
||||
platform = current_platform._enum
|
||||
possible = list(_POSSIBLE_NVFP4_KERNELS.get(platform, []))
|
||||
if use_a16:
|
||||
possible = [kernel for kernel in possible if kernel in a16_kernels]
|
||||
|
||||
# Apply --linear-backend filtering when set.
|
||||
if linear_backend != "auto":
|
||||
|
||||
Reference in New Issue
Block a user