Skip to content

Commit

Permalink
[CPU] Dump human-readable asm code in TRITON_CACHE_DIR (#19)
Browse files Browse the repository at this point in the history
* [CPU] Dump human-readable asm code in TRITON_CACHE_DIR

* Don't touch the main compiler.py
  • Loading branch information
minjang authored Jun 11, 2024
1 parent 5adb663 commit 38ee9e5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions third_party/cpu/backend/compiler.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import functools
import hashlib
import os
import re

from dataclasses import dataclass
from typing import Any, Tuple
Expand Down Expand Up @@ -141,8 +140,12 @@ def make_llir(src, metadata, options):
@staticmethod
def make_bc(src, metadata, options):
if os.environ.get("TRITON_CPU_ASM_DUMP", "0") == "1":
print("********** Module ASM **********")
print(llvm.translate_to_host_asm(src, options.enable_fp_fusion))
from triton.runtime.cache import get_cache_manager

asm = llvm.translate_to_host_asm(src, options.enable_fp_fusion)
fn_cache_manager = get_cache_manager(metadata['hash'])
fn_cache_manager.put(asm, f"{metadata['name']}.asm")

ret = llvm.translate_to_bc(src)
return ret

Expand Down

0 comments on commit 38ee9e5

Please sign in to comment.