Skip to content

vllm.model_executor.kernels.linear.mixed_precision.zentorch

Zentorch int4 weight-quantized linear kernels for AMD Zen CPUs.

Selected by choose_mp_linear_kernel ahead of the generic oneDNN-backed CPUWNA16LinearKernel. When can_implement rejects a layer, the selector falls through to the next kernel in _POSSIBLE_KERNELS[PlatformEnum.CPU].

Classes:

ZentorchWNA16LinearKernel

Bases: CPUWNA16LinearKernel

Int4 kernel backed by zentorch_dynamic_qlinear (DA8W4) or zentorch_woq_linear (W4A16).

Methods:

_maybe_process_da8w4_weights(layer)

Repack layer into the DA8W4 layout, or leave it untouched.

Returns False without mutating the layer when it is not eligible, so the caller falls through to the W4A16 paths.

_zentorch_woq_eligible(layer)

Eligibility predicate for the zentorch W4A16 GPTQ fast path.

Constraints (any failure -> cpu_gemm_wna16 path via super() with layer untouched).

process_weights_after_loading(layer)

Repack CT GPTQ weights into the zentorch DA8W4 or WOQ layout.

Falls back to CPUWNA16LinearKernel.process_weights_after_loading via super() when the layer doesn't satisfy _zentorch_woq_eligible.

On success, layer._zentorch_processed_weights is set to True

_import_unpack_from_int32()

Import compressed-tensors' unpack_from_int32 across versions.

_store_in_param(layer, attr, name)

Back kernel tensor layer.<attr> by the storage of loaded param name.