Fix torch.compile/dynamo crash with Qwen3 QK-norm in piecewise CUDA g… (#19818)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jia Guo
2026-03-20 03:05:09 -07:00
committed by GitHub
parent c1da420799
commit ec01ef9092

View File

@@ -5,6 +5,8 @@ from typing import TYPE_CHECKING, Optional
import torch
logger = logging.getLogger(__name__)
from sglang.jit_kernel.utils import (
cache_once,
is_arch_support_pdl,
@@ -62,9 +64,9 @@ def _jit_qknorm_across_heads_module(dtype: torch.dtype) -> Module:
)
@torch.compiler.assume_constant_result
@cache_once
def can_use_fused_inplace_qknorm(head_dim: int, dtype: torch.dtype) -> bool:
logger = logging.getLogger(__name__)
if head_dim not in [64, 128, 256, 512, 1024]:
logger.warning(f"Unsupported head_dim={head_dim} for JIT QK-Norm kernel")
return False