vllm - ✅(Solved) Fix [Bug]: block_size < 16 silently falls back to FLEX_ATTENTION, then crashes in Triton compilation [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vllm-project/vllm#41339Fetched 2026-05-01 05:34:08
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
subscribed ×2closed ×1cross-referenced ×1labeled ×1

Error Message

File: torch/_inductor/runtime/triton_heuristics.py:810 triton.compiler.errors.CompilationError: at 140:10: acc = tl.dot(p.to(MATMUL_PRECISION), v, acc, ...) ^ AssertionError: Input shapes should have M >= 1, N >= 1 and K >= 16

Root Cause

block_size=8
  → KV cache page size = 8
  → backend selector excludes FA / FlashInfer / TritonAttn (correctly)
  → backend selector picks FLEX_ATTENTION (incorrectly)
  → engine init + warmup succeed (no real forward pass yet)
  → first generate() triggers Inductor compilation
  → FlexAttention BlockMask SPARSE_KV_BLOCK_SIZE = 8
  → Inductor Triton kernel BLOCK_N = 8
  → tl.dot(P, V) has K = 8
  → Triton AssertionError: K must be >= 16
  → EngineDeadError

The selector logic in vllm/platforms/cuda.py knows that the upper-priority backends reject small block sizes, but does not encode the BLOCK_N >= 16 constraint of the FLEX_ATTENTION Triton template.

Full log with VLLM_LOGGING_LEVEL=DEBUG: debug.log

Fix Action

Fix / Workaround

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

Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 52 bits physical, 57 bits virtual Byte Order: Little Endian CPU(s): 128 On-line CPU(s) list: 0-127 Vendor ID: AuthenticAMD Model name: AMD EPYC 9554 64-Core Processor CPU family: 25 Model: 17 Thread(s) per core: 2 Core(s) per socket: 64 Socket(s): 1 Stepping: 1 Frequency boost: enabled CPU max MHz: 3762.9880 CPU min MHz: 1500.0000 BogoMIPS: 6190.81 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 invpcid_single hw_pstate ssbd mba ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid overflow_recov succor smca fsrm flush_l1d Virtualization: AMD-V L1d cache: 2 MiB (64 instances) L1i cache: 2 MiB (64 instances) L2 cache: 64 MiB (64 instances) L3 cache: 256 MiB (8 instances) NUMA node(s): 1 NUMA node0 CPU(s): 0-127 Vulnerability Gather data sampling: Not affected Vulnerability Itlb multihit: Not affected Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Not affected Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Not affected Vulnerability Spec rstack overflow: Mitigation; safe RET Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Not affected

PR fix notes

PR #41363: (bugfix): block_size check for flex attn

Description (problem / solution / changelog)

Purpose

Closes #41339

Description

Previously, when a user set block_size < 16 (e.g., block_size=8), vLLM would trigger a cryptic Triton compilation error during the runtime, which was difficult for users to debug and understand.

Changes

Added block_size compatibility checks for flex attention backend.

Verification Now, instead of a Triton crash, users will see a clear and actionable error message:

ValueError: No valid attention backend found for cuda with AttentionSelectorConfig(head_size=128, dtype=torch.bfloat16, kv_cache_dtype=auto, block_size=8, use_mla=False, has_sink=False, use_sparse=False, use_mm_prefix=False, use_per_head_quant_scales=False, attn_type=AttentionType.DECODER, use_non_causal=False). Reasons: {FLASH_ATTN: [block_size not supported], FLASHINFER: [block_size not supported], TRITON_ATTN: [block_size not supported], FLEX_ATTENTION: [block_size not supported], TURBOQUANT: [kv_cache_dtype not supported, block_size not supported]}

Changed files

  • docs/design/attention_backends.md (modified, +1/-1)
  • vllm/v1/attention/backends/flex_attention.py (modified, +5/-0)

Code Example

Collecting environment information...
==============================
        System Info
==============================
OS                           : Ubuntu 22.04.5 LTS (x86_64)
GCC version                  : (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version                : Could not collect
CMake version                : version 3.22.1
Libc version                 : glibc-2.35

==============================
       PyTorch Info
==============================
PyTorch version              : 2.10.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.15.0-122-generic-x86_64-with-glibc2.35
    
==============================
       CUDA / GPU Info
==============================
Is CUDA available            : True
CUDA runtime version         : 12.1.105
CUDA_MODULE_LOADING set to   : 
GPU models and configuration : 
GPU 0: NVIDIA L40S
GPU 1: NVIDIA L40S
GPU 2: NVIDIA L40S
GPU 3: NVIDIA L40S

Nvidia driver version        : 560.35.03
cuDNN version                : Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.7
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:                        52 bits physical, 57 bits virtual
Byte Order:                           Little Endian
CPU(s):                               128
On-line CPU(s) list:                  0-127
Vendor ID:                            AuthenticAMD
Model name:                           AMD EPYC 9554 64-Core Processor
CPU family:                           25
Model:                                17
Thread(s) per core:                   2
Core(s) per socket:                   64
Socket(s):                            1
Stepping:                             1
Frequency boost:                      enabled
CPU max MHz:                          3762.9880
CPU min MHz:                          1500.0000
BogoMIPS:                             6190.81
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 invpcid_single hw_pstate ssbd mba ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid overflow_recov succor smca fsrm flush_l1d
Virtualization:                       AMD-V
L1d cache:                            2 MiB (64 instances)
L1i cache:                            2 MiB (64 instances)
L2 cache:                             64 MiB (64 instances)
L3 cache:                             256 MiB (8 instances)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-127
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Mitigation; safe RET
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

==============================
Versions of relevant libraries
==============================
[pip3] flashinfer-python==0.6.6
[pip3] numpy==2.2.6
[pip3] nvidia-cublas-cu12==12.8.4.1
[pip3] nvidia-cuda-cupti-cu12==12.8.90
[pip3] nvidia-cuda-nvrtc-cu12==12.8.93
[pip3] nvidia-cuda-runtime-cu12==12.8.90
[pip3] nvidia-cudnn-cu12==9.10.2.21
[pip3] nvidia-cudnn-frontend==1.18.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.0.dev0
[pip3] nvidia-cutlass-dsl-libs-base==4.5.0.dev0
[pip3] nvidia-ml-py==13.595.45
[pip3] nvidia-nccl-cu12==2.27.5
[pip3] nvidia-nvjitlink-cu12==12.8.93
[pip3] nvidia-nvshmem-cu12==3.4.5
[pip3] nvidia-nvtx-cu12==12.8.90
[pip3] pyzmq==27.1.0
[pip3] torch==2.10.0
[pip3] torch_c_dlpack_ext==0.1.5
[pip3] torchaudio==2.10.0
[pip3] torchvision==0.25.0
[pip3] transformers==5.6.2
[pip3] triton==3.6.0
[conda] flashinfer-python                           0.6.6            pypi_0           pypi
[conda] numpy                                       2.2.6            pypi_0           pypi
[conda] nvidia-cublas-cu12                          12.8.4.1         pypi_0           pypi
[conda] nvidia-cuda-cupti-cu12                      12.8.90          pypi_0           pypi
[conda] nvidia-cuda-nvrtc-cu12                      12.8.93          pypi_0           pypi
[conda] nvidia-cuda-runtime-cu12                    12.8.90          pypi_0           pypi
[conda] nvidia-cudnn-cu12                           9.10.2.21        pypi_0           pypi
[conda] nvidia-cudnn-frontend                       1.18.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.0.dev0       pypi_0           pypi
[conda] nvidia-cutlass-dsl-libs-base                4.5.0.dev0       pypi_0           pypi
[conda] nvidia-ml-py                                13.595.45        pypi_0           pypi
[conda] nvidia-nccl-cu12                            2.27.5           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] pyzmq                                       27.1.0           pypi_0           pypi
[conda] torch                                       2.10.0           pypi_0           pypi
[conda] torch-c-dlpack-ext                          0.1.5            pypi_0           pypi
[conda] torchaudio                                  2.10.0           pypi_0           pypi
[conda] torchvision                                 0.25.0           pypi_0           pypi
[conda] transformers                                5.6.2            pypi_0           pypi
[conda] triton                                      3.6.0            pypi_0           pypi

==============================
         vLLM Info
==============================
ROCM Version                 : Could not collect
vLLM Version                 : 0.19.1
vLLM Build Flags:
  CUDA Archs: Not Set; ROCm: Disabled; XPU: Disabled
GPU Topology:
        GPU0    GPU1    GPU2    GPU3    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      PHB     NODE    NODE    0-127   0               N/A
GPU1    PHB      X      NODE    NODE    0-127   0               N/A
GPU2    NODE    NODE     X      PHB     0-127   0               N/A
GPU3    NODE    NODE    PHB      X      0-127   0               N/A

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

==============================
     Environment Variables
==============================
CUDA_HOME=/usr/local/cuda
CUDA_HOME=/usr/local/cuda
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=1
TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_ningke

---

import vllm
print(f"vllm version: {vllm.__version__}")
from vllm import LLM, SamplingParams
llm = LLM(
        model="meta-llama/Llama-3.2-1B-Instruct",
        block_size=8, #can be set to any value<16
        enforce_eager=True,
        gpu_memory_utilization=0.5,
        max_model_len=1024,
    )
out = llm.generate(["Hello, how are you?"],
                        SamplingParams(temperature=0, max_tokens=8, seed=42))

---

WARNING [cuda.py:324] --block-size 8 precluded higher-priority backend(s)
FLASH_ATTN, FLASHINFER, TRITON_ATTN. Using FLEX_ATTENTION instead, which
may result in reduced performance.

---

File: torch/_inductor/runtime/triton_heuristics.py:810
triton.compiler.errors.CompilationError: at 140:10:
    acc = tl.dot(p.to(MATMUL_PRECISION), v, acc, ...)
          ^
AssertionError: Input shapes should have M >= 1, N >= 1 and K >= 16

---

block_size=8
KV cache page size = 8
  → backend selector excludes FA / FlashInfer / TritonAttn (correctly)
  → backend selector picks FLEX_ATTENTION (incorrectly)
  → engine init + warmup succeed (no real forward pass yet)
  → first generate() triggers Inductor compilation
FlexAttention BlockMask SPARSE_KV_BLOCK_SIZE = 8
Inductor Triton kernel BLOCK_N = 8
  → tl.dot(P, V) has K = 8
Triton AssertionError: K must be >= 16
EngineDeadError
RAW_BUFFERClick to expand / collapse

Your current environment

<details> <summary>The output of <code>python collect_env.py</code></summary>

Collecting environment information...
==============================
        System Info
==============================
OS                           : Ubuntu 22.04.5 LTS (x86_64)
GCC version                  : (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version                : Could not collect
CMake version                : version 3.22.1
Libc version                 : glibc-2.35

==============================
       PyTorch Info
==============================
PyTorch version              : 2.10.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.15.0-122-generic-x86_64-with-glibc2.35
    
==============================
       CUDA / GPU Info
==============================
Is CUDA available            : True
CUDA runtime version         : 12.1.105
CUDA_MODULE_LOADING set to   : 
GPU models and configuration : 
GPU 0: NVIDIA L40S
GPU 1: NVIDIA L40S
GPU 2: NVIDIA L40S
GPU 3: NVIDIA L40S

Nvidia driver version        : 560.35.03
cuDNN version                : Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.7
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.7
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:                        52 bits physical, 57 bits virtual
Byte Order:                           Little Endian
CPU(s):                               128
On-line CPU(s) list:                  0-127
Vendor ID:                            AuthenticAMD
Model name:                           AMD EPYC 9554 64-Core Processor
CPU family:                           25
Model:                                17
Thread(s) per core:                   2
Core(s) per socket:                   64
Socket(s):                            1
Stepping:                             1
Frequency boost:                      enabled
CPU max MHz:                          3762.9880
CPU min MHz:                          1500.0000
BogoMIPS:                             6190.81
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 invpcid_single hw_pstate ssbd mba ibrs ibpb stibp ibrs_enhanced vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd amd_ppin cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq la57 rdpid overflow_recov succor smca fsrm flush_l1d
Virtualization:                       AMD-V
L1d cache:                            2 MiB (64 instances)
L1i cache:                            2 MiB (64 instances)
L2 cache:                             64 MiB (64 instances)
L3 cache:                             256 MiB (8 instances)
NUMA node(s):                         1
NUMA node0 CPU(s):                    0-127
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          Not affected
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Not affected
Vulnerability Spec rstack overflow:   Mitigation; safe RET
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; STIBP always-on; RSB filling; PBRSB-eIBRS Not affected; BHI Not affected
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Not affected

==============================
Versions of relevant libraries
==============================
[pip3] flashinfer-python==0.6.6
[pip3] numpy==2.2.6
[pip3] nvidia-cublas-cu12==12.8.4.1
[pip3] nvidia-cuda-cupti-cu12==12.8.90
[pip3] nvidia-cuda-nvrtc-cu12==12.8.93
[pip3] nvidia-cuda-runtime-cu12==12.8.90
[pip3] nvidia-cudnn-cu12==9.10.2.21
[pip3] nvidia-cudnn-frontend==1.18.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.0.dev0
[pip3] nvidia-cutlass-dsl-libs-base==4.5.0.dev0
[pip3] nvidia-ml-py==13.595.45
[pip3] nvidia-nccl-cu12==2.27.5
[pip3] nvidia-nvjitlink-cu12==12.8.93
[pip3] nvidia-nvshmem-cu12==3.4.5
[pip3] nvidia-nvtx-cu12==12.8.90
[pip3] pyzmq==27.1.0
[pip3] torch==2.10.0
[pip3] torch_c_dlpack_ext==0.1.5
[pip3] torchaudio==2.10.0
[pip3] torchvision==0.25.0
[pip3] transformers==5.6.2
[pip3] triton==3.6.0
[conda] flashinfer-python                           0.6.6            pypi_0           pypi
[conda] numpy                                       2.2.6            pypi_0           pypi
[conda] nvidia-cublas-cu12                          12.8.4.1         pypi_0           pypi
[conda] nvidia-cuda-cupti-cu12                      12.8.90          pypi_0           pypi
[conda] nvidia-cuda-nvrtc-cu12                      12.8.93          pypi_0           pypi
[conda] nvidia-cuda-runtime-cu12                    12.8.90          pypi_0           pypi
[conda] nvidia-cudnn-cu12                           9.10.2.21        pypi_0           pypi
[conda] nvidia-cudnn-frontend                       1.18.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.0.dev0       pypi_0           pypi
[conda] nvidia-cutlass-dsl-libs-base                4.5.0.dev0       pypi_0           pypi
[conda] nvidia-ml-py                                13.595.45        pypi_0           pypi
[conda] nvidia-nccl-cu12                            2.27.5           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] pyzmq                                       27.1.0           pypi_0           pypi
[conda] torch                                       2.10.0           pypi_0           pypi
[conda] torch-c-dlpack-ext                          0.1.5            pypi_0           pypi
[conda] torchaudio                                  2.10.0           pypi_0           pypi
[conda] torchvision                                 0.25.0           pypi_0           pypi
[conda] transformers                                5.6.2            pypi_0           pypi
[conda] triton                                      3.6.0            pypi_0           pypi

==============================
         vLLM Info
==============================
ROCM Version                 : Could not collect
vLLM Version                 : 0.19.1
vLLM Build Flags:
  CUDA Archs: Not Set; ROCm: Disabled; XPU: Disabled
GPU Topology:
        GPU0    GPU1    GPU2    GPU3    CPU Affinity    NUMA Affinity   GPU NUMA ID
GPU0     X      PHB     NODE    NODE    0-127   0               N/A
GPU1    PHB      X      NODE    NODE    0-127   0               N/A
GPU2    NODE    NODE     X      PHB     0-127   0               N/A
GPU3    NODE    NODE    PHB      X      0-127   0               N/A

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

==============================
     Environment Variables
==============================
CUDA_HOME=/usr/local/cuda
CUDA_HOME=/usr/local/cuda
PYTORCH_NVML_BASED_CUDA_CHECK=1
TORCHINDUCTOR_COMPILE_THREADS=1
TORCHINDUCTOR_CACHE_DIR=/tmp/torchinductor_ningke
</details>

🐛 Describe the bug

In vLLM 0.19.1, setting block_size < 16 is silently accepted by EngineArgs. Engine init (KV cache, warmup) completes, but the first forward pass crashes during Triton kernel compilation, so the user-facing error is far removed from the actual misconfiguration.

ModelResult
meta-llama/Llama-3.2-1B-Instruct❌ crash
google/gemma-2-2b❌ crash
Qwen/Qwen2.5-3B❌ crash
Qwen/Qwen3-4B❌ crash

block_size=16 on the same setup runs fine, which pins the boundary exactly at the Triton K >= 16 requirement (see root cause below).

Reproducer

import vllm
print(f"vllm version: {vllm.__version__}")
from vllm import LLM, SamplingParams
llm = LLM(
        model="meta-llama/Llama-3.2-1B-Instruct",
        block_size=8, #can be set to any value<16
        enforce_eager=True,
        gpu_memory_utilization=0.5,
        max_model_len=1024,
    )
out = llm.generate(["Hello, how are you?"],
                        SamplingParams(temperature=0, max_tokens=8, seed=42))

Two-stage fallback

Stage 1: vLLM correctly excludes the high-priority backends:

WARNING [cuda.py:324] --block-size 8 precluded higher-priority backend(s)
FLASH_ATTN, FLASHINFER, TRITON_ATTN. Using FLEX_ATTENTION instead, which
may result in reduced performance.

Stage 2: the FLEX_ATTENTION fallback itself does not support block_size < 16:

File: torch/_inductor/runtime/triton_heuristics.py:810
triton.compiler.errors.CompilationError: at 140:10:
    acc = tl.dot(p.to(MATMUL_PRECISION), v, acc, ...)
          ^
AssertionError: Input shapes should have M >= 1, N >= 1 and K >= 16

The Inductor-generated kernel triton_tem_fused_flex_attention_0 is compiled with BLOCK_M=16, BLOCK_N=8, SPARSE_KV_BLOCK_SIZE=8 (on cc=89 with bfloat16), and BLOCK_N is the K dimension of the inner tl.dot(P, V). Triton hard-asserts K >= 16.

So the underlying bug is: vLLM's fallback path is unreachable for block_size < 16 on CUDA, but the backend selector doesn't encode that constraint, so the fallback is chosen anyway and the user only finds out via a Triton compiler assertion deep inside Inductor.

Root cause

block_size=8
  → KV cache page size = 8
  → backend selector excludes FA / FlashInfer / TritonAttn (correctly)
  → backend selector picks FLEX_ATTENTION (incorrectly)
  → engine init + warmup succeed (no real forward pass yet)
  → first generate() triggers Inductor compilation
  → FlexAttention BlockMask SPARSE_KV_BLOCK_SIZE = 8
  → Inductor Triton kernel BLOCK_N = 8
  → tl.dot(P, V) has K = 8
  → Triton AssertionError: K must be >= 16
  → EngineDeadError

The selector logic in vllm/platforms/cuda.py knows that the upper-priority backends reject small block sizes, but does not encode the BLOCK_N >= 16 constraint of the FLEX_ATTENTION Triton template.

Full log with VLLM_LOGGING_LEVEL=DEBUG: debug.log

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.

extent analysis

TL;DR

The issue can be fixed by modifying the backend selector logic in vllm/platforms/cuda.py to encode the BLOCK_N >= 16 constraint of the FLEX_ATTENTION Triton template.

Guidance

  • Identify the block_size constraint in the FLEX_ATTENTION Triton template and update the backend selector logic to respect this constraint.
  • Modify the vllm/platforms/cuda.py file to exclude the FLEX_ATTENTION backend when block_size < 16.
  • Test the updated code with different block_size values to ensure the fix works as expected.
  • Consider adding a check to raise an error when block_size < 16 is set, to prevent silent failures.

Example

# in vllm/platforms/cuda.py
if block_size < 16:
    # exclude FLEX_ATTENTION backend
    available_backends = [b for b in available_backends if b!= 'FLEX_ATTENTION']

Notes

The fix requires modifying the vllm library code, which may not be feasible for all users. An alternative solution could be to add a check in the user code to ensure block_size >= 16 before creating the LLM object.

Recommendation

Apply the workaround by modifying the vllm/platforms/cuda.py file to exclude the FLEX_ATTENTION backend when block_size < 16, as this is the most direct way to fix the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

vllm - ✅(Solved) Fix [Bug]: block_size < 16 silently falls back to FLEX_ATTENTION, then crashes in Triton compilation [1 pull requests, 1 participants]