[Perf][gpt-oss] Downgrade triton_kernels to v3.5.1 (#43135)

Signed-off-by: mgoin <mgoin64@gmail.com>
This commit is contained in:
Michael Goin
2026-05-20 14:13:12 -07:00
committed by GitHub
parent 452baa860b
commit 5774aad9c5
3 changed files with 73 additions and 57 deletions
@@ -4,14 +4,14 @@
Tests that triton_kernel_moe_forward correctly applies expert_map
remapping when expert parallelism (EP) is enabled.
Both EP and non-EP paths use topk + make_routing_data. When expert_map
is provided, global expert IDs are remapped to local IDs before building
routing structures.
When expert_map is provided, global expert IDs are remapped to local IDs
via topk + expert_map remap + make_routing_data before building routing
structures, and the expert_map passed downstream to triton_kernel_fused_experts
is None (already applied).
"""
from unittest.mock import MagicMock, patch
import pytest
import torch
@@ -19,20 +19,18 @@ class TestTritonMoeForwardExpertMap:
"""Test that triton_kernel_moe_forward applies expert_map remapping
when expert_map is provided (EP active)."""
@pytest.mark.parametrize("expert_map_present", [False, True])
def test_routing_path_selection(self, expert_map_present):
"""Verify that both EP and non-EP paths use topk + make_routing_data,
and that expert_map remapping is applied when present."""
def test_expert_map_remap(self):
device = "cuda" if torch.cuda.is_available() else "cpu"
mock_expert_map = (
torch.tensor([0, -1, 1, -1], device=device) if expert_map_present else None
)
mock_expert_map = torch.tensor([0, -1, 1, -1], device=device)
from vllm.utils.import_utils import import_triton_kernels
import_triton_kernels()
mock_routing_data = MagicMock()
mock_gather = MagicMock()
mock_scatter = MagicMock()
with (
patch("triton_kernels.topk.topk") as mock_topk,
patch(
@@ -48,14 +46,11 @@ class TestTritonMoeForwardExpertMap:
triton_kernel_moe_forward,
)
mock_routing_data = MagicMock()
mock_gather = MagicMock()
mock_scatter = MagicMock()
sparse_result = MagicMock()
sparse_result.indx = torch.tensor([[0, 2]], dtype=torch.int32)
sparse_result.vals = torch.tensor([[0.6, 0.4]])
mock_topk.return_value = sparse_result
mock_make_routing.return_value = (
mock_routing_data,
mock_gather,
@@ -79,14 +74,10 @@ class TestTritonMoeForwardExpertMap:
expert_map=mock_expert_map,
)
# Both paths use topk + make_routing_data
mock_topk.assert_called_once()
mock_make_routing.assert_called_once()
if expert_map_present:
# expert_map should be None in the fused_experts call
# (already applied)
call_kwargs = mock_fused_experts.call_args
assert call_kwargs[1].get("expert_map") is None or (
len(call_kwargs[0]) > 0
)
# expert_map should be None in the fused_experts call
# (already applied).
call_kwargs = mock_fused_experts.call_args
assert call_kwargs[1].get("expert_map") is None or (len(call_kwargs[0]) > 0)