[CPU] Refactor CPU WNA16 (#28826)

Signed-off-by: jiang1.li <jiang1.li@intel.com>
This commit is contained in:
Li, Jiang
2025-11-19 10:32:00 +08:00
committed by GitHub
parent 40b6b38f2c
commit 20852c8f4c
22 changed files with 1656 additions and 78 deletions
+25
View File
@@ -2702,6 +2702,31 @@ def cpu_attention_with_kv_cache(
)
def cpu_gemm_wna16(
input: torch.Tensor,
q_weight: torch.Tensor,
scales: torch.Tensor,
zeros: torch.Tensor | None,
g_idx: torch.Tensor | None,
bias: torch.Tensor | None,
pack_factor: int,
isa_hint: str,
) -> torch.Tensor:
output = torch.empty((input.size(0), scales.size(1)), dtype=input.dtype)
torch.ops._C.cpu_gemm_wna16(
input,
q_weight,
output,
scales,
zeros,
g_idx,
bias,
pack_factor,
isa_hint,
)
return output
if hasattr(torch.ops._qutlass_C, "matmul_mxf4_bf16_tn"):
@register_fake("_qutlass_C::matmul_mxf4_bf16_tn")