From fb4a14d8d322807e9da2bc92f5b6bf0eb110e0f1 Mon Sep 17 00:00:00 2001 From: Alexandre Eichenberger Date: Thu, 16 Oct 2025 10:13:34 -0400 Subject: [PATCH] added comment to script and doc Signed-off-by: Alexandre Eichenberger --- docs/DebuggingNumericalError.md | 3 +++ utils/onnx-mlir-print.sh | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/DebuggingNumericalError.md b/docs/DebuggingNumericalError.md index 162d8d4d15..2b5869953d 100644 --- a/docs/DebuggingNumericalError.md +++ b/docs/DebuggingNumericalError.md @@ -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 -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. diff --git a/utils/onnx-mlir-print.sh b/utils/onnx-mlir-print.sh index 689137b735..77fbfe24e9 100755 --- a/utils/onnx-mlir-print.sh +++ b/utils/onnx-mlir-print.sh @@ -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}