sgl-project/sglang · error · ValueError
st attn not supported
Error message
st attn not supported
What it means
SlidingTileAttentionBackend.__init__ raises ValueError when st_attn_backend_available is False, i.e. the sliding-tile-attention CUDA extension failed to import. The backend cannot run at all without the native kernel.
Source
Thrown at python/sglang/multimodal_gen/runtime/layers/attention/backends/sliding_tile_attn.py:120
return SlidingTileAttentionMetadata(
current_timestep=current_timestep, STA_param=param[current_timestep]
)
class SlidingTileAttentionImpl(AttentionImpl):
def __init__(
self,
num_heads: int,
head_size: int,
causal: bool,
softmax_scale: float,
num_kv_heads: int | None = None,
prefix: str = "",
**extra_impl_args,
) -> None:
if not st_attn_backend_available:
raise ValueError("st attn not supported")
# TODO(will-refactor): for now this is the mask strategy, but maybe we should
# have a more general config for STA?
mask_strategy_file_path = (
get_global_server_args().attention_backend_config.mask_strategy_file_path
)
if mask_strategy_file_path is None:
raise ValueError("SGLANG_DIFFUSION_ATTENTION_CONFIG is not set")
# TODO(kevin): get mask strategy for different STA modes
with open(mask_strategy_file_path) as f:
mask_strategy = json.load(f)
self.mask_strategy = dict_to_3d_list(mask_strategy)
self.prefix = prefix
sp_group = get_sp_group()
self.sp_size = sp_group.world_size
# STA config
self.STA_base_tile_size = [6, 8, 8]View on GitHub (pinned to 0132848349)
Solutions
- Install/build the sliding-tile-attention extension for your GPU/CUDA
- Check the import-time warning to see why the extension failed to load
- Switch to another attention backend if STA is optional for your model
Example fix
# before python launch.py --attention-backend sliding_tile # ValueError: st attn not supported # after pip install sliding-tile-attention python launch.py --attention-backend sliding_tile
Defensive patterns
Strategy: validation
Validate before calling
from sglang.multimodal_gen.runtime.layers.attention.backends.sliding_tile_attn import st_attn_backend_available
if not st_attn_backend_available:
raise SystemExit("install sliding-tile-attention to use the STA backend") Type guard
def sta_available() -> bool:
try:
import st_attn # noqa
return True
except ImportError:
return False Try / catch
try:
backend = SlidingTileAttentionBackend(...)
except ValueError as e:
if "st attn not supported" in str(e):
backend = FlashAttentionBackend(...) Prevention
- Probe native extension availability at startup
- Build the STA kernel in your serving image
When it happens
Trigger: Constructing SlidingTileAttentionBackend in an environment where the st_attn native package is not installed or failed to load.
Common situations: Using the STA backend without building/installing the sliding-tile-attention kernel; GPU arch unsupported by the extension; container missing the compiled wheel.
Related errors
- SGLANG_DIFFUSION_ATTENTION_CONFIG is not set
- Can not import FA3 in sgl_kernel. Please check your installa
- Cannot find NVIDIA Math-DX (cuBLASDx) headers. Install the `
- Cannot find CUTLASS headers required for JIT compilation. Pl
- FlashAttention-4 CUTE is not available. Install flash-attn-4
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/a1939354da98d94e.
Report an issue: GitHub.