Prhub

#22086 [diffusion] CI: improve diffusion comparison benchmark setting for realistic perf and auto-discover ut

原始 PR 作者 mickqian 合并时间 2026-04-04 23:20 文件变更 10 提交数 22 评论 4 代码增减 +278 / -110

执行摘要

改进扩散模型基准测试设置,提升性能真实性并自动发现单元测试。

PR body 指出:'With only 2 steps, denoising appeared faster than encoding (distorted), and the dual-DiT second model (boundary_ratio=0.875) barely got exercised',因此需要增加步数以获得真实性能。同时,为了提升 CI 稳定性,强制使用 --strict-ports 避免端口误路由。

建议工程师重点关注 server_args.py 的端口逻辑变更和 comparison_configs.json 的 benchmark 设置,以了解 CI 改进细节;对于性能优化,可参考 LTX-2 benchmark 的配置选择。

讨论亮点

由于 review 评论为空,主要讨论体现在提交历史中。例如,在提交 'c84f085' 中,通过基准测试对比了 LTX-2 模型的不同配置(torch.compile + ulysses vs CFG parallel),最终选择了 CFG parallel 以提升性能。

实现拆解

关键改动包括:

1) 修改 scripts/ci/utils/diffusion/comparison_configs.json,将 Wan2.2 用例的 num_inference_steps 从 2 增加到 20,移除不必要的参数覆盖,并添加 LTX-2 TwoStage 基准测试用例;
2) 重构 python/sglang/multimodal_gen/runtime/server_args.py,提取 _require_port 方法,解决 master_port 为 None 时的问题,并设置固定默认值;
3) 修改 python/sglang/multimodal_gen/test/run_suite.py,实现自动发现单元测试文件,替代硬编码列表;
4) 其他改进如修复模型检测逻辑、优化 dashboard 生成等。

文件 模块 状态 重要度
scripts/ci/utils/diffusion/comparison_configs.json CI/benchmark modified 8.0
python/sglang/multimodal_gen/runtime/server_args.py runtime modified 7.0
python/sglang/multimodal_gen/test/run_suite.py test modified 6.0
python/sglang/cli/utils.py cli modified 5.0
scripts/ci/utils/diffusion/generate_diffusion_dashboard.py CI/dashboard modified 6.0

关键符号

_require_port _discover_unit_tests get_is_diffusion_model generate_dashboard

分析完成后,这里会展示 LLM 生成的相对完整源码片段和详细注释。

评论区精华

LTX-2 benchmark 配置优化 性能

在提交历史中,通过基准测试对比了 torch.compile + ulysses 与 CFG parallel 配置,发现 CFG parallel 性能更优。

结论:采用 --enable-cfg-parallel 作为 LTX-2 benchmark 的优化配置。 · 已解决

风险与影响

技术风险包括:

1) server_args.py 中端口逻辑重构可能导致在严格端口模式下服务器启动失败,特别是 master_port 默认值处理;
2) comparison_configs.json 的变更可能影响现有基准测试结果的比较,需要确保新设置与模型默认值一致;
3) 自动发现单元测试可能引入未预期的测试文件,影响测试套件的稳定性。

对用户无直接影响;对系统:提升 CI 稳定性和基准测试的真实性,便于性能回归检测;对团队:简化测试维护,减少手动配置错误。影响范围限于 CI 流程和测试套件。

端口逻辑变更风险 基准测试配置影响 测试自动发现不确定性

关联 Issue

未识别关联 Issue

当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。

完整报告

参与讨论