[diffusion] platform: support WAN/FLUX/Qwen-Image/Qwen-Image-edit on Ascend (#13662)

Co-authored-by: dhx98 <haox.dai@gmail.com>
Co-authored-by: DHX98 <haoxiand@andrew.cmu.edu>
Co-authored-by: ronnie_zheng <zl19940307@163.com>
Co-authored-by: DHX98 <DHX98@noreply.gitcode.com>
Co-authored-by: Yuhao Yang <47235274+yhyang201@users.noreply.github.com>
This commit is contained in:
Makcum888e
2026-02-08 10:45:30 +08:00
committed by GitHub
co-authored by dhx98 DHX98 ronnie_zheng DHX98 Yuhao Yang
parent 7b83659310
commit 00248d85c7
25 changed files with 476 additions and 30 deletions
@@ -38,6 +38,15 @@ SUITES = {
],
}
suites_ascend = {
"1-npu": [
"ascend/test_server_1_npu.py",
# add new 1-npu test files here
]
}
SUITES.update(suites_ascend)
def parse_args():
parser = argparse.ArgumentParser(description="Run multimodal_gen test suite")
@@ -0,0 +1,76 @@
{
"metadata": {
"model": "Diffusion Server",
"hardware": "CI A2 64GB pool",
"description": "Reference numbers captured from the CI diffusion server baseline run"
},
"scenarios": {
"wan2_1_t2v_1.3b_1_npu": {
"stages_ms": {
"InputValidationStage": 0.1,
"TextEncodingStage": 1609.27,
"ConditioningStage": 0.02,
"TimestepPreparationStage": 3.46,
"LatentPreparationStage": 0.39,
"DenoisingStage": 26324.0,
"DecodingStage": 817.68,
"per_frame_generation": null
},
"denoise_step_ms": {
"0": 195.27,
"1": 329.05,
"2": 545.43,
"3": 541.3,
"4": 537.07,
"5": 537.21,
"6": 537.19,
"7": 537.19,
"8": 537.27,
"9": 537.05,
"10": 537.02,
"11": 537.11,
"12": 537.42,
"13": 537.2,
"14": 537.16,
"15": 537.11,
"16": 537.14,
"17": 537.19,
"18": 537.1,
"19": 537.0,
"20": 537.26,
"21": 537.18,
"22": 537.16,
"23": 537.24,
"24": 537.15,
"25": 537.14,
"26": 536.99,
"27": 537.19,
"28": 537.22,
"29": 537.23,
"30": 537.06,
"31": 537.06,
"32": 537.18,
"33": 537.07,
"34": 537.19,
"35": 537.28,
"36": 537.17,
"37": 537.38,
"38": 537.31,
"39": 537.25,
"40": 537.28,
"41": 537.26,
"42": 537.1,
"43": 537.19,
"44": 537.19,
"45": 537.31,
"46": 537.19,
"47": 537.16,
"48": 537.23,
"49": 532.91
},
"expected_e2e_ms": 28769.9,
"expected_avg_denoise_ms": 526.34,
"expected_median_denoise_ms": 537.19
}
}
}
@@ -0,0 +1,29 @@
"""
Config-driven diffusion performance test with pytest parametrization.
If the actual run is significantly better than the baseline, the improved cases with their updated baseline will be printed
"""
from __future__ import annotations
import pytest
from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger
from sglang.multimodal_gen.test.server.ascend.testcase_configs_npu import ONE_NPU_CASES
from sglang.multimodal_gen.test.server.test_server_common import ( # noqa: F401
DiffusionServerBase,
diffusion_server,
)
from sglang.multimodal_gen.test.server.testcase_configs import DiffusionTestCase
logger = init_logger(__name__)
class TestDiffusionServerOneNpu(DiffusionServerBase):
"""Performance tests for 1-NPU diffusion cases."""
@pytest.fixture(params=ONE_NPU_CASES, ids=lambda c: c.id)
def case(self, request) -> DiffusionTestCase:
"""Provide a DiffusionTestCase for each 1-NPU test."""
return request.param
@@ -0,0 +1,22 @@
from sglang.multimodal_gen.test.server.testcase_configs import (
T2V_PROMPT,
DiffusionSamplingParams,
DiffusionServerArgs,
DiffusionTestCase,
)
ONE_NPU_CASES: list[DiffusionTestCase] = [
# === Text to Video (T2V) ===
DiffusionTestCase(
"wan2_1_t2v_1.3b_1_npu",
DiffusionServerArgs(
model_path="/root/.cache/modelscope/hub/models/Wan-AI/Wan2.1-T2V-1.3B-Diffusers",
modality="video",
warmup=0,
custom_validator="video",
),
DiffusionSamplingParams(
prompt=T2V_PROMPT,
),
),
]
@@ -132,6 +132,24 @@ class BaselineConfig:
),
)
def update(self, path: Path):
"""Load baseline configuration from JSON file."""
with path.open("r", encoding="utf-8") as fh:
data = json.load(fh)
scenarios_new = {}
for name, cfg in data["scenarios"].items():
scenarios_new[name] = ScenarioConfig(
stages_ms=cfg["stages_ms"],
denoise_step_ms={int(k): v for k, v in cfg["denoise_step_ms"].items()},
expected_e2e_ms=float(cfg["expected_e2e_ms"]),
expected_avg_denoise_ms=float(cfg["expected_avg_denoise_ms"]),
expected_median_denoise_ms=float(cfg["expected_median_denoise_ms"]),
)
self.scenarios.update(scenarios_new)
return self
@dataclass(frozen=True)
class DiffusionServerArgs:
@@ -729,4 +747,6 @@ TWO_GPU_CASES_B = [
]
# Load global configuration
BASELINE_CONFIG = BaselineConfig.load(Path(__file__).with_name("perf_baselines.json"))
BASELINE_CONFIG = BaselineConfig.load(
Path(__file__).with_name("perf_baselines.json")
).update(Path(__file__).parent / "ascend" / "perf_baselines_npu.json")