[ROCm][CI] Add GELU activation for AiterExperts in the modular-kernel coverage (#58030)
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
415e11c6f1
commit
d1f63f2af9
@@ -12,6 +12,7 @@ import torch
|
||||
|
||||
import vllm.model_executor.layers.fused_moe.modular_kernel as mk
|
||||
from vllm.config import VllmConfig, set_current_vllm_config
|
||||
from vllm.model_executor.layers.fused_moe.activation import MoEActivation
|
||||
from vllm.platforms import current_platform
|
||||
from vllm.utils.flashinfer import has_flashinfer_cutlass_fused_moe
|
||||
from vllm.utils.import_utils import has_deep_ep, has_deep_gemm
|
||||
@@ -87,6 +88,22 @@ def assert_aiter_quant_scheme_case(config: Config) -> None:
|
||||
print(f"[AITER case] weight_key={w_key}, activation_key={a_key}")
|
||||
|
||||
|
||||
def assert_aiter_activation_case(config: Config) -> None:
|
||||
"""Make the AITER activation this config exercises explicit, instead of
|
||||
AiterExperts being reached only indirectly through the general
|
||||
activation sweep. See https://github.com/vllm-project/vllm/issues/54966."""
|
||||
fe_cls = config.fused_experts_type
|
||||
if getattr(fe_cls, "__name__", "") != "AiterExperts":
|
||||
return
|
||||
|
||||
assert fe_cls._supports_activation(config.activation), (
|
||||
f"AITER case activation={config.activation} reached the "
|
||||
"modular-kernel harness, but AiterExperts._supports_activation "
|
||||
"does not declare it supported."
|
||||
)
|
||||
print(f"[AITER case] activation={config.activation}")
|
||||
|
||||
|
||||
def rank_worker(
|
||||
pgi: ProcessGroupInfo,
|
||||
vllm_config: VllmConfig,
|
||||
@@ -160,6 +177,7 @@ def rank_worker(
|
||||
continue
|
||||
|
||||
assert_aiter_quant_scheme_case(config)
|
||||
assert_aiter_activation_case(config)
|
||||
|
||||
# modular kernel out
|
||||
mk_out = run_modular_kernel(pgi, vllm_config, config, weights, rank_tensors)
|
||||
@@ -225,6 +243,10 @@ Ns = [1024]
|
||||
TOPKs = [4, 1]
|
||||
Es = [32]
|
||||
DTYPEs = [torch.bfloat16]
|
||||
MK_ACTIVATIONS = [
|
||||
MoEActivation.SILU,
|
||||
MoEActivation.GELU,
|
||||
]
|
||||
|
||||
|
||||
def is_nyi_config(config: Config) -> bool:
|
||||
@@ -236,7 +258,14 @@ def is_nyi_config(config: Config) -> bool:
|
||||
unsupported_quant_config = (
|
||||
config.is_per_act_token_quant + config.is_per_out_ch_quant
|
||||
) == 1
|
||||
return unsupported_quant_config
|
||||
if unsupported_quant_config:
|
||||
return True
|
||||
|
||||
if config.activation != MoEActivation.SILU:
|
||||
if getattr(config.fused_experts_type, "__name__", "") != "AiterExperts":
|
||||
return True # AITER-only for this axis, for now
|
||||
if config.quant_dtype is not None:
|
||||
return True # unquantized-only for this axis, for now
|
||||
|
||||
return False
|
||||
|
||||
@@ -247,12 +276,13 @@ def generate_valid_test_cases(
|
||||
cases = []
|
||||
total = 0
|
||||
|
||||
for k, n, e, dtype, quant_config, combination in product(
|
||||
for k, n, e, dtype, quant_config, activation, combination in product(
|
||||
Ks,
|
||||
Ns,
|
||||
Es,
|
||||
DTYPEs,
|
||||
MK_QUANT_CONFIGS,
|
||||
MK_ACTIVATIONS,
|
||||
product(prepare_finalize_types, MK_FUSED_EXPERT_TYPES),
|
||||
):
|
||||
total = total + 1
|
||||
@@ -265,6 +295,7 @@ def generate_valid_test_cases(
|
||||
topks=TOPKs,
|
||||
dtype=dtype,
|
||||
quant_config=quant_config,
|
||||
activation=activation,
|
||||
prepare_finalize_type=combination[0],
|
||||
fused_experts_type=combination[1],
|
||||
world_size=world_size,
|
||||
@@ -292,6 +323,7 @@ def generate_valid_test_cases(
|
||||
e,
|
||||
dtype,
|
||||
quant_config,
|
||||
activation,
|
||||
combination[0],
|
||||
combination[1],
|
||||
world_size,
|
||||
@@ -304,7 +336,8 @@ def generate_valid_test_cases(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"k,n,e,dtype,quant_config,prepare_finalize_type,fused_experts_type,world_size",
|
||||
"k,n,e,dtype,quant_config,activation,"
|
||||
"prepare_finalize_type,fused_experts_type,world_size",
|
||||
generate_valid_test_cases(
|
||||
world_size=2, prepare_finalize_types=MK_MULTI_GPU_PREPARE_FINALIZE_TYPES
|
||||
),
|
||||
@@ -316,6 +349,7 @@ def test_modular_kernel_combinations_multigpu(
|
||||
e: int,
|
||||
dtype: torch.dtype,
|
||||
quant_config: TestMoEQuantConfig | None,
|
||||
activation: MoEActivation,
|
||||
prepare_finalize_type: mk.FusedMoEPrepareAndFinalize,
|
||||
fused_experts_type: mk.FusedMoEExperts,
|
||||
world_size: int,
|
||||
@@ -336,6 +370,7 @@ def test_modular_kernel_combinations_multigpu(
|
||||
topks=TOPKs,
|
||||
dtype=dtype,
|
||||
quant_config=quant_config,
|
||||
activation=activation,
|
||||
prepare_finalize_type=prepare_finalize_type,
|
||||
fused_experts_type=fused_experts_type,
|
||||
world_size=world_size,
|
||||
@@ -345,7 +380,8 @@ def test_modular_kernel_combinations_multigpu(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"k,n,e,dtype,quant_config,prepare_finalize_type,fused_experts_type,world_size",
|
||||
"k,n,e,dtype,quant_config,activation,"
|
||||
"prepare_finalize_type,fused_experts_type,world_size",
|
||||
generate_valid_test_cases(
|
||||
world_size=1, prepare_finalize_types=MK_SINGLE_GPU_PREPARE_FINALIZE_TYPES
|
||||
),
|
||||
@@ -356,6 +392,7 @@ def test_modular_kernel_combinations_singlegpu(
|
||||
e: int,
|
||||
dtype: torch.dtype,
|
||||
quant_config: TestMoEQuantConfig | None,
|
||||
activation: MoEActivation,
|
||||
prepare_finalize_type: mk.FusedMoEPrepareAndFinalize,
|
||||
fused_experts_type: mk.FusedMoEExperts,
|
||||
world_size: int,
|
||||
@@ -372,6 +409,7 @@ def test_modular_kernel_combinations_singlegpu(
|
||||
topks=TOPKs,
|
||||
dtype=dtype,
|
||||
quant_config=quant_config,
|
||||
activation=activation,
|
||||
prepare_finalize_type=prepare_finalize_type,
|
||||
fused_experts_type=fused_experts_type,
|
||||
world_size=world_size,
|
||||
|
||||
Reference in New Issue
Block a user