{"slug": "fast-image-generation-and-editing-with-sglang-diffusion-on-amd-gpus", "title": "Fast Image Generation and Editing with SGLang Diffusion on AMD GPUs", "summary": "AMD GPUs running SGLang Diffusion on ROCm achieve 1.5x to 6.3x speedups over Hugging Face Diffusers for image generation and editing tasks, as demonstrated on models including FLUX.1-dev, Qwen-Image, and Z-Image-Turbo. The performance gains come from SGLang's fused kernels and AITER attention backend, enabling faster inference for diffusion-based AI models.", "body_md": "# Fast Image Generation and Editing with SGLang Diffusion on AMD GPUs[#](#fast-image-generation-and-editing-with-sglang-diffusion-on-amd-gpus)\n\nVisual generative AI is advancing at an extraordinary pace. OpenAI’s [GPT Image 2](https://openai.com/index/introducing-chatgpt-images-2-0/), released in April 2026, is a reasoning-enabled image model that performs an internal planning process before generating images. Its predecessor generated over 700 million images within just its first week after launch. Google’s **Nano Banana** (Gemini 3.1 Flash Image) delivers real-time, knowledge-grounded image generation and editing, while open-source video models such as **HunyuanVideo** can now produce fluid, high-fidelity clips from a single sentence.\n\nThis rapid progress has placed serving infrastructure front and center. **SGLang** has established itself as a high-performance serving framework for large language and multimodal models. With **SGLang Diffusion**, it brings the same battle-tested scheduler and kernel optimizations to diffusion-based image and video generation. In this post, we demonstrate how to serve state-of-the-art diffusion models on **AMD GPUs** using SGLang Diffusion on **ROCm**, compare its performance against **Hugging Face Diffusers**, and explore the architectural innovations that make it possible.\n\n## Performance Comparison — SGLang Diffusion vs. Hugging Face Diffusers[#](#performance-comparison-sglang-diffusion-vs-hugging-face-diffusers)\n\nBefore SGLang added diffusion support, **Hugging Face Diffusers** was the go-to Python library for running open-source diffusion models — flexible and well-documented, but not optimized for production serving. **SGLang Diffusion** closes that gap by combining SGLang’s high-throughput scheduler, continuous request batching, and optimized compute kernels on the AMD ROCm platform, significantly reducing per-step overhead in the evaluated configurations.\n\nWe benchmarked the two frameworks across four models — **FLUX.1-dev**, **Qwen-Image**, **Qwen-Image-Edit-2511**, and **Z-Image-Turbo** — covering text-to-image generation and image editing. All runs used a single AMD MI350X GPU, single-request concurrency, identical model weights, and the same number of inference steps per model. As shown in Figure 1 and Table 1 below, SGLang Diffusion consistently outperforms Hugging Face Diffusers across every model tested.\n\n**Table 1.** Single-request latency on a single AMD MI350X GPU. Environment: SGLang v0.5.11, ROCm 7.2.0, AITER attention backend, bfloat16 precision.\n\nModel |\nTask |\nResolution |\nSteps |\nSGLang (s) |\nHF Diffusers (s) |\nSpeedup |\n|---|---|---|---|---|---|---|\nFLUX.1-dev |\nText-to-Image |\n1024 x 1024 |\n50 |\n6.22 |\n14.02 |\n|\nQwen-Image |\nText-to-Image |\n1328 x 1328 |\n50 |\n106.00 |\n161.83 |\n|\nQwen-Image-Edit-2511 |\nImage-to-Image |\n512 x 512 |\n50 |\n21.89 |\n126.52 |\n|\nZ-Image-Turbo |\nText-to-Image |\n1024 x 1024 |\n9 |\n1.76 |\n11.07 |\n|\n\nAs detailed in Table 1, SGLang Diffusion achieves **1.5x – 6.3x speedups** across all four models. Fused kernels and the AITER attention backend help sharply reduce per-step overhead, with distilled models like Z-Image-Turbo benefiting the most. On AMD ROCm, the AITER backend also transparently handles FP32 to BF16/FP16 dtype casting for encoder components in the diffusion pipeline, such as the CLIP encoder, ensuring numerically stable inference with no user-side code changes.\n\n## Gallery — Sample Outputs[#](#gallery-sample-outputs)\n\nBelow are representative outputs generated by each model on AMD MI350X via SGLang. Figures 2–4 show text-to-image results, and Figure 5 demonstrates image editing capabilities. These figures further illustrate that diffusion models running on AMD GPUs can generate images with high visual quality.\n\n### Text-to-Image[#](#text-to-image)\n\n**FLUX.1-dev:**\n\n“A premium mechanical wristwatch displayed on polished black obsidian…” |\n“Movie still — a lone astronaut walks through an abandoned cathedral transformed into a forest…” |\n“A snow leopard resting on a rocky Himalayan cliff during sunrise…” |\n\n*Figure 2. Text-to-image samples generated by FLUX.1-dev on AMD MI350X via SGLang.*\n\n**Qwen-Image:**\n\n“A high-fashion editorial photograph of an elegant woman standing beneath the glass roof of a historic European train station…” |\n“A majestic mountain landscape emerging through layers of drifting mist. Traditional Chinese shan shui painting…” |\n“A candid photograph of a couple walking through narrow cobblestone streets in southern Europe during blue hour…” |\n\n*Figure 3. Text-to-image samples generated by Qwen-Image on AMD MI350X via SGLang.*\n\n**Z-Image-Turbo:**\n\n“A vast futuristic megacity at dusk. Hundreds of flying vehicles move between towering skyscrapers…” |\n“RAW photograph of a 32-year-old woman sitting in a cafe beside a window on a cloudy afternoon…” |\n“A magnificent Victorian greenhouse filled with exotic tropical plants and flowers. Sunlight filters through the glass ceiling…” |\n\n*Figure 4. Text-to-image samples generated by Z-Image-Turbo on AMD MI350X via SGLang.*\n\n### Image Editing (Text + Image → Image) — Qwen-Image-Edit-2511[#](#image-editing-text-image-image-qwen-image-edit-2511)\n\nOriginal |\nEdited |\n|---|---|\n“A picturesque fishing village along a rugged coastline during golden hour…” |\n“Add a vivid aurora borealis in shimmering green and purple ribbons across the sky above the village.” |\n\nOriginal |\nEdited |\n|---|---|\n“A magnificent luxury hotel lobby featuring marble floors, crystal chandeliers…” |\n“Add a tall decorated Christmas tree with twinkling golden lights and red ornaments beside the elegant seating area.” |\n\nOriginal |\nEdited |\n|---|---|\n“A cutting-edge research laboratory filled with advanced scientific equipment…” |\n“Add a sleek white humanoid robot assistant standing next to one of the researchers.” |\n\n*Figure 5. Image editing samples generated by Qwen-Image-Edit-2511 on AMD MI350X via SGLang. Each pair shows the original image (left) and the edited result (right).*\n\n## Step-by-Step Reproduction[#](#step-by-step-reproduction)\n\nAll benchmarks and sample outputs in this post were produced on AMD MI350X GPUs. This section provides the exact commands for reproducing each experiment — from environment setup to launching the server and running the benchmark client.\n\n### Environment Setup[#](#environment-setup)\n\nInstall SGLang with diffusion support on **AMD ROCm** (source build):\n\n```\ngit clone -b v0.5.12 https://github.com/sgl-project/sglang.git\ncd sglang\n\n# Build and install sgl-kernel for ROCm\ncd sgl-kernel\npython setup_rocm.py install\n\n# Install SGLang with diffusion + HIP support\ncd ..\nrm -rf python/pyproject.toml && mv python/pyproject_other.toml python/pyproject.toml\npip install -e \"python[all_hip]\"\n```\n\nAlternatively, pull the pre-built Docker image:\n\n```\n# AMD GPU Docker run alias\nalias drun='docker run -it --rm --network=host --privileged \\\n  --device=/dev/kfd --device=/dev/dri \\\n  --ipc=host --shm-size 16G --group-add video \\\n  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined \\\n  -v $HOME/dockerx:/dockerx'\n\ndrun lmsysorg/sglang:rocm-diffusion /bin/bash\n```\n\n### Text-to-Image with FLUX.1-dev[#](#text-to-image-with-flux-1-dev)\n\nSingle-shot generation via CLI:\n\n```\nsglang generate \\\n  --model-path black-forest-labs/FLUX.1-dev \\\n  --prompt \"A Logo With Bold Large Text: SGL Diffusion\" \\\n  --save-output\n```\n\nBenchmarking commands:\n\n```\n# Launch the server\nsglang serve \\\n  --model-path black-forest-labs/FLUX.1-dev \\\n  --ulysses-degree=1 \\\n  --ring-degree=1 \\\n  --port 30000\n# Run the benchmark client\npython3 -m sglang.multimodal_gen.benchmarks.bench_serving \\\n  --backend sglang-image --dataset vbench --task text-to-image \\\n  --num-prompts 1 --max-concurrency 1 \\\n  --dataset-path $VBENCH\n```\n\n### Text-to-Image with Qwen-Image[#](#text-to-image-with-qwen-image)\n\n**Qwen-Image:**\n\nSingle-shot generation via CLI:\n\n```\nsglang generate \\\n  --model-path Qwen/Qwen-Image \\\n  --prompt \"A serene mountain landscape at sunset\" \\\n  --save-output\n```\n\nBenchmarking commands:\n\n```\n# Launch the server\nsglang serve \\\n  --model-path Qwen/Qwen-Image \\\n  --ulysses-degree=1 \\\n  --ring-degree=1 \\\n  --port 30000\n# Run the benchmark client\npython3 -m sglang.multimodal_gen.benchmarks.bench_serving \\\n  --backend sglang-image --dataset vbench --task text-to-image \\\n  --num-prompts 1 --max-concurrency 1 \\\n  --dataset-path $VBENCH\n```\n\n**Qwen-Image-Edit-2511:**\n\nSingle-shot generation via CLI:\n\n```\nsglang generate \\\n  --model-path Qwen/Qwen-Image-Edit-2511 \\\n  --prompt \"Turn the sky into a starry night\" \\\n  --save-output\n```\n\nBenchmarking commands:\n\n```\n# Launch the server\nsglang serve \\\n  --model-path Qwen/Qwen-Image-Edit-2511 \\\n  --port 30000\n# Run the benchmark client\npython3 -m sglang.multimodal_gen.benchmarks.bench_serving \\\n  --backend sglang-image --dataset vbench --task image-to-image \\\n  --num-prompts 1 --max-concurrency 1\n```\n\n### Text-to-Image with Z-Image-Turbo[#](#text-to-image-with-z-image-turbo)\n\nSingle-shot generation via CLI:\n\n```\nsglang generate \\\n  --model-path Z-Image-Turbo \\\n  --prompt \"A futuristic cityscape with neon lights\" \\\n  --save-output\n```\n\nBenchmarking commands:\n\n```\n# Launch the server\nsglang serve \\\n  --model-path Z-Image-Turbo \\\n  --ulysses-degree=1 \\\n  --ring-degree=1 \\\n  --port 30000\n# Run the benchmark client\npython3 -m sglang.multimodal_gen.benchmarks.bench_serving \\\n  --backend sglang-image --dataset vbench --task text-to-image \\\n  --num-prompts 1 --max-concurrency 1 \\\n  --dataset-path $VBENCH\n```\n\nFor the full command reference and hardware-specific configurations, see the [SGLang Diffusion Cookbook](https://cookbook.sglang.io/diffusion) and the [AMD GPU platform docs](https://docs.sglang.io/platforms/amd_gpu.html).\n\n## Architecture Deep Dive[#](#architecture-deep-dive)\n\n### Latent Diffusion Pipeline[#](#latent-diffusion-pipeline)\n\nModern diffusion models follow a three-stage pipeline: a **text encoder** (CLIP, T5, or LLaMA) produces conditioning embeddings, a **Diffusion Transformer (DiT)** iteratively denoises latent tokens over 20–50 steps (the dominant cost), and a **VAE decoder** maps latents back to pixel space.\n\n### SGLang Diffusion Serving[#](#sglang-diffusion-serving)\n\nSGLang Diffusion decomposes this pipeline into modular, independently schedulable stages (`TextEncodingStage → DenoisingStage → DecodingStage`\n\n) orchestrated by `ComposedPipelineBase`\n\nunder the SGLang scheduler, which manages the request lifecycle and can run stages monolithically or disaggregated across separate encoder, denoiser, and decoder processes. Multi-GPU scaling is supported via **USP** (hybrid Ulysses-SP + Ring-Attention for the DiT), **CFG-Parallel** (splitting classifier-free guidance paths across GPUs), **Tensor Parallelism** (mainly for the text encoders), and dedicated **VAE parallelism**. Key kernel optimizations in `sgl-kernel`\n\ninclude fused MLP projections and a JIT-compiled kernel that fuses QK normalization with RoPE to cut memory round-trips. On top of these, **Distributed VAE** parallelizes encode/decode to avoid OOM at high resolutions.\n\n### The AMD ROCm Stack[#](#the-amd-rocm-stack)\n\n```\n┌──────────────────────────────────────────────────────────┐\n│                   SGLang Diffusion                       │\n│          (ComposedPipelineBase + Scheduler)              │\n├──────────────────────────────────────────────────────────┤\n│                     sgl-kernel                           │\n│  (fused DiT ops, Cache-DiT, Distributed VAE, RoPE)       │\n├─────────────────────┬────────────────────────────────────┤\n│      AITER          │          Triton (HIP backend)      │\n│  (AI Tensor Engine) │  (flash attention, norm kernels)   │\n├─────────────────────┴────────────────────────────────────┤\n│               ROCm / HIP Runtime                         │\n├──────────────────────────────────────────────────────────┤\n│     AMD Instinct GPU  (MI300X / MI325X / MI355X)         │\n└──────────────────────────────────────────────────────────┘\n```\n\n** AITER** (AI Tensor Engine for ROCm) is AMD’s high-performance kernel library, providing optimized flash attention, GEMM, and normalization primitives sourced from\n\n**Composable Kernel (CK)**,\n\n**Triton**, and\n\n**HIP/C++** backends with per-architecture dispatch. In SGLang Diffusion, AITER serves as the default attention backend, handling flash attention inside the DiT loop and transparently managing FP32 to BF16/FP16 dtype casting for compatibility with all model components. Quantization via\n\n**FP8** and\n\n**INT8** further reduces memory footprints for serving large models on AMD GPUs.\n\n## Summary[#](#summary)\n\nIn this blog, we explored how **SGLang Diffusion** serves state-of-the-art diffusion models on AMD GPUs, benchmarked its performance against Hugging Face Diffusers, and reproduced the results end-to-end. Across four models – FLUX.1-dev, Qwen-Image, Qwen-Image-Edit-2511, and Z-Image-Turbo — you saw **1.5x – 6.3x speedups** on a single AMD MI350X, powered by SGLang’s fused kernels, continuous batching scheduler, and the AITER attention backend on the ROCm stack. You also walked through the full reproduction workflow, from environment setup and server launch to running the benchmark client, and took a deeper look at the architecture that makes these gains possible.\n\nLooking ahead, we are actively working on several fronts to push SGLang Diffusion further on AMD GPUs:\n\n**FP8 and INT8 quantization**— shrinking memory footprints to serve larger models and increase throughput on AMD Instinct GPUs.** Multi-GPU USP scaling**— extending hybrid Ulysses-SP and Ring-Attention parallelism to the largest video generation models.** Video generation workflows**— bringing the same serving optimizations to open-source video models such as HunyuanVideo and Wan.\n\nStay tuned for future posts from our team as we continue to optimize diffusion model serving on the AMD ROCm platform.\n\n## Additional Resources[#](#additional-resources)\n\n## Disclaimers[#](#disclaimers)\n\nThird-party content is licensed to you directly by the third party that owns the content and is not licensed to you by AMD. ALL LINKED THIRD-PARTY CONTENT IS PROVIDED “AS IS” WITHOUT A WARRANTY OF ANY KIND. USE OF SUCH THIRD-PARTY CONTENT IS DONE AT YOUR SOLE DISCRETION AND UNDER NO CIRCUMSTANCES WILL AMD BE LIABLE TO YOU FOR ANY THIRD-PARTY CONTENT. YOU ASSUME ALL RISK AND ARE SOLELY RESPONSIBLE FOR ANY DAMAGES THAT MAY ARISE FROM YOUR USE OF THIRD-PARTY CONTENT.", "url": "https://wpnews.pro/news/fast-image-generation-and-editing-with-sglang-diffusion-on-amd-gpus", "canonical_source": "https://rocm.blogs.amd.com/artificial-intelligence/sglang-diffusion/README.html", "published_at": "2026-07-10 00:00:00+00:00", "updated_at": "2026-07-10 16:47:43.146593+00:00", "lang": "en", "topics": ["artificial-intelligence", "generative-ai", "ai-infrastructure", "ai-tools", "computer-vision"], "entities": ["AMD", "SGLang", "Hugging Face Diffusers", "ROCm", "MI350X", "FLUX.1-dev", "Qwen-Image", "Z-Image-Turbo"], "alternates": {"html": "https://wpnews.pro/news/fast-image-generation-and-editing-with-sglang-diffusion-on-amd-gpus", "markdown": "https://wpnews.pro/news/fast-image-generation-and-editing-with-sglang-diffusion-on-amd-gpus.md", "text": "https://wpnews.pro/news/fast-image-generation-and-editing-with-sglang-diffusion-on-amd-gpus.txt", "jsonld": "https://wpnews.pro/news/fast-image-generation-and-editing-with-sglang-diffusion-on-amd-gpus.jsonld"}}