[ROCm][CI] Enable AITER FP8/unquantized cases in modular-kernel sweep + fix MoRI per-tensor FP8 dispatch (#57074)
Signed-off-by: Divakar Verma <divakar.verma@amd.com> Co-authored-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
co-authored by
Andreas Karatzas
parent
a615f53364
commit
95f4925c3a
@@ -37,6 +37,7 @@ from .modular_kernel_tools.parallel_utils import (
|
||||
ProcessGroupInfo,
|
||||
parallel_launch_with_config,
|
||||
)
|
||||
from .utils import check_accuracy
|
||||
|
||||
has_any_multi_gpu_package = (
|
||||
has_deep_ep() or has_deep_gemm() or has_flashinfer_cutlass_fused_moe()
|
||||
@@ -47,12 +48,6 @@ meets_multi_gpu_requirements = pytest.mark.skipif(
|
||||
reason="Requires deep_ep or deep_gemm or flashinfer packages",
|
||||
)
|
||||
|
||||
if current_platform.is_fp8_fnuz():
|
||||
pytest.skip(
|
||||
"Tests in this file require float8_e4m3fn and platform does not support",
|
||||
allow_module_level=True,
|
||||
)
|
||||
|
||||
|
||||
def format_result(verbose, msg, ex=None):
|
||||
if ex is not None:
|
||||
@@ -70,6 +65,28 @@ def format_result(verbose, msg, ex=None):
|
||||
print(".", end="")
|
||||
|
||||
|
||||
def assert_aiter_quant_scheme_case(config: Config) -> None:
|
||||
"""Make the AITER (weight_quant_key, activation_quant_key) pair this
|
||||
config exercises explicit, instead of AiterExperts being reached only
|
||||
indirectly through the general quant-config sweep.
|
||||
See https://github.com/vllm-project/vllm/issues/54966."""
|
||||
fe_cls = config.fused_experts_type
|
||||
if getattr(fe_cls, "__name__", "") != "AiterExperts":
|
||||
return
|
||||
|
||||
if config.quant_config is None:
|
||||
w_key, a_key = None, None
|
||||
else:
|
||||
w_key, a_key = config.fp8_quant_key_pair()
|
||||
|
||||
assert fe_cls._supports_quant_scheme(w_key, a_key), (
|
||||
f"AITER case (weight_key={w_key}, activation_key={a_key}) reached "
|
||||
"the modular-kernel harness, but AiterExperts._supports_quant_scheme "
|
||||
"does not declare it supported."
|
||||
)
|
||||
print(f"[AITER case] weight_key={w_key}, activation_key={a_key}")
|
||||
|
||||
|
||||
def rank_worker(
|
||||
pgi: ProcessGroupInfo,
|
||||
vllm_config: VllmConfig,
|
||||
@@ -125,6 +142,25 @@ def rank_worker(
|
||||
count -= 1
|
||||
continue
|
||||
|
||||
# Skip unsupported: AITER x DeepEP-HT/Mori dispatch crashes
|
||||
# with an illegal memory access at world_size>1 on gfx942.
|
||||
# https://github.com/vllm-project/vllm/issues/57029
|
||||
if (
|
||||
config.world_size > 1
|
||||
and getattr(config.fused_experts_type, "__name__", "") == "AiterExperts"
|
||||
and getattr(config.prepare_finalize_type, "__name__", "")
|
||||
in ("DeepEPHTPrepareAndFinalize", "MoriPrepareAndFinalize")
|
||||
):
|
||||
print(
|
||||
f"Skipping[{pgi.rank}]: m={m}, topk={topk}"
|
||||
" (AITER x DeepEP-HT/Mori illegal memory access,"
|
||||
" https://github.com/vllm-project/vllm/issues/57029)"
|
||||
)
|
||||
count -= 1
|
||||
continue
|
||||
|
||||
assert_aiter_quant_scheme_case(config)
|
||||
|
||||
# modular kernel out
|
||||
mk_out = run_modular_kernel(pgi, vllm_config, config, weights, rank_tensors)
|
||||
|
||||
@@ -152,32 +188,7 @@ def rank_worker(
|
||||
and config.quant_config is not None
|
||||
)
|
||||
if is_aiter_fp8:
|
||||
diff = (ref_out - mk_out).abs()
|
||||
n_total = diff.numel()
|
||||
max_diff = diff.max().item()
|
||||
n_exceed = int((diff > atol).sum().item())
|
||||
pct_exceed = n_exceed / n_total * 100
|
||||
# FP8 hw matmul vs f32 reference: up to ~4% of
|
||||
# elements may exceed base tolerance, but max
|
||||
# error should stay within 3x base tolerance.
|
||||
max_pct_allowed = 5.0
|
||||
relaxed_atol = atol * 4
|
||||
print(
|
||||
f"[AITER FP8 precision] "
|
||||
f"max_diff={max_diff:.6f}, "
|
||||
f"exceed_atol={n_exceed}/{n_total} "
|
||||
f"({pct_exceed:.4f}%), "
|
||||
f"max_pct_allowed={max_pct_allowed}%, "
|
||||
f"relaxed_limit={relaxed_atol}"
|
||||
)
|
||||
assert pct_exceed <= max_pct_allowed, (
|
||||
f"AITER FP8: {pct_exceed:.2f}% elements exceed "
|
||||
f"atol={atol} (max allowed {max_pct_allowed}%)"
|
||||
)
|
||||
assert max_diff <= relaxed_atol, (
|
||||
f"AITER FP8: max_diff={max_diff:.6f} exceeds "
|
||||
f"relaxed limit {relaxed_atol}"
|
||||
)
|
||||
check_accuracy(ref_out, mk_out, atol=atol, rtol=rtol, percent=0.9)
|
||||
else:
|
||||
torch.testing.assert_close(ref_out, mk_out, atol=atol, rtol=rtol)
|
||||
format_result(verbose, config.describe())
|
||||
|
||||
Reference in New Issue
Block a user