Skip to content

[Bug]: DiffusionGemma fails to start with RuntimeError in _compiled_sample_step during torch.compile (matmul shape mismatch) #47129

Description

@knoka0812

Your current environment

(torch) root@gltbjaudgggwsmky-make-84bbd6bc9d-5w755:/data/coding# python collect_env.py

Collecting environment information...

    System Info

==============================
OS : Ubuntu 24.04.4 LTS (x86_64)
GCC version : (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
Clang version : Could not collect
CMake version : version 3.28.3
Libc version : glibc-2.39

==============================
PyTorch Info

PyTorch version : 2.11.0+cu128
Is debug build : False
CUDA used to build PyTorch : 12.8
ROCM used to build PyTorch : N/A
XPU used to build PyTorch : N/A

==============================
Python Environment

Python version : 3.12.13 | packaged by Anaconda, Inc. | (main, Mar 19 2026, 20:20:58) [GCC 14.3.0] (64-bit runtime)
Python platform : Linux-5.19.0-50-generic-x86_64-with-glibc2.39

==============================
CUDA / GPU Info

Is CUDA available : True
CUDA runtime version : 13.0.48
CUDA_MODULE_LOADING set to :
GPU models and configuration :
GPU 0: NVIDIA A100-PCIE-40GB
GPU 1: NVIDIA A100-PCIE-40GB

Nvidia driver version : 590.48.01
cuDNN version : Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.9.19.0
/usr/lib/x86_64-linux-gnu/libcudnn_adv.so.9.19.0
/usr/lib/x86_64-linux-gnu/libcudnn_cnn.so.9.19.0
/usr/lib/x86_64-linux-gnu/libcudnn_engines_precompiled.so.9.19.0
/usr/lib/x86_64-linux-gnu/libcudnn_engines_runtime_compiled.so.9.19.0
/usr/lib/x86_64-linux-gnu/libcudnn_graph.so.9.19.0
/usr/lib/x86_64-linux-gnu/libcudnn_heuristic.so.9.19.0
/usr/lib/x86_64-linux-gnu/libcudnn_ops.so.9.19.0
HIP runtime version : N/A
MIOpen runtime version : N/A
Is XNNPACK available : True

==============================
CPU Info

Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 96
On-line CPU(s) list: 0-95
Vendor ID: GenuineIntel
Model name: Intel(R) Xeon(R) Gold 6248R CPU @ 3.00GHz
CPU family: 6
Model: 85
Thread(s) per core: 2
Core(s) per socket: 24
Socket(s): 2
Stepping: 7
CPU(s) scaling MHz: 78%
CPU max MHz: 4000.0000
CPU min MHz: 1200.0000
BogoMIPS: 6000.00
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single intel_ppin ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts hwp hwp_act_window hwp_epp hwp_pkg_req pku ospke avx512_vnni md_clear flush_l1d arch_capabilities
Virtualization: VT-x
L1d cache: 1.5 MiB (48 instances)
L1i cache: 1.5 MiB (48 instances)
L2 cache: 48 MiB (48 instances)
L3 cache: 71.5 MiB (2 instances)
NUMA node(s): 2
NUMA node0 CPU(s): 0-23,48-71
NUMA node1 CPU(s): 24-47,72-95
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Retbleed: Mitigation; Enhanced IBRS
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Enhanced IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Mitigation; TSX disabled

==============================
Versions of relevant libraries

[pip3] flashinfer-python==0.6.12
[pip3] numpy==2.3.5
[pip3] nvidia-cublas-cu12==12.8.4.1
[pip3] nvidia-cuda-cccl==13.3.3.4.1
[pip3] nvidia-cuda-crt==13.3.73
[pip3] nvidia-cuda-cupti-cu12==12.8.90
[pip3] nvidia-cuda-nvcc==13.2.78
[pip3] nvidia-cuda-nvrtc==13.3.33
[pip3] nvidia-cuda-nvrtc-cu12==12.8.93
[pip3] nvidia-cuda-runtime==13.3.29
[pip3] nvidia-cuda-runtime-cu12==12.8.90
[pip3] nvidia-cuda-tileiras==13.2.78
[pip3] nvidia-cudnn-cu12==9.19.0.56
[pip3] nvidia-cudnn-frontend==1.25.0
[pip3] nvidia-cufft-cu12==11.3.3.83
[pip3] nvidia-cufile-cu12==1.13.1.3
[pip3] nvidia-curand-cu12==10.3.9.90
[pip3] nvidia-cusolver-cu12==11.7.3.90
[pip3] nvidia-cusparse-cu12==12.5.8.93
[pip3] nvidia-cusparselt-cu12==0.7.1
[pip3] nvidia-cutlass-dsl==4.5.2
[pip3] nvidia-cutlass-dsl-libs-base==4.5.2
[pip3] nvidia-cutlass-dsl-libs-cu13==4.5.2
[pip3] nvidia-ml-py==13.590.48
[pip3] nvidia-nccl-cu12==2.28.9
[pip3] nvidia-nvjitlink-cu12==12.8.93
[pip3] nvidia-nvshmem-cu12==3.4.5
[pip3] nvidia-nvtx-cu12==12.8.90
[pip3] nvidia-nvvm==13.2.78
[pip3] pyzmq==27.1.0
[pip3] tokenspeed-triton==3.7.10.post20260531
[pip3] torch==2.11.0+cu128
[pip3] torch_c_dlpack_ext==0.1.5
[pip3] torchaudio==2.11.0+cu128
[pip3] torchvision==0.26.0+cu128
[pip3] transformers==5.12.1
[pip3] triton==3.6.0
[conda] flashinfer-python 0.6.12 pypi_0 pypi
[conda] numpy 2.3.5 pypi_0 pypi
[conda] nvidia-cublas-cu12 12.8.4.1 pypi_0 pypi
[conda] nvidia-cuda-cccl 13.3.3.4.1 pypi_0 pypi
[conda] nvidia-cuda-crt 13.3.73 pypi_0 pypi
[conda] nvidia-cuda-cupti-cu12 12.8.90 pypi_0 pypi
[conda] nvidia-cuda-nvcc 13.2.78 pypi_0 pypi
[conda] nvidia-cuda-nvrtc 13.3.33 pypi_0 pypi
[conda] nvidia-cuda-nvrtc-cu12 12.8.93 pypi_0 pypi
[conda] nvidia-cuda-runtime 13.3.29 pypi_0 pypi
[conda] nvidia-cuda-runtime-cu12 12.8.90 pypi_0 pypi
[conda] nvidia-cuda-tileiras 13.2.78 pypi_0 pypi
[conda] nvidia-cudnn-cu12 9.19.0.56 pypi_0 pypi
[conda] nvidia-cudnn-frontend 1.25.0 pypi_0 pypi
[conda] nvidia-cufft-cu12 11.3.3.83 pypi_0 pypi
[conda] nvidia-cufile-cu12 1.13.1.3 pypi_0 pypi
[conda] nvidia-curand-cu12 10.3.9.90 pypi_0 pypi
[conda] nvidia-cusolver-cu12 11.7.3.90 pypi_0 pypi
[conda] nvidia-cusparse-cu12 12.5.8.93 pypi_0 pypi
[conda] nvidia-cusparselt-cu12 0.7.1 pypi_0 pypi
[conda] nvidia-cutlass-dsl 4.5.2 pypi_0 pypi
[conda] nvidia-cutlass-dsl-libs-base 4.5.2 pypi_0 pypi
[conda] nvidia-cutlass-dsl-libs-cu13 4.5.2 pypi_0 pypi
[conda] nvidia-ml-py 13.590.48 pypi_0 pypi
[conda] nvidia-nccl-cu12 2.28.9 pypi_0 pypi
[conda] nvidia-nvjitlink-cu12 12.8.93 pypi_0 pypi
[conda] nvidia-nvshmem-cu12 3.4.5 pypi_0 pypi
[conda] nvidia-nvtx-cu12 12.8.90 pypi_0 pypi
[conda] nvidia-nvvm 13.2.78 pypi_0 pypi
[conda] pyzmq 27.1.0 pypi_0 pypi
[conda] tokenspeed-triton 3.7.10.post20260531 pypi_0 pypi
[conda] torch 2.11.0+cu128 pypi_0 pypi
[conda] torch-c-dlpack-ext 0.1.5 pypi_0 pypi
[conda] torchaudio 2.11.0+cu128 pypi_0 pypi
[conda] torchvision 0.26.0+cu128 pypi_0 pypi
[conda] transformers 5.12.1 pypi_0 pypi
[conda] triton 3.6.0 pypi_0 pypi

==============================
vLLM Info

ROCM Version : Could not collect
vLLM Version : 0.24.0
vLLM Build Flags:
CUDA Archs: Not Set; ROCm: Disabled; XPU: Disabled
GPU Topology:
GPU0 GPU1 NIC0 CPU Affinity NUMA Affinity GPU NUMA ID
GPU0 X SYS PIX 0-23,48-71 0 N/A
GPU1 SYS X SYS 24-47,72-95 1 N/A
NIC0 PIX SYS X

Legend:

X = Self
SYS = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
PHB = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
PXB = Connection traversing multiple PCIe bridges (without traversing the PCIe Host Bridge)
PIX = Connection traversing at most a single PCIe bridge
NV# = Connection traversing a bonded set of # NVLinks

NIC Legend:

NIC0: mlx5_bond_0

==============================
Environment Variables

NVIDIA_VISIBLE_DEVICES=void
LD_LIBRARY_PATH=/usr/local/cuda-13.0/lib64:
NVIDIA_CTK_LIBCUDA_DIR=/usr/lib/x86_64-linux-gnu
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=1
TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_root

(torch) root@gltbjaudgggwsmky-make-84bbd6bc9d-5w755:/data/coding#
(torch) root@gltbjaudgggwsmky-make-84bbd6bc9d-5w755:/data/coding#
(torch) root@gltbjaudgggwsmky-make-84bbd6bc9d-5w755:/data/coding#

🐛 Describe the bug

Environment

  • OS: Ubuntu (cloud/K8s GPU instance)
  • GPU: 2 x NVIDIA A100-PCIE-40GB
  • CUDA: 13.0 (toolkit manually installed, driver >= 580)
  • Python: 3.12
  • vLLM version: (latest from main / please fill in vllm --version)
  • PyTorch version: 2.11.0+cu130
  • Model: diffusiongemma-26B-A4B

Reproduction command

vllm serve diffusiongemma-26B-A4B \
  --host 0.0.0.0 \
  --port 30041 \
  --max-model-len 262144 \
  --max-num-seqs 10 \
  --gpu-memory-utilization 0.9 \
  --mm-processor-kwargs '{"max_soft_tokens":1120}' \
  --diffusion-config '{"canvas_length":256,"max_denoising_steps":16}' \
  --hf_overrides '{"diffusion_sampler":"entropy_bound","diffusion_entropy_bound":0.1,"diffusion_confidence_threshold":0.0}' \
  --limit-mm-per-prompt '{"image":7}' \
  --no-enable-prefix-caching \
  --enable-auto-tool-choice \
  --tool-call-parser gemma4 \
  --reasoning-parser gemma4 \
  --served-model-name gemma4 \
  --tensor-parallel-size 2

Error

Model weights load successfully, but EngineCore crashes during warmup / torch.compile of _compiled_sample_step:

RuntimeError: a and b must have same reduction dim, but got [s23*((s88//s23)), s3] X [131072, 2816].

Full worker trace points to:

File ".../vllm/model_executor/models/diffusion_gemma.py", line 630, in _compiled_sample_step
    soft_embeds = torch.matmul(probs.to(embed_weight.dtype), embed_weight) * normalizer

Fake-tensor shape mismatch occurs when Dynamo attempts to compile this step with symbolic dimensions.

Logs (key excerpt)

(Worker_TP1 pid=29147) ERROR [multiproc_executor.py:1000] WorkerProc hit an exception.
...
torch._dynamo.exc.TorchRuntimeError: RuntimeError when making fake tensor call
  Explanation: Dynamo failed to run FX node with fake tensors:
    call_function <built-in method matmul of type object ...>
    (*(FakeTensor(..., size=(s23, (s88//s23), s3), dtype=torch.bfloat16),
       Parameter(FakeTensor(..., size=(131072, 2816), dtype=torch.bfloat16))),
     **{}):
    got RuntimeError('a and b must have same reduction dim, but got [s23*((s88//s23)), s3] X [131072, 2816].')
  Hint: Your code may result in an error when running in eager.
        Please double check that your code doesn't contain a similar error when actually running eager/uncompiled.
        You can do this by removing the `torch.compile` call, or by using `torch.compiler.set_stance("force_eager")`.

Expected behavior

vLLM server should finish warmup and expose the OpenAI-compatible API on port 30041.

What I've already tried

  1. Installed CUDA 13.0 toolkit and set LD_LIBRARY_PATH=/usr/local/cuda-13.0/lib64
  2. Confirmed model weights load successfully (weights loading takes ~13s)
  3. The crash happens after model loading, during kernel warmup / torch.compile in _compiled_sample_step

Possible cause

The @torch.compile-decorated _compiled_sample_step in diffusion_gemma.py may not correctly handle dynamic shapes (symbolic s23, s88, s3) on the torch.matmul between probs and embed_weight. The reduction dimension in probs appears reshaped as [s23*((s88//s23)), s3] while embed_weight expects [131072, 2816], leading to a mismatch during fake-tensor tracing.

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions