算子在线编译选项

功能简介

模型编译时,可以选在线编译算子方式或已编译好的算子二进制文件。

使用方法

设置config时使用下列开关进行配置,“jit_compile”默认值为“auto”,当前仅支持配置为“auto”

import torch_npu
import torchair as tng
config = tng.CompilerConfig()

# 算子在线编译选项配置
config.experimental_config.jit_compile = "auto"
npu_backend = tng.get_npu_backend(compiler_config=config)
...
model = Model()
model = torch.compile(model, backend=npu_backend, dynamic=False)

“auto”参数说明: