Skip to content

Support debug info of the compiled model for gdb/lldb#3422

Merged
chentong319 merged 10 commits intoonnx:mainfrom
chentong319:debug
Apr 15, 2026
Merged

Support debug info of the compiled model for gdb/lldb#3422
chentong319 merged 10 commits intoonnx:mainfrom
chentong319:debug

Conversation

@chentong319
Copy link
Copy Markdown
Collaborator

Because llvm changed, an extra pass is needed.
This PR relies on MLIR parser to create the debug information. Future PR may be needed to refine how the file line Location info is propagated in our transformation.

@chentong319 chentong319 requested a review from tungld April 2, 2026 00:23
Copy link
Copy Markdown
Member

@tungld tungld left a comment

Choose a reason for hiding this comment

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

LGTM!

pm.addPass(mlir::createReconcileUnrealizedCastsPass());
pm.addPass(mlir::createCanonicalizerPass());
if (enableDebugInfo)
pm.addPass(mlir::LLVM::createDIScopeForLLVMFuncOpPass());
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In wonder if we can set --preserveMLIR = true if enableDebugInfo here, so that there is no need to specify `--preserveMLIR on the command line.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, We can do that. I am thinking to support preserve at different IR level so that we can debug at onnx, zhigh or krnl level as desired.

@chentong319 chentong319 merged commit 0ddfe98 into onnx:main Apr 15, 2026
6 checks passed
@chentong319 chentong319 deleted the debug branch April 15, 2026 16:56
@jenkins-droid
Copy link
Copy Markdown
Collaborator

Jenkins Linux s390x Build #18704 [push] Support debug info of th... started at 12:57

@jenkins-droid
Copy link
Copy Markdown
Collaborator

Jenkins Linux amd64 Build #18674 [push] Support debug info of th... started at 11:57

@jenkins-droid
Copy link
Copy Markdown
Collaborator

Jenkins Linux s390x Build #18704 [push] Support debug info of th... passed after 1 hr 32 min

@jenkins-droid
Copy link
Copy Markdown
Collaborator

Jenkins Linux amd64 Build #18674 [push] Support debug info of th... passed after 1 hr 39 min

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.

3 participants