Compiling AscendNPU IR
The bishengir-compile tool can compile AscendNPU IR into a binary file that can be executed on the AI processor.
Compile Options
Common compile options are described as follows.
Option |
Required |
Description |
|---|---|---|
--help |
No |
Displays the help information. |
-o <file> |
No |
Specifies the name and location of the output file. |
--enable-triton-kernel-compile |
No |
Enables Triton-related compile optimization. The input IR must be the MLIR converted using the triton-shared tool. |
--enable-hfusion-compile |
No |
Enables HFusion dialect-level compile optimization. |
--enable-hivm-compile |
Yes |
Enables HIVM dialect-level compile optimization. It is enabled by default. |
--enable-auto-multi-buffer |
No |
Enables automatic ping-pong multi-buffer optimization for the AI processor on-chip buffer. |
Compile Command
During compile, the input.mlir file is compiled and optimized using the HFusion and HIVM dialects to generate the binary file outputFile.o.
The compile command is as follows:
1 | bishengir-compile --enable-hfusion-compile=true --enable-hivm-compile=true input.mlir -o outputFile |