From 984994e3aa15bd11baddbcaddb43983bace94e36 Mon Sep 17 00:00:00 2001 From: Trevor Morris Date: Thu, 24 Sep 2026 10:25:35 -0700 Subject: [PATCH] fix: Triton 3.8 compatbility to support DSV4.1-Flash in CUDA 13.4 image (Rubin) (#40805) --- .../dsv4/decode_attention_sm100_gluon.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/python/sglang/kernels/ops/attention/dsv4/decode_attention_sm100_gluon.py b/python/sglang/kernels/ops/attention/dsv4/decode_attention_sm100_gluon.py index bb45e4834d..afe4617a13 100644 --- a/python/sglang/kernels/ops/attention/dsv4/decode_attention_sm100_gluon.py +++ b/python/sglang/kernels/ops/attention/dsv4/decode_attention_sm100_gluon.py @@ -6,12 +6,28 @@ from triton.experimental.gluon.language.nvidia.blackwell import ( TensorMemoryLayout, allocate_tensor_memory, fence_async_shared, - get_tmem_reg_layout, mbarrier, tcgen05_commit, tcgen05_mma, ) +try: + # Triton 3.7.1 API + from triton.experimental.gluon.language.nvidia.blackwell import get_tmem_reg_layout +except ImportError: + # Triton 3.8 moved this onto the descriptor type (triton-lang/triton#9594) + # TODO(tmorris): After we update to triton 3.8 (torch 2.15), use new API directly + # instead of this compatibility wrapper. + from triton.experimental.gluon.language.nvidia.blackwell import ( + tensor_memory_descriptor_type, + ) + from triton.runtime.jit import constexpr_function + + @constexpr_function + def get_tmem_reg_layout(element_ty, shape, layout, num_warps): + ty = tensor_memory_descriptor_type(element_ty, shape, layout, shape) + return ty.get_reg_layout(num_warps=num_warps) + @gluon.jit def _load_v4(