Skip to content

Commit 2d888d7

Browse files
htyujerrymannil
authored andcommitted
[inductor][Autotune] Add matrix_instr_nonkdim to triton_meta (pytorch#122852)
Summary: Previous work `https://github.com/pytorch/pytorch/pull/120742` to enable `matrix_instr_nonkdim` only dealt with the autotuner benchmarking, but failed to enable the parameter in Triton meta for real runs. `matrix_instr_nonkdim` needs to be visible to the compiler driver to set up the optimization pipeline, so it's unlike other kernel parameters such as `BLOCK_N` that can be just set inside the kernel itself. Test Plan: P1201466917 triton_heuristics.template( num_stages=1, num_warps=4, triton_meta={'signature': {0: '*fp32', 1: '*fp32', 2: '*fp32'}, 'device': 0, 'device_type': 'cuda', 'constants': {}, 'configs': [instance_descriptor(divisible_by_16=(0, 1, 2), equal_to_1=(), ids_of_folded_args=(), divisible_by_8=())], 'matrix_instr_nonkdim': 16}, inductor_meta={'kernel_name': 'triton_tem_fused_mm_0', 'backend_hash': None}, ) Perf : Before: 1.693ms 0.134GB 79.28GB/s After: 1.577ms 0.134GB 85.12GB/s Differential Revision: D55456401 Pull Request resolved: pytorch#122852 Approved by: https://github.com/xw285cornell
1 parent f816fc8 commit 2d888d7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

torch/_inductor/select_algorithm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ def jit_lines(self):
159159
triton_meta["configs"] = [config_of(signature)]
160160
for arg_num in triton_meta["configs"][0].equal_to_1: # type: ignore[index]
161161
triton_meta["constants"][arg_num] = 1 # type: ignore[index]
162+
matrix_instr_nonkdim = self.meta.get("matrix_instr_nonkdim", 0)
163+
if matrix_instr_nonkdim != 0:
164+
triton_meta["matrix_instr_nonkdim"] = matrix_instr_nonkdim
165+
162166
self.triton_meta = triton_meta
163167

164168
inductor_meta = {

0 commit comments

Comments
 (0)