From 576d5664295ad4a6ef7007198e8f6f65878fce6d Mon Sep 17 00:00:00 2001 From: resonantsky Date: Fri, 17 Apr 2026 16:45:38 +0200 Subject: [PATCH 1/2] established rdna2 best configs --- modules/sdnq/triton_mm.py | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/modules/sdnq/triton_mm.py b/modules/sdnq/triton_mm.py index beda09f03..0a78f0b72 100644 --- a/modules/sdnq/triton_mm.py +++ b/modules/sdnq/triton_mm.py @@ -12,16 +12,31 @@ import torch import triton import triton.language as tl +try: + from .common import is_rdna2 +except Exception: + is_rdna2 = False -matmul_configs = [ - triton.Config({'BLOCK_SIZE_M': BM, 'BLOCK_SIZE_N': BN, "BLOCK_SIZE_K": BK, "GROUP_SIZE_M": GM}, num_warps=w, num_stages=s) - for BM in [32, 64, 128, 256] - for BN in [32, 64, 128, 256] - for BK in [32, 64, 128] - for GM in [4, 8] - for w in [4, 8] - for s in [2] -] +if is_rdna2: + matmul_configs = [ + triton.Config({'BLOCK_SIZE_M': BM, 'BLOCK_SIZE_N': BN, "BLOCK_SIZE_K": BK, "GROUP_SIZE_M": GM}, num_warps=w, num_stages=s) + for BM in [64, 128] + for BN in [64, 128] + for BK in [64] + for GM in [2, 4] + for w in [2, 4] + for s in [2] + ] +else: + matmul_configs = [ + triton.Config({'BLOCK_SIZE_M': BM, 'BLOCK_SIZE_N': BN, "BLOCK_SIZE_K": BK, "GROUP_SIZE_M": GM}, num_warps=w, num_stages=s) + for BM in [32, 64, 128, 256] + for BN in [32, 64, 128, 256] + for BK in [32, 64, 128] + for GM in [4, 8] + for w in [4, 8] + for s in [2] + ] @triton.autotune(configs=matmul_configs, key=["M", "N", "K", "stride_bk", "ACCUMULATOR_DTYPE"], cache_results=True) From cefad871b9e1f8491addadf9b1059b2ba74fa976 Mon Sep 17 00:00:00 2001 From: resonantsky Date: Fri, 17 Apr 2026 18:44:24 +0200 Subject: [PATCH 2/2] fix rdna2 variable name: is_rdna2 -> is_rdna2_and_older --- modules/sdnq/triton_mm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/sdnq/triton_mm.py b/modules/sdnq/triton_mm.py index 0a78f0b72..955761e88 100644 --- a/modules/sdnq/triton_mm.py +++ b/modules/sdnq/triton_mm.py @@ -13,11 +13,11 @@ import triton import triton.language as tl try: - from .common import is_rdna2 + from .common import is_rdna2_and_older except Exception: - is_rdna2 = False + is_rdna2_and_older = False -if is_rdna2: +if is_rdna2_and_older: matmul_configs = [ triton.Config({'BLOCK_SIZE_M': BM, 'BLOCK_SIZE_N': BN, "BLOCK_SIZE_K": BK, "GROUP_SIZE_M": GM}, num_warps=w, num_stages=s) for BM in [64, 128]