From 29274b41c6fc45748877d4fc72e2f79f692dad7e Mon Sep 17 00:00:00 2001 From: Aarne Talman Date: Tue, 20 Oct 2026 22:05:14 +0300 Subject: [PATCH] [Fix] [AMD] activation: Run ReLU2 natively on ROCm (#44198) Signed-off-by: Aarne Talman --- python/sglang/srt/layers/activation.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/sglang/srt/layers/activation.py b/python/sglang/srt/layers/activation.py index d1f277319c..42c1143213 100644 --- a/python/sglang/srt/layers/activation.py +++ b/python/sglang/srt/layers/activation.py @@ -290,6 +290,10 @@ class ReLU2(BaseFusedOp): def forward_cuda(self, x: torch.Tensor) -> torch.Tensor: return relu2(x) + def forward_hip(self, x: torch.Tensor) -> torch.Tensor: + # The JIT relu2 kernel is CUDA-only and not imported on ROCm. + return self.forward_native(x) + class QuickGELU(BaseFusedOp): def forward_native(self, x: torch.Tensor) -> torch.Tensor: