Skip to content

Print out a message when there is a file created to store constant tensors#3413

Open
tungld wants to merge 9 commits intoonnx:mainfrom
tungld:msg-external-constant-file
Open

Print out a message when there is a file created to store constant tensors#3413
tungld wants to merge 9 commits intoonnx:mainfrom
tungld:msg-external-constant-file

Conversation

@tungld
Copy link
Member

@tungld tungld commented Mar 9, 2026

This PR adds code to print out a message when there is a file created to store constant tensors, the message is like this:

[1/6] Mon Mar  9 01:32:02 2026 (0s) Importing ONNX Model to MLIR Module from "model.onnx"
[2/6] Mon Mar  9 01:32:32 2026 (30s) Compiling and Optimizing MLIR Module
Constants in the model exceed the thresholds (single constant <= 1.000000e+00 KB, total constants <= 1.500000e+00 
GB). Stored them in an external file: "test.constants.bin". Make sure to put this file in the same folder as
 the generated model or set OM_CONSTANT_ATH to the folder having this file. For constants-related settings, 
see options --store-constants-to-file, --constants-to-file-single-threshold and --constants-to-file-total-threshold
[3/6] Mon Mar  9 01:44:45 2026 (763s) Translating MLIR Module to LLVM and Generating LLVM Optimized Bitcode
[4/6] Mon Mar  9 01:50:49 2026 (1127s) Generating Object from LLVM Bitcode
[5/6] Mon Mar  9 01:52:01 2026 (1199s) Linking and Generating the Output Shared Library
[6/6] Mon Mar  9 01:52:02 2026 (1200s) Compilation completed. Generated "test.so"

tungld added 9 commits March 8, 2026 23:18
Signed-off-by: Tung D. Le <tung@jp.ibm.com>
Signed-off-by: Tung D. Le <tung@jp.ibm.com>
Signed-off-by: Tung D. Le <tung@jp.ibm.com>
Signed-off-by: Tung D. Le <tung@jp.ibm.com>
Signed-off-by: Tung D. Le <tung@jp.ibm.com>
Signed-off-by: Tung D. Le <tung@jp.ibm.com>
Signed-off-by: Tung D. Le <tung@jp.ibm.com>
Signed-off-by: Tung D. Le <tung@jp.ibm.com>
Signed-off-by: Tung D. Le <tung@jp.ibm.com>
.exec();
} catch (const onnx_mlir::CommandException &error) {
if (Verbose) {
if (VerboseOutput) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix a warning: Verbose is an enum constant. This should be the compile option -v (VerboseOuput).

bool storeConstantsToFile, uint64_t constantsToFileSingleThreshold,
uint64_t constantsToFileTotalThreshold, std::string outputNameNoExt,
bool storeConstantsToFile, float constantsToFileSingleThreshold,
float constantsToFileTotalThreshold, std::string outputNameNoExt,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bug. I fixed it.

}
showCompilePhase("Compilation completed");
std::string completeMsg =
"Compilation completed. Generated \"" + outputNameWithExt + "\"";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Print out the generated .so file's name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant