vfdff
June 18, 2025, 1:53am
2
I also try the config in tvm 0.18, but it doesn’t generate any dump files.
export TVM_DUMP_IR=1
export TVM_DUMP_IR_DIR=./ir_dumps
python vector_matmul_add5.5.py
so now I define a dump class ,which need modify test case is not convenience to me.
At the same time, I find it only dump the IR before tir.Filter pass ?
class MyPassInstrument(tvm.instrument.PassInstrument):
def enter_pass_ctx(self):
print("进入 PassContext")
def exit_pass_ctx(self):
print("退出 PassContext")
def should_run(self, mod, info):
print(f"检查是否运行 pass: {info.name}")
return True # 返回 True 表示始终运行该 pass
def run_before_pass(self, mod, pass_info):
if pass_info.name != "tir.RenormalizeSplitPattern":
print(f"\n---- 在 {pass_info.name} 之前 ----")
print("当前 IR 模块(InferType 之前):")
# 打印出当前的 IR 模块内容
print(mod)
def run_after_pass(self, mod, pass_info):
if pass_info.name != "tir.RenormalizeSplitPattern":
print(f"\n---- 在 {pass_info.name} 之后 ----")
print("当前 IR 模块(InferType 之后):")
# 打印出当前的 IR 模块内容
print(mod)
target = "llvm -mcpu=skylake-avx512"
with tvm.transform.PassContext(opt_level=3, instruments=[MyPassInstrument()]):
func = tvm.build(s, [a, b, c, result], target, name="vector_mul_add")