[jit kernel] support dtype as a cpp template parameter (#16452)

This commit is contained in:
陈一涵
2026-01-08 13:54:33 +08:00
committed by GitHub
parent 41b434a7e6
commit 48b8dcd42e
9 changed files with 91 additions and 28 deletions
+1 -1
View File
@@ -825,7 +825,7 @@ class VisionAttention(nn.Module):
# internvl
if self.qk_normalization:
# jit kernel
if can_use_jit_qk_norm(self.head_size):
if can_use_jit_qk_norm(self.head_size, q.dtype):
# q: [tokens, head, head_size] -> [tokens, embed_dim]
head_dim_for_norm = head * self.head_size
+1 -1
View File
@@ -233,7 +233,7 @@ def apply_qk_norm(
and allow_inplace # TODO(dark): this can be relaxed if needed
and (q_eps == k_eps) # TODO(dark): this can also be relaxed
and not envs.SGLANG_ENABLE_DETERMINISTIC_INFERENCE.get()
and can_use_fused_inplace_qknorm(head_dim)
and can_use_fused_inplace_qknorm(head_dim, q.dtype)
):
fused_inplace_qknorm(
q=q.view(batch_size, -1, head_dim),