Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/DebuggingNumericalError.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ Full options are listed under the `--help` flag.

To gain more insight in what the compiler is doing, you may want to print the output of the compiler after each transformation pass. The flags are well documented in the `mlir` literature, and we have written a script that automatically add such flags by using a custom script.
This script is found here `utils/onnx-mlir-print.sh`, and it is used by adding all desired compiler option, plus one last argument indicating the file in which to save the log of the compiler output.
Note that this script will list by default all of the compiler passes, regardless of whether they changed anything or not.
If you want to limit the output to passes that changed the IR, please manually add the `--mlir-print-ir-after-change` flag when invoking `onnx-mlir-print.sh` script.


That compiler log may typically have 10-100 passes. We have a tool to isolate a given pass. Use `utils/IsolatePass.py -m <log-file-name> -l` to list the name of all of these passes. You can then decide to investigate the compiler output of a given pass.
For example, if interested in the transformation of ONNX to Krnl dialect, you can add the `-p "convert-onnx-to-krnl"` option, where the `convert-onnx-to-krnl` is the name of the actual pass. The `-p` option just take a regex matching a pass as listed with the `-l` option. Alternatively, option `-n 34` will isolate the 34th pass as listed with the `-l` option.
Expand Down
6 changes: 5 additions & 1 deletion utils/onnx-mlir-print.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
# Usage:
#
# All but last arguments are mlir arguments; last one is log file name.
#
# Note: if a user only want to see passes listed if something happened during
# that pass, user should add "--mlir-print-ir-after-change" to the list of
# onnx-mlir options. It is not added by default

onnx-mlir-truncate.sh ${@:1:$#-1} -mlir-print-ir-after-all ${@: -1}
onnx-mlir-truncate.sh ${@:1:$#-1} --mlir-print-ir-after-all ${@: -1}

Loading