Fix int4 MoE tuner config filename (#35260)
Signed-off-by: maithilijoshi20 <maithilij2003@gmail.com>
This commit is contained in:
@@ -321,8 +321,6 @@ def get_config_filename(
|
|||||||
# NOTE(woosuk): The current naming convention uses w2.shape[2], which
|
# NOTE(woosuk): The current naming convention uses w2.shape[2], which
|
||||||
# is the intermediate size after silu_and_mul.
|
# is the intermediate size after silu_and_mul.
|
||||||
N = shard_intermediate_size // 2
|
N = shard_intermediate_size // 2
|
||||||
if use_int4_w4a16:
|
|
||||||
N = N // 2
|
|
||||||
|
|
||||||
filename = get_config_file_name(
|
filename = get_config_file_name(
|
||||||
num_experts,
|
num_experts,
|
||||||
|
|||||||
@@ -281,8 +281,6 @@ class BenchmarkWorker:
|
|||||||
block_n = block_shape[0] if block_shape else 0
|
block_n = block_shape[0] if block_shape else 0
|
||||||
block_k = block_shape[1] if block_shape else 0
|
block_k = block_shape[1] if block_shape else 0
|
||||||
N = shard_intermediate_size // 2
|
N = shard_intermediate_size // 2
|
||||||
if use_int4_w4a16:
|
|
||||||
N = N // 2
|
|
||||||
op_config = get_moe_configs(
|
op_config = get_moe_configs(
|
||||||
num_experts,
|
num_experts,
|
||||||
N,
|
N,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from sglang.test.ci.ci_register import register_cpu_ci
|
from sglang.test.ci.ci_register import register_cpu_ci
|
||||||
@@ -9,6 +10,10 @@ register_cpu_ci(est_time=9, suite="base-a-test-cpu")
|
|||||||
from sglang.srt.layers.moe.moe_runner.triton_utils import fused_moe_triton_config
|
from sglang.srt.layers.moe.moe_runner.triton_utils import fused_moe_triton_config
|
||||||
from sglang.srt.runtime_context import get_context
|
from sglang.srt.runtime_context import get_context
|
||||||
|
|
||||||
|
BENCHMARK_DIR = Path(__file__).parents[5] / "benchmark" / "kernels" / "fused_moe_triton"
|
||||||
|
sys.path.insert(0, str(BENCHMARK_DIR))
|
||||||
|
import common_utils # noqa: E402
|
||||||
|
|
||||||
|
|
||||||
def test_h200_bf16_config_is_available_for_current_triton_runtime():
|
def test_h200_bf16_config_is_available_for_current_triton_runtime():
|
||||||
config_path = (
|
config_path = (
|
||||||
@@ -68,6 +73,30 @@ def test_down_moe_reuses_tuned_up_config_when_separate_config_is_absent(
|
|||||||
fused_moe_triton_config.get_moe_configs.cache_clear()
|
fused_moe_triton_config.get_moe_configs.cache_clear()
|
||||||
|
|
||||||
|
|
||||||
|
def test_int4_tuner_filename_uses_runtime_down_projection_dimension(monkeypatch):
|
||||||
|
monkeypatch.setattr(
|
||||||
|
common_utils,
|
||||||
|
"get_config_file_name",
|
||||||
|
lambda E, N, *_args: f"E={E},N={N}.json",
|
||||||
|
)
|
||||||
|
|
||||||
|
filename = common_utils.get_config_filename(
|
||||||
|
num_experts=256,
|
||||||
|
shard_intermediate_size=512,
|
||||||
|
hidden_size=1024,
|
||||||
|
topk=8,
|
||||||
|
dtype=None,
|
||||||
|
use_fp8_w8a8=False,
|
||||||
|
use_int8_w8a8=False,
|
||||||
|
use_int8_w8a16=False,
|
||||||
|
use_int4_w4a16=True,
|
||||||
|
per_channel_quant=False,
|
||||||
|
block_shape=[128, 128],
|
||||||
|
)
|
||||||
|
|
||||||
|
assert filename == "E=256,N=256.json"
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user