|
| 1 | +# Contributing to SGLang Diffusion |
| 2 | + |
| 3 | +This guide outlines the requirements for contributing to the SGLang Diffusion module (`sglang.multimodal_gen`). |
| 4 | + |
| 5 | +## 1. Commit Message Convention |
| 6 | + |
| 7 | +We follow a structured commit message format to maintain a clean history. |
| 8 | + |
| 9 | +**Format:** |
| 10 | +```text |
| 11 | +[diffusion] <scope>: <subject> |
| 12 | +``` |
| 13 | + |
| 14 | +**Examples:** |
| 15 | +- `[diffusion] cli: add --perf-dump-path argument` |
| 16 | +- `[diffusion] scheduler: fix deadlock in batch processing` |
| 17 | +- `[diffusion] model: support Stable Diffusion 3.5` |
| 18 | + |
| 19 | +**Rules:** |
| 20 | +- **Prefix**: Always start with `[diffusion]`. |
| 21 | +- **Scope** (Optional): `cli`, `scheduler`, `model`, `pipeline`, `docs`, etc. |
| 22 | +- **Subject**: Imperative mood, short and clear (e.g., "add feature" not "added feature"). |
| 23 | + |
| 24 | +## 2. Performance Reporting |
| 25 | + |
| 26 | +For PRs that impact **latency**, **throughput**, or **memory usage**, you **should** provide a performance comparison report. |
| 27 | + |
| 28 | +### How to Generate a Report |
| 29 | + |
| 30 | +1. **Baseline**: run the benchmark (for a single generation task) |
| 31 | + ```bash |
| 32 | + sglang generate --model-path <model> --prompt "A benchmark prompt" --perf-dump-path baseline.json |
| 33 | + ``` |
| 34 | + |
| 35 | +2. **New**: run the same benchmark, without modifying any server_args or sampling_params |
| 36 | + ```bash |
| 37 | + sglang generate --model-path <model> --prompt "A benchmark prompt" --perf-dump-path new.json |
| 38 | + ``` |
| 39 | + |
| 40 | +3. **Compare**: generate the Markdown table. |
| 41 | + ```bash |
| 42 | + python python/sglang/multimodal_gen/benchmarks/compare_perf.py baseline.json new.json |
| 43 | + ``` |
| 44 | + |
| 45 | +4. **Paste**: Copy the output Markdown table into your PR description. |
| 46 | + |
| 47 | +### Example PR Description |
| 48 | + |
| 49 | +```markdown |
| 50 | +### Motivation |
| 51 | +Optimize the VAE decode stage by removing redundant GPU syncs |
| 52 | +
|
| 53 | +
|
| 54 | +### Performance Impact |
| 55 | +${your_generated_report} |
| 56 | +``` |
0 commit comments