[CPU] Refactor CPU WNA16 (#28826)
Signed-off-by: jiang1.li <jiang1.li@intel.com>
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user