[HARDWARE][POWER] Enable W8A8 INT8 MoE on POWER (#55316)

Signed-off-by: Rukhaiya <bibirukhaiya123@gmail.com>
Signed-off-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Akash kaothalkar <akash.kaothalkar@ibm.com>
Co-authored-by: Antigravity <antigravity@google.com>
Co-authored-by: Li, Jiang <jiang1.li@intel.com>
This commit is contained in:
Rukhaiya2004
2026-09-17 21:45:13 +08:00
committed by GitHub
co-authored by Akash kaothalkar Antigravity Li, Jiang <jiang1.li@intel.com>
parent 0eae9acd4d
commit 117cf43fb6
8 changed files with 537 additions and 22 deletions
+17 -5
View File
@@ -306,17 +306,28 @@ def test_cpu_fused_moe(
@pytest.mark.skipif(
current_platform.get_cpu_architecture() != CpuArchEnum.ARM,
reason="Requires Arm CPU",
current_platform.get_cpu_architecture()
not in (CpuArchEnum.ARM, CpuArchEnum.POWERPC),
reason="Requires Arm or POWER CPU",
)
@pytest.mark.parametrize("batch_size", BATCH_SIZE)
@pytest.mark.parametrize("expert_num", EXPERT_NUM)
@pytest.mark.parametrize("hidden_size", HIDDEN_DIM)
@pytest.mark.parametrize("intermediate_size", INTERMEDIATE_DIM)
@pytest.mark.parametrize("use_bias", USE_BIAS)
@pytest.mark.parametrize("dtype", [torch.float32, torch.float16, torch.bfloat16])
@pytest.mark.parametrize(
"dtype",
(
[torch.float32, torch.float16, torch.bfloat16]
if current_platform.get_cpu_architecture() == CpuArchEnum.ARM
else [torch.float32, torch.bfloat16]
),
)
@pytest.mark.parametrize("act", ACT)
@pytest.mark.parametrize("isa", ["neon"])
@pytest.mark.parametrize(
"isa",
["neon"] if current_platform.get_cpu_architecture() == CpuArchEnum.ARM else ["vsx"],
)
def test_cpu_fused_moe_int8(
batch_size: int,
expert_num: int,
@@ -386,7 +397,8 @@ def test_cpu_fused_moe_int8(
isa,
)
torch.testing.assert_close(output, ref_output, atol=2e-2, rtol=2e-2)
atol = rtol = 1e-1 if isa == "vsx" else 2e-2
torch.testing.assert_close(output, ref_output, atol=atol, rtol=rtol)
# moe_intermediate_size not a multiple of 32, e.g. what tensor-parallel