Skip to content

Commit

Permalink
[inductor][Autotune] Add matrix_instr_nonkdim to triton_meta (#122852)
Browse files Browse the repository at this point in the history
Summary:

Previous work `#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},
  )

Differential Revision: D55456401
  • Loading branch information
htyu authored and facebook-github-bot committed Mar 28, 2024
1 parent 3e7fd45 commit 1bd765c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions torch/_inductor/select_algorithm.py
Expand Up @@ -157,6 +157,10 @@ def jit_lines(self):
triton_meta["configs"] = [config_of(signature)]
for arg_num in triton_meta["configs"][0].equal_to_1: # type: ignore[index]
triton_meta["constants"][arg_num] = 1 # type: ignore[index]
matrix_instr_nonkdim = self.meta.get("matrix_instr_nonkdim", 0)
if matrix_instr_nonkdim != 0:
triton_meta["matrix_instr_nonkdim"] = matrix_instr_nonkdim

self.triton_meta = triton_meta

inductor_meta = {
Expand Down

0 comments on commit 1bd765c

Please sign in to comment.