Skip to content

Commit

Permalink
make --dump-ir also dump sass (#2460)
Browse files Browse the repository at this point in the history
Summary:
Triton has a `get_sass` utility that disassembles the cubin and gets the sass - in this PR, we try to use `get_sass` when running with `--dump-ir`, if we can find a cubin file.

Pull Request resolved: #2460

Reviewed By: xuzhao9

Differential Revision: D62925358

Pulled By: davidberard98

fbshipit-source-id: 7aa1e66c43222b776c949ced3fdcabcee30fbb21
  • Loading branch information
davidberard98 authored and facebook-github-bot committed Sep 20, 2024
1 parent 9c7aacc commit 46ab2e2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions torchbenchmark/util/triton_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,3 +1155,11 @@ def run_and_capture(self, *args, **kwargs):
ir_dir / f"{fn._name}_{kernel.name}_{input_id}.{ir}", "w"
) as f:
f.write(kernel.asm[ir])
if "cubin" in kernel.asm:
from triton.tools.disasm import get_sass

sass = get_sass(kernel.asm["cubin"])
with open(
ir_dir / f"{fn._name}_{kernel.name}_{input_id}.sass", "w"
) as f:
f.write(sass)

0 comments on commit 46ab2e2

Please sign in to comment.