From 7909bfb076a67c31d407f89212e6143afa4aa05d Mon Sep 17 00:00:00 2001 From: Wing Lian Date: Thu, 5 Jun 2025 09:23:17 -0700 Subject: [PATCH] add manual seed for flaky test_geglu_backward test (#2763) [skip ci] --- tests/e2e/kernels/test_geglu.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/e2e/kernels/test_geglu.py b/tests/e2e/kernels/test_geglu.py index 005a1935d..90403ab4a 100644 --- a/tests/e2e/kernels/test_geglu.py +++ b/tests/e2e/kernels/test_geglu.py @@ -1,7 +1,6 @@ """Tests for GEGLU activation function Triton kernels.""" -# pylint: disable=duplicate-code - +import pytest import torch import torch.nn.functional as F @@ -34,8 +33,14 @@ def test_geglu_forward_values(): assert torch.allclose(triton_out, torch_out, rtol=1e-3) -def test_geglu_backward(): +@pytest.mark.parametrize( + "torch_seed", + [0, 42], +) +def test_geglu_backward(torch_seed): """Test GEGLU backward pass matches PyTorch autograd.""" + torch.manual_seed(torch_seed) + gate = torch.randn(2, 3, 64, device="cuda", requires_grad=True) up = torch.randn(2, 3, 64, device="cuda", requires_grad=True) grad_output = torch.randn(2, 3, 64, device="cuda")