Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
6326c57
update CODEOWNERS
mickqian Sep 2, 2026
6e44bb2
Add native Qwen Image 2.1 pipeline and model components
mickqian Sep 14, 2026
7d34fef
Wire request-scoped prefix caching and regression coverage
mickqian Sep 14, 2026
fb1cf29
Align image normalization and default VAE execution
mickqian Sep 14, 2026
12de37f
Enable Qwen Image 2.1 breakable graph routing
mickqian Sep 14, 2026
4d4c965
Prioritize native cache adapters and test request cache isolation
mickqian Sep 14, 2026
35f00a9
Initialize tiny test weights and cover cache family collision
mickqian Sep 14, 2026
6471ec6
Document private Qwen Image 2.1 integration and validation scope
mickqian Sep 14, 2026
1dc8ebd
fix(diffusion): preserve Qwen Image 2.1 RGBA conditioning
mickqian Sep 15, 2026
128cfb9
fix(diffusion): match Qwen Image 2.1 pre-norm text conditioning
mickqian Sep 16, 2026
88ce69b
test(diffusion): guard Qwen Image 2.1 conditioning semantics
mickqian Sep 16, 2026
cfa9711
fix(diffusion): preserve BF16 QK normalization order
mickqian Sep 16, 2026
be49463
fix(diffusion): use SRT normalization for Qwen Image QK
mickqian Sep 16, 2026
55edb20
fix(diffusion): disable implicit Qwen Image VAE tiling
mickqian Sep 16, 2026
558e54d
fix(diffusion): match reference image conditioning precision
mickqian Sep 16, 2026
1fa43d6
fix(diffusion): apply VAE tiling consistently to conditioning
mickqian Sep 16, 2026
5956bbe
docs(diffusion): record verified native deployment and conditioning b…
mickqian Sep 16, 2026
128ae46
docs(diffusion): expand image command picker and RGBA recipes
mickqian Sep 16, 2026
7a3e546
docs(diffusion): add measured platform deployment recipes
mickqian Sep 16, 2026
f09b21f
fix(diffusion): wire native encoder sharding and distributed decode
mickqian Sep 17, 2026
a69b81b
fix(diffusion): load image conditioning VAE on encoder workers
mickqian Sep 17, 2026
f1cd651
perf(diffusion): skip unused cached-prefix modulation
mickqian Sep 17, 2026
5d2ad81
fix(diffusion): transfer CPU and empty conditioning tensors
mickqian Sep 17, 2026
bc8bdf3
test(diffusion): match encoder loader context in distributed checks
mickqian Sep 17, 2026
a8b7fb5
fix(diffusion): cover remaining encoder and VAE offload blocks
mickqian Sep 17, 2026
d629d23
test(diffusion): verify spatial decode geometry in double precision
mickqian Sep 17, 2026
76c619e
fix(diffusion): map component-prefixed image adapters
mickqian Sep 17, 2026
b5c71a9
test(diffusion): cover full checkpoint requests and adapter lifecycle
mickqian Sep 17, 2026
f849da6
test(diffusion): isolate adapter lifecycle server configuration
mickqian Sep 17, 2026
6b19008
test(diffusion): check explicit model aliases in server cases
mickqian Sep 17, 2026
cfe1a66
docs(diffusion): document distributed validation and precision options
mickqian Sep 17, 2026
63ed20b
perf(diffusion): fuse complex rotary embedding with exact rounding
mickqian Sep 17, 2026
f874eae
docs(diffusion): record exact rotary fusion measurements
mickqian Sep 17, 2026
ee9fcc4
perf(diffusion): reuse exact SwiGLU and residual fusions for native i…
mickqian Sep 17, 2026
a3d1453
test(diffusion): construct independent parallel model fixtures
mickqian Sep 17, 2026
5a117c9
docs(diffusion): record exact pointwise fusion measurements
mickqian Sep 17, 2026
6ee35b5
docs: document serialized component validation and commands
mickqian Sep 17, 2026
f1f3366
fix: preserve vision rotary numerics across device offload
mickqian Sep 17, 2026
81c8c55
fix: retain encoder weight dtypes during component offload
mickqian Sep 17, 2026
f5353f0
test: isolate encoder offload device context
mickqian Sep 17, 2026
7e0d4e9
docs: record encoder offload precision validation
mickqian Sep 17, 2026
57b625d
docs: validate packed component loading and picker options
mickqian Sep 17, 2026
4e5459e
docs: validate fp4 components and correct device fallbacks
mickqian Sep 17, 2026
d9e1e5d
perf: fuse qk norm pointwise operations without changing reduction
mickqian Sep 17, 2026
de03af3
docs: record exact QK norm performance and narrow PR scope
mickqian Sep 17, 2026
45a1182
Merge upstream main and retain native model integration
mickqian Sep 17, 2026
5bddbfc
test: add executable entry points for diffusion kernel CI
mickqian Sep 17, 2026
162181f
perf: fuse scale-only LayerNorm modulation for Qwen Image 2.1
mickqian Sep 17, 2026
3c004dc
docs: record LayerNorm gains and edit cache boundaries
mickqian Sep 17, 2026
c2a31b2
fix: align Qwen Image 2.1 conditioning and VAE with training
mickqian Sep 18, 2026
86b1f4e
fix: detect complex RoPE rounding on the running CUDA build
mickqian Sep 18, 2026
d0c1ed3
test: register Qwen Image 2.1 TP2 end-to-end coverage
mickqian Sep 18, 2026
a1524eb
test: isolate tiled VAE roundtrip and document corrected conditioning
mickqian Sep 18, 2026
fd930cf
fix: preserve VAE double precision and describe TP2 E2E coverage
mickqian Sep 18, 2026
de4182b
test: pin Qwen Image 2.1 TP2 image consistency reference
mickqian Sep 18, 2026
35de142
fix: preserve reference VAE input strides for image editing
mickqian Sep 18, 2026
b257ddb
Merge main and adopt consolidated kernel test paths
mickqian Sep 18, 2026
1eab5de
test: budget Qwen Image 2.1 TP2 in CI shard scheduling
mickqian Sep 18, 2026
ebaf57f
docs: verify Qwen Image 2.1 on RTX PRO 6000 and preserve picker links
mickqian Sep 18, 2026
6078c90
test: temporarily disable Qwen Image 2.1 TP2 CI case
mickqian Sep 18, 2026
9e988f4
fix(diffusion): scope vision RoPE device refresh to Qwen Image 2.1
mickqian Sep 19, 2026
2d7c536
test(diffusion): cover Qwen vision RoPE through component offload
mickqian Sep 19, 2026
1643376
Merge main and fix logits processor formatting
mickqian Sep 19, 2026
6daab4d
test: migrate fusion group mocks to runtime context
mickqian Sep 19, 2026
ec987b5
test: provide SWA pool in Q8KV8 sparse-prefill fixture
mickqian Sep 19, 2026
253a2d1
Merge main and align CI fixtures with upstream repairs
mickqian Sep 19, 2026
c6d01b6
[diffusion] Fuse Qwen-Image 2.1 DiT and VAE kernels
BBuf Sep 19, 2026
b94203f
[diffusion] Remove redundant Qwen-Image 2.1 norm/RoPE staging
BBuf Sep 19, 2026
0ed2c06
Merge pull request #13 from BBuf/codex/qwen-image21-kernel-optimizations
mickqian Sep 19, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
547 changes: 547 additions & 0 deletions docs/cookbook/diffusion/Qwen-Image/Qwen-Image-2.1.mdx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/cookbook/diffusion/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Image models generate one image request as a bounded denoising job, usually with
<Card
title="Qwen-Image"
mode="card"
href="/cookbook/diffusion/Qwen-Image/Qwen-Image"
href="/cookbook/diffusion/Qwen-Image/Qwen-Image-2.1"
img="/cards/logos/qwen.png"
/>
<Card
Expand Down
1 change: 1 addition & 0 deletions docs/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,7 @@
{
"group": "Qwen-Image",
"pages": [
"cookbook/diffusion/Qwen-Image/Qwen-Image-2.1",
"cookbook/diffusion/Qwen-Image/Qwen-Image",
"cookbook/diffusion/Qwen-Image/Qwen-Image-Edit"
]
Expand Down
116 changes: 116 additions & 0 deletions docs/docs/sglang-diffusion/compatibility_matrix.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,122 @@ description: "Browse model families and public checkpoints supported by SGLang D

import { DiffusionModelCatalog } from '/src/snippets/diffusion/model-catalog.jsx';

## Qwen-Image 2.1 integration status

Qwen-Image 2.1 has a separate native pipeline for text-to-image and optional
reference-image conditioning. Full-checkpoint validation on H200 includes
1024×1024, 40-step generation and editing. Reference comparisons use
Transformers 4.57.3, BF16 and matching Torch SDPA settings with cuDNN SDPA
disabled. The native encoder explicitly preserves that version's pre-final-norm
hidden state and vision position interpolation semantics.

Full-checkpoint functional checks on up to two H200 GPUs cover DiT TP, Ulysses,
Ring + FA, CFG parallel, DiT layerwise offload, FA/Sage, parallel
tiled VAE decode, Cache-DiT, breakable CUDA graphs, and multiple reference
images and outputs. One H200 with resident weights also passed HTTP generation
and editing, including multiple outputs and reference images. These are
functional checks, not a broad quality evaluation of lossy optimizations.

Additional full-checkpoint checks on B200 cover native encoder TP, combined
TP2 × Ulysses2 and TP2 × Ring2 + FA on four GPUs, and
`--layerwise-offload-components all`. Two-GPU VAE `spatial_shard` decode passed
with TP2, CFG parallelism, and all-component offload. These use 512px/4-step
editing, plus a 1024px/4-step comparison of spatial and full VAE decode.
Single-GPU 1024px/40-step generation, editing, and transparent PNG output also
passed at source revision `d629d234f1`.

Two-B200 component regressions assert actual encoder weight sharding and compare
text and image conditioning with a single-rank reference. VAE regressions cover
both decoder structures and even/odd latent heights in FP32 and FP64. FP64
spatial decode matches the full decoder; BF16 full-checkpoint output is not
bit-exact. In the tested image, spatial versus full decode gave RGBA PSNR
60.69 dB; this is one sample, not a general quality guarantee.

Request-local prefix KV reuse and new-request graph replay have CUDA regression
tests. The deployment picker marks only its exact tested HTTP combinations as
verified, including H200, B200, RTX PRO 6000 96GB, RTX 5090, and RTX 4090.
CLI-only combinations remain Unverified in the picker.

On `1eab5de5990`, one RTX PRO 6000 Blackwell Server Edition passed repeated
1024px/40-step HTTP generation, editing, transparent generation, and transparent
input editing with resident weights or DiT layerwise offload and Torch SDPA.
Repeated requests and corresponding outputs across placements matched RGBA
pixels; transparent outputs retained alpha from 0 to 255. Its SM120
RoPE, normalization, fusion-gate, and model regressions also passed. This check
does not establish multi-GPU or quantized-checkpoint coverage on that platform.

Disaggregated encoder, denoiser, and decoder roles passed full-checkpoint HTTP
generation, variable-length prompts, image editing, and CFG on three B200 GPUs,
using Mooncake's same-host TCP transport. At 512px/4 steps, their RGBA pixels
matched the monolithic server exactly. Multi-host RDMA and multi-rank roles
are not covered by that check.

Online FP8 for the DiT, encoder, and both together passed 1024px/40-step HTTP
generation and editing on one B200; both together also passed transparent PNG
generation. Serialized E4M3FN FP8 component folders with scalar weight scales
and dynamic activations passed generation, editing, and transparent output for
each component and both together. The combined export also passed separate
checks with TP2 plus encoder folding and with single-GPU all-component
layerwise offload. The 476 loaded quantized matrices and
scales matched their checkpoint values. Quantization and TP change numerical
results. Revision `f1f3366c7c` fixes vision rotary initialization rounding during
CPU/GPU transfer. In 1024px/40-step B200 checks, all-component layerwise offload
matched resident generation, editing, and transparent RGBA pixels exactly
for both native precision and the combined serialized export. Revision
`81c8c550fa` additionally preserves FP8 weights and FP32 buffers during
whole-encoder CPU offload; separate checks of that mode also matched resident
pixels. Resident output was unchanged by these fixes. See the cookbook for
sample quality metrics.

Native-name Q4_0 GGUF files passed 1024px/40-step B200 HTTP generation,
editing, and transparent output for DiT-only, encoder-only, and both together.
The 476 packed matrices matched their exported bytes. The combined export also
passed TP2 with encoder folding; separate all-component layerwise and
whole-encoder CPU offload checks matched resident RGBA pixels exactly.
Quantization and TP change output pixels, including alpha. These checks cover
the documented private exports, not arbitrary community checkpoints. Other
GGUF types and hardware remain unverified for this model.

Calibrated ModelOpt-format NVFP4 component directories also passed the same
six-configuration B200 HTTP matrix: each component, both together, two offload
modes, and TP2 with encoder folding. All 476 packed matrices and their scales
matched the exports after runtime layout transforms. Both offload modes
matched resident RGBA pixels exactly. NVFP4 and TP2 change image and alpha
values; this private export uses max calibration on only six requests, without
SVDQuant or AWQ. See the cookbook for measured errors. Native FP4 requires
Blackwell, and this model's NVFP4 exports remain unverified on RTX PRO 6000 and
RTX 5090.

Synthetic Diffusers-format LoRA passed dynamic loading, merging,
and removal on one B200 and TP2 with encoder folding; both removal paths
restored the base image exactly. Trained-adapter quality remains unverified.
Platform latency measurements
and their exact workloads are in the cookbook. Breakable graphs
replay only matching warmup signatures, including condition-prefix length;
other shapes run eagerly. VAE tiling is opt-in and can change numerical results.
Do not infer compatibility from the older Qwen-Image row.

Use an authorized local checkpoint with `--model-id Qwen-Image-2.1`.
See the [Qwen-Image 2.1 cookbook](/cookbook/diffusion/Qwen-Image/Qwen-Image-2.1)
for checkpoint layout and usage. This entry does not assert public weight
availability. The standard two-GPU E2E suite includes `qwen_image21_t2i_tp2`
with TP2, 1024px/40-step generation, two requests, and image consistency checks.
Its runners need access to `Qwen/Qwen-Image-2.1`.

The additional opt-in HTTP cases check repeated generation, editing, and real
RGBA alpha output from a local checkpoint:

```bash
export SGLANG_QWEN_IMAGE21_TEST_MODEL=/models/Qwen-Image-2.1
export SGLANG_QWEN_IMAGE21_TEST_IMAGE=/path/to/reference.png
python -m pytest -q python/sglang/multimodal_gen/test/server/test_server_qwen_image21.py
```

The module skips without the model variable; only editing skips when the image
variable is absent. Credentials stay in the runner environment.

## Supported model inventory

Use a listed checkpoint as `--model-path` with `sglang generate` or
`sglang serve`. This registry-backed list contains known public entry points;
family detection may also support compatible local directories. Open the linked
Expand Down
27 changes: 22 additions & 5 deletions docs/docs/sglang-diffusion/quantization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,14 @@ sglang generate \
--save-output
```

Qwen-Image 2.1 also supports independent NVFP4 DiT and native language-encoder
component directories through `--component-paths.transformer` and
`--component-paths.text_encoder`. Private max-calibrated exports passed B200
generation, editing, transparent RGBA, offload, and TP2 checks. These checks
do not cover arbitrary exports or RTX 5090. See its
[cookbook](/cookbook/diffusion/Qwen-Image/Qwen-Image-2.1#nvfp4-components) for
calibration scope and image/alpha error measurements.

### Notes

- Use `--transformer-path` for mixed ModelOpt NVFP4 transformer repos or local
Expand All @@ -784,8 +792,9 @@ sglang generate \
primary `--transformer-path` override targets only `transformer`. Use a
per-component override such as `--transformer-2-path` only when you
intentionally want a non-default `transformer_2`.
- On Blackwell, the diffusion ModelOpt NVFP4 path defaults to FlashInfer
TensorRT-LLM FP4 GEMM (`flashinfer_trtllm`).
- On B200, the diffusion ModelOpt NVFP4 path defaults to FlashInfer
TensorRT-LLM FP4 GEMM (`flashinfer_trtllm`). On SM120, including RTX 5090,
the default is `auto`; TensorRT-LLM FP4 GEMM does not support that architecture.
- The published Qwen Image NVFP4 exports keep the `img_mod`/`txt_mod`
modulation projections and first/last transformer blocks in BF16.
- Qwen-Image NVFP4 does not always improve latency at 1024x1024. On B200, the
Expand Down Expand Up @@ -916,13 +925,21 @@ startup rejects a degree that cuts a row-parallel matrix inside a GGML block.
| MiniMax-H3 `fl2va`, pruned AdaLN curve | [`unsloth/MiniMax-H3-GGUF`](https://huggingface.co/unsloth/MiniMax-H3-GGUF) `minimax_h3_fl2va_pruned-Q4_K.gguf` (10.7 GiB loaded DiT) | 1x H200 (141 GiB) | 2-step t2va 1344x768, 107 frames, H.264 + AAC |
| MiniMax-H3 `fl2va`, pruned AdaLN curve | `minimax_h3_fl2va_pruned-Q4_K.gguf` | 1x GB300 (CUDA 13, PyTorch 2.13) | 50-step t2va 1344x768, 107 frames, H.264 + AAC; 105.38 s and 80.88 GB peak |
| MiniMax-H3 `fl2va`, pruned AdaLN curve | `minimax_h3_fl2va_pruned-Q4_K.gguf` | 2x GB300, TP2 (CUDA 13, PyTorch 2.13) | 2-step t2va 1344x768, 107 frames, H.264 + AAC; 7.55 s and 51.90 GB peak per rank |
| Qwen-Image 2.1 | Private native-name Q4_0 exports; DiT 3.91 GiB, encoder 7.03 GiB | 1x B200; separate TP2 check | 1024px/40-step generation, editing, and transparent RGBA; each component and both together; combined offload matched resident pixels |

The DiT loads at 17.5 GiB against 61.7 GiB for the BF16 checkpoint. Weight
The unpruned MiniMax-H3 DiT loads at 17.5 GiB against 61.7 GiB for the BF16 checkpoint. Weight
fidelity was checked tensor-by-tensor against the BF16 reference: cosine
1.00000 for the F32/BF16 tensors and 0.9973 for Q4_K/Q4_0.

Not validated in the measurements above: any other quantization type, the
`ref2va` partition, and a BF16-vs-GGUF output comparison.
The MiniMax-H3 measurements do not validate other quantization types, the
`ref2va` partition, or a BF16-vs-GGUF output comparison.

Qwen-Image 2.1's Q4_0 exports use the base component configs and native tensor
names. Its [cookbook](/cookbook/diffusion/Qwen-Image/Qwen-Image-2.1#gguf-components)
documents the tested matrix selection, offload modes, TP2, and image/alpha
differences against native precision. These private exports establish loading
and execution compatibility, not general output quality or compatibility with
other GGUF exports.

## Nunchaku (SVDQuant)

Expand Down
5 changes: 4 additions & 1 deletion docs/src/snippets/_deployment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,7 @@ export const Deployment = ({ config, benchmarks }) => {
};

const [sel, setSel] = useState(() => initialSelectionFromCells());
const [selectionHydrated, setSelectionHydrated] = useState(false);
const INTERNAL_HASH_STATE_KEY = "__sglangDeployInternalHash";
const DEPLOYMENT_COMPONENT_ID = "deployment-configurator";
useEffect(() => {
Expand Down Expand Up @@ -1310,12 +1311,14 @@ export const Deployment = ({ config, benchmarks }) => {
if (el) el.scrollIntoView({ behavior: "smooth", block: "start" });
};
hydrate();
setSelectionHydrated(true);
window.addEventListener("hashchange", hydrate);
return () => window.removeEventListener("hashchange", hydrate);
}, []);
// history.replaceState does NOT fire hashchange — dispatch a custom event so
// the Playground hears chip-click selection changes.
useEffect(() => {
if (!selectionHydrated) return;
const target = "#" + new URLSearchParams(sel).toString();
if (window.location.hash !== target) {
const historyState =
Expand All @@ -1329,7 +1332,7 @@ export const Deployment = ({ config, benchmarks }) => {
);
}
window.dispatchEvent(new CustomEvent("sglang-deploy-sel", { detail: sel }));
}, [sel]);
}, [sel, selectionHydrated]);

const [modal, setModal] = useState(null); // 'curl' | 'env' | 'bench' | null
useEffect(() => {
Expand Down
Loading
Loading