From 84ce7502cf728e8f8f8c3ca45a0dd0103b8bcb02 Mon Sep 17 00:00:00 2001 From: Xiaoyu Zhang <1182563586@qq.com> Date: Wed, 12 Aug 2026 16:25:24 +0800 Subject: [PATCH] [Diffusion][MiniMax H3] Extend exact QKNorm+RoPE rounding to SM103 (#34505) --- .../sglang/kernels/jit/csrc/diffusion/qknorm_rope.cuh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/python/sglang/kernels/jit/csrc/diffusion/qknorm_rope.cuh b/python/sglang/kernels/jit/csrc/diffusion/qknorm_rope.cuh index 7750d1266..1d2774f6f 100644 --- a/python/sglang/kernels/jit/csrc/diffusion/qknorm_rope.cuh +++ b/python/sglang/kernels/jit/csrc/diffusion/qknorm_rope.cuh @@ -55,7 +55,7 @@ SGL_DEVICE CacheDType load_cache_value(const CacheDType* ptr, int64_t idx) { template SGL_DEVICE T rotary_mul_rn(T lhs, T rhs) { -#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 1200 +#if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ == 1030 || __CUDA_ARCH__ >= 1200) uint16_t lhs_bits; uint16_t rhs_bits; if constexpr (std::is_same_v) { @@ -83,9 +83,10 @@ SGL_DEVICE T rotary_mul_rn(T lhs, T rhs) { template SGL_DEVICE T rotary_add(T x, T cos, T y, T sin) { -#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 1200 - // nvcc may contract the packed local expression on SM120 even though the - // reference RoPE kernel rounds both products to the activation dtype first. +#if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ == 1030 || __CUDA_ARCH__ >= 1200) + // nvcc may contract the packed local expression on Blackwell SM103/SM120 + // even though the reference RoPE kernel rounds both products to the + // activation dtype first. const T lhs = rotary_mul_rn(x, cos); const T rhs = rotary_mul_rn(y, sin); uint16_t lhs_bits; @@ -115,7 +116,7 @@ SGL_DEVICE T rotary_add(T x, T cos, T y, T sin) { template SGL_DEVICE T rotary_sub(T x, T cos, T y, T sin) { -#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 1200 +#if defined(__CUDA_ARCH__) && (__CUDA_ARCH__ == 1030 || __CUDA_ARCH__ >= 1200) const T lhs = rotary_mul_rn(x, cos); const T rhs = rotary_mul_rn(y, sin); uint16_t lhs_bits;