From 7045e0fdff67e3a83425dda8fc07be1caa2d9a3c Mon Sep 17 00:00:00 2001 From: Mohammad Miadh Angkad <176301910+mmangkad@users.noreply.github.com> Date: Fri, 10 Jul 2026 18:08:15 +0800 Subject: [PATCH] Seed sgl-kernel topk sigmoid tests on all backends (#30754) --- sgl-kernel/tests/test_moe_topk_sigmoid.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/sgl-kernel/tests/test_moe_topk_sigmoid.py b/sgl-kernel/tests/test_moe_topk_sigmoid.py index e9a9240ee..6b2cba858 100644 --- a/sgl-kernel/tests/test_moe_topk_sigmoid.py +++ b/sgl-kernel/tests/test_moe_topk_sigmoid.py @@ -5,18 +5,14 @@ import pytest import torch from sgl_kernel import topk_sigmoid -_IS_HIP = torch.version.hip is not None - @pytest.fixture(autouse=True) def _deterministic_seed(): - # AMD/ROCm only: pin RNG so torch.randn produces identical gating scores - # across runs. atol=0 indices comparison is otherwise tripped by near-tied - # sigmoid scores where hipCUB's tie-break inside torch.topk disagrees with - # sgl_kernel.topk_sigmoid. Not observed on CUDA, so leave CUDA behavior - # unchanged. - if _IS_HIP: - torch.manual_seed(0) + # Pin RNG on every backend so torch.randn produces identical gating scores + # across runs. The exact index comparison can otherwise be tripped by + # near-tied sigmoid scores whose rounded values have different top-k + # tie-break ordering between torch.topk and sgl_kernel.topk_sigmoid. + torch.manual_seed(0) @pytest.mark.parametrize(