From 7ff3a112846a3fcc12a27bba09d644885a226e4d Mon Sep 17 00:00:00 2001 From: Chunan Zeng Date: Tue, 13 Oct 2026 00:18:05 -0700 Subject: [PATCH] [Perf] Enable fast-math for JIT activations on Blackwell (#43236) Co-authored-by: Claude Opus 5.5 --- python/sglang/kernels/jit/utils/arch.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/python/sglang/kernels/jit/utils/arch.py b/python/sglang/kernels/jit/utils/arch.py index 4183ab9f36..7091d1790b 100644 --- a/python/sglang/kernels/jit/utils/arch.py +++ b/python/sglang/kernels/jit/utils/arch.py @@ -18,6 +18,7 @@ from sglang.kernels.jit.utils.common import ( is_hip_runtime, is_musa_runtime, ) +from sglang.srt.utils.common import is_cuda logger = logging.getLogger(__name__) @@ -182,8 +183,6 @@ def is_arch_support_pdl() -> bool: def get_activation_cuda_cflags() -> list[str]: - """Match the AOT activation fast-math policy without changing other kernels.""" - # Blackwell needs precise expf; HIP clang rejects --use_fast_math. - if is_hip_runtime() or get_jit_cuda_arch().major >= 10: - return [] - return ["--use_fast_math"] + if is_cuda(): + return ["--use_fast_math"] + return []