{"record":{"id":"a1939354da98d94e","repo":"sgl-project/sglang","slug":"st-attn-not-supported","errorCode":null,"errorMessage":"st attn not supported","messagePattern":"st attn not supported","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/layers/attention/backends/sliding_tile_attn.py","lineNumber":120,"sourceCode":"        return SlidingTileAttentionMetadata(\n            current_timestep=current_timestep, STA_param=param[current_timestep]\n        )\n\n\nclass SlidingTileAttentionImpl(AttentionImpl):\n\n    def __init__(\n        self,\n        num_heads: int,\n        head_size: int,\n        causal: bool,\n        softmax_scale: float,\n        num_kv_heads: int | None = None,\n        prefix: str = \"\",\n        **extra_impl_args,\n    ) -> None:\n        if not st_attn_backend_available:\n            raise ValueError(\"st attn not supported\")\n        # TODO(will-refactor): for now this is the mask strategy, but maybe we should\n        # have a more general config for STA?\n        mask_strategy_file_path = (\n            get_global_server_args().attention_backend_config.mask_strategy_file_path\n        )\n        if mask_strategy_file_path is None:\n            raise ValueError(\"SGLANG_DIFFUSION_ATTENTION_CONFIG is not set\")\n\n        # TODO(kevin): get mask strategy for different STA modes\n        with open(mask_strategy_file_path) as f:\n            mask_strategy = json.load(f)\n        self.mask_strategy = dict_to_3d_list(mask_strategy)\n\n        self.prefix = prefix\n        sp_group = get_sp_group()\n        self.sp_size = sp_group.world_size\n        # STA config\n        self.STA_base_tile_size = [6, 8, 8]","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/layers/attention/backends/sliding_tile_attn.py#L102-L138","documentation":"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.","triggerScenarios":"Constructing SlidingTileAttentionBackend in an environment where the st_attn native package is not installed or failed to load.","commonSituations":"Using the STA backend without building/installing the sliding-tile-attention kernel; GPU arch unsupported by the extension; container missing the compiled wheel.","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"],"exampleFix":"# before\npython launch.py --attention-backend sliding_tile   # ValueError: st attn not supported\n# after\npip install sliding-tile-attention\npython launch.py --attention-backend sliding_tile","handlingStrategy":"validation","validationCode":"from sglang.multimodal_gen.runtime.layers.attention.backends.sliding_tile_attn import st_attn_backend_available\nif not st_attn_backend_available:\n    raise SystemExit(\"install sliding-tile-attention to use the STA backend\")","typeGuard":"def sta_available() -> bool:\n    try:\n        import st_attn  # noqa\n        return True\n    except ImportError:\n        return False","tryCatchPattern":"try:\n    backend = SlidingTileAttentionBackend(...)\nexcept ValueError as e:\n    if \"st attn not supported\" in str(e):\n        backend = FlashAttentionBackend(...)","preventionTips":["Probe native extension availability at startup","Build the STA kernel in your serving image"],"tags":["sliding-tile-attention","missing-dependency","native-extension","init"],"backgroundTag":"missing-optional-dependency","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}