Add debug symbols for parsed and compiler pass replaced instructions #4626
Add debug symbols for parsed and compiler pass replaced instructions #4626
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces debug symbol tracking on instructions so provenance (e.g., originating ONNX node names) can be preserved through parsing and compiler transformations, improving debuggability of optimized MIGraphX graphs.
Changes:
- Add per-instruction debug symbol storage and printing support.
- Add module-level debug symbol enabling plus
scoped_debug_symbolsRAII to tag inserted/replaced instructions during passes. - Propagate debug symbols through ONNX parsing and matcher-based compiler passes; add a comprehensive debug-symbol propagation test suite.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
test/debug_symbols_test.cpp |
Adds tests covering symbol propagation across passes, replace paths, and printing. |
src/simplify_algebra.cpp |
Updates a matcher to bind matched instructions into matcher context for symbol propagation. |
src/program.cpp |
Adjusts program equality to use fully-qualified migraphx::to_string. |
src/op/builder/gelu.cpp |
Adds missing reflect to builders for consistency/introspection. |
src/op/builder/clip.cpp |
Adds missing reflect to builders for consistency/introspection. |
src/onnx/onnx_parser.cpp |
Wraps ONNX op lowering in a debug-symbol scope so created instructions inherit node symbols. |
src/onnx/include/migraphx/onnx/onnx_parser.hpp |
Clarifies node_info name is MIGraphX-generated (not ONNX node name). |
src/module.cpp |
Implements debug-symbol enablement, RAII active symbols, and replace-propagation logic. |
src/include/migraphx/module.hpp |
Exposes debug-symbol APIs and declares scoped_debug_symbols. |
src/include/migraphx/matcher.hpp |
Adds matcher-apply scoping so matcher replacements inherit matched instruction symbols. |
src/instruction.cpp |
Implements debug symbol accessors and prints symbols in instruction serialization. |
src/include/migraphx/instruction.hpp |
Adds debug symbol storage and APIs to instruction. |
.gitignore |
Removes build/IDE ignore patterns per PR notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Traverse over ins with empty debug symbols also just in case. Probably will not occur however
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
I think these are related to the |
This reverts commit a9519a5.
| inline std::string | ||
| join_strings(Strings strings, | ||
| const std::string& delim) | ||
| // NOLINTEND(performance-unnecessary-value-param) |
There was a problem hiding this comment.
I wonder why tidy is complaining here. This function hasnt changed.
| mod->add_debug_symbols(ins, {debug_symbol}); | ||
| } | ||
| } | ||
| if(enabled(MIGRAPHX_TRACE_ONNX_PARSER{})) |
There was a problem hiding this comment.
You can likely move this in the above IF
Motivation
Technical Details
use_debug_symbols=true.module::replace_instruction()changes:Other:
build*from gitignore because of op builder directoriesChangelog Category
Add a
CHANGELOG.mdentry for any option other thanNot Applicable