[Perf] Autotune batch invariance triton kernel in blackwell, 33.6% E2E latency reduction (#53649)

Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
Wentao Ye
2026-08-25 15:06:01 -04:00
committed by GitHub
parent e6cc0899b6
commit 384d079697
2 changed files with 85 additions and 2 deletions
@@ -111,7 +111,8 @@ def test_matmul_batch_invariance(dtype):
@skip_unsupported
@pytest.mark.parametrize("m", [8, 32, 256, 2048])
def test_matmul_batch_invariance_across_tuned_m_buckets(m):
@pytest.mark.parametrize("transpose_b", [False, True], ids=["contiguous", "transposed"])
def test_matmul_batch_invariance_across_tuned_m_buckets(m, transpose_b):
# Tuned M buckets must preserve each row's K-reduction order.
capability = (
current_platform.get_device_capability() if current_platform.is_cuda() else None
@@ -124,7 +125,10 @@ def test_matmul_batch_invariance_across_tuned_m_buckets(m):
n = k = 2048
torch.manual_seed(42)
a = torch.rand((m, k), dtype=torch.bfloat16, device=device)
b = torch.rand((k, n), dtype=torch.bfloat16, device=device)
if transpose_b:
b = torch.rand((n, k), dtype=torch.bfloat16, device=device).t()
else:
b = torch.rand((k, n), dtype=torch.bfloat16, device=device)
single_output = matmul_batch_invariant(a[:1], b)
batch_output = matmul_batch_invariant(a, b)