Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
2e4d205
progress
CharlieL7 Jan 13, 2026
bb622af
dd
CharlieL7 Feb 18, 2026
277ff30
Merge branch 'develop' of github.com:ROCm/AMDMIGraphX into ins_debug_…
CharlieL7 Feb 18, 2026
432ed83
Add onnx_parser and module changes
CharlieL7 Feb 18, 2026
c2381cb
Change to use a set of debug_symbols when inserting ins
CharlieL7 Feb 18, 2026
b00e7e2
Incomplete first parse design
CharlieL7 Feb 19, 2026
1517438
Version 2 using scoped debug symbols in module
CharlieL7 Feb 19, 2026
b8e1cdb
Cleanup
CharlieL7 Feb 19, 2026
ec7487e
cleanup 2
CharlieL7 Feb 19, 2026
f499489
Formatting
CharlieL7 Feb 19, 2026
8324d9b
Add debug propagate with matcher context
CharlieL7 Feb 20, 2026
c9f567f
formatting
CharlieL7 Feb 20, 2026
e66c848
tests and fixup
CharlieL7 Feb 20, 2026
42eaac8
Merge branch 'develop' of github.com:ROCm/AMDMIGraphX into ins_debug_…
CharlieL7 Feb 20, 2026
a769c11
Add docs changes
CharlieL7 Feb 20, 2026
7321509
Have gather_replace_debug_symbols traverse empty
CharlieL7 Feb 20, 2026
2794a66
Copilot suggestions
CharlieL7 Feb 20, 2026
69c787a
more copilot
CharlieL7 Feb 20, 2026
d90382c
Update CHANGELOG.md
CharlieL7 Feb 20, 2026
107a7e7
Update src/module.cpp
CharlieL7 Feb 20, 2026
f9bb2c8
Revert matcher.hpp
CharlieL7 Feb 23, 2026
3d3bc42
Revert env_var doc
CharlieL7 Feb 23, 2026
66b0a2f
Review progress
CharlieL7 Feb 23, 2026
3cff180
Merge branch 'ins_debug_symbols' of github.com:ROCm/AMDMIGraphX into …
CharlieL7 Feb 23, 2026
b3c8a1c
Module tracking number of instructions with debug_symbols
CharlieL7 Feb 24, 2026
5830120
Cleanup
CharlieL7 Feb 24, 2026
f3e9709
Merge branch 'develop' of github.com:ROCm/AMDMIGraphX into ins_debug_…
CharlieL7 Feb 24, 2026
593fc75
Revert simplify_algebra
CharlieL7 Feb 24, 2026
fbdd1e8
Fix implementation and tests
CharlieL7 Mar 3, 2026
4e1cee9
splice fix and add gemm->add->add test
CharlieL7 Mar 4, 2026
dadc312
Refine the set difference algo and tests
CharlieL7 Mar 4, 2026
9a32dc4
Formatting
CharlieL7 Mar 4, 2026
7476ccf
Merge branch 'develop' of github.com:ROCm/AMDMIGraphX into ins_debug_…
CharlieL7 Mar 4, 2026
bd1997a
Formatting
CharlieL7 Mar 4, 2026
573ee7f
Update program serialization and fix EXPECT dangling ref
CharlieL7 Mar 4, 2026
8e8993d
Formatting
CharlieL7 Mar 4, 2026
0336f6d
Undo serialization changes for another PR
CharlieL7 Mar 4, 2026
2788196
Add more tests directly calling module::replace_ins
CharlieL7 Mar 4, 2026
0c7506b
Add onnx parse tests
CharlieL7 Mar 4, 2026
95a5d9e
Tidy fixes
CharlieL7 Mar 5, 2026
80f3e47
Licensing
CharlieL7 Mar 5, 2026
3f6e1a7
formatting
CharlieL7 Mar 5, 2026
c148ea6
Merge branch 'develop' of github.com:ROCm/AMDMIGraphX into ins_debug_…
CharlieL7 Mar 5, 2026
e2ea3ae
parser get_added_instructions only if used
CharlieL7 Mar 5, 2026
6c0f142
Fixes
CharlieL7 Mar 5, 2026
ac24118
more copilot fixes
CharlieL7 Mar 5, 2026
821aab6
Cleanup env
CharlieL7 Mar 6, 2026
3ba71ec
Add notify
CharlieL7 Mar 6, 2026
cfe37d6
Module const func
CharlieL7 Mar 6, 2026
a5c6706
Update gitignore
CharlieL7 Mar 6, 2026
cb0a3e8
formatting again
CharlieL7 Mar 6, 2026
2a0365b
join_strings to use const ref instead
CharlieL7 Mar 9, 2026
19f6165
Comment formatting
CharlieL7 Mar 9, 2026
7a4b3f4
Remove redunant test
CharlieL7 Mar 9, 2026
287b79b
More tests
CharlieL7 Mar 9, 2026
3f1ec9d
Add tests for module::remove_instruction changes
CharlieL7 Mar 10, 2026
508f29b
Merge branch 'develop' of github.com:ROCm/AMDMIGraphX into ins_debug_…
CharlieL7 Mar 10, 2026
162c811
Add debug symbols to MXR
CharlieL7 Mar 10, 2026
acffe7e
Tidy fix
CharlieL7 Mar 10, 2026
5e459d8
Merge branch 'ins_debug_symbols' of github.com:ROCm/AMDMIGraphX into …
CharlieL7 Mar 10, 2026
3e014fb
Revert stringutils change
CharlieL7 Mar 10, 2026
3393535
Revert properly
CharlieL7 Mar 10, 2026
4117546
Merge branch 'ins_debug_symbols' of github.com:ROCm/AMDMIGraphX into …
CharlieL7 Mar 10, 2026
bb471fb
Prototype version with commented out new reaches code
CharlieL7 Mar 11, 2026
4a1469b
Optimize the DFS calls
CharlieL7 Mar 12, 2026
abfa3d2
Commented out code cleanup
CharlieL7 Mar 12, 2026
0abea08
Fix serialization
CharlieL7 Mar 12, 2026
6b3cce7
Formatting
CharlieL7 Mar 12, 2026
5162ceb
Tidy fix
CharlieL7 Mar 12, 2026
a2a4bed
revert test.hpp changes
CharlieL7 Mar 16, 2026
3805cab
Replace instruction refactor
CharlieL7 Mar 18, 2026
b5e6816
revert instruction::reaches changes
CharlieL7 Mar 18, 2026
6671be0
Edit debug symbols print
CharlieL7 Mar 18, 2026
4b7c5ac
Revert op builder changes
CharlieL7 Mar 18, 2026
caa2a98
Edit .build*/ to .build/
CharlieL7 Mar 18, 2026
4fb59f0
Keep only build* fix
CharlieL7 Mar 23, 2026
b95aff8
Fix op_builders error
CharlieL7 Mar 23, 2026
8b6053e
Cleanup
CharlieL7 Mar 23, 2026
dfd5f69
Revert gitignore
CharlieL7 Mar 23, 2026
716033c
add tests and tidy
CharlieL7 Mar 23, 2026
1e237d5
Comment update
CharlieL7 Mar 24, 2026
bfa594f
formatting
CharlieL7 Mar 24, 2026
60143f7
copilot fixes
CharlieL7 Mar 24, 2026
7c266dd
Merge branch 'develop' of github.com:ROCm/AMDMIGraphX into ins_debug_…
CharlieL7 Mar 24, 2026
6a3ae3c
copilot review updates
CharlieL7 Mar 24, 2026
17d3f1d
licensing
CharlieL7 Mar 24, 2026
56ce83a
Formatting
CharlieL7 Mar 24, 2026
6394aae
Update to use protobuff to more resemble ONNX file
CharlieL7 Mar 24, 2026
d99b547
Merge branch 'ins_debug_symbols' of github.com:ROCm/AMDMIGraphX into …
CharlieL7 Mar 24, 2026
ee4aa21
cleanup
CharlieL7 Mar 24, 2026
2874c28
Add netron output to APIs
CharlieL7 Mar 24, 2026
115f111
Fix bug with replace_instruction debug symbols that have no inputs
CharlieL7 Mar 24, 2026
2feea9b
Merge branch 'ins_debug_symbols' of github.com:ROCm/AMDMIGraphX into …
CharlieL7 Mar 24, 2026
9d8f0cf
Remove print
CharlieL7 Mar 24, 2026
851e5ea
Merge branch 'ins_debug_symbols' of github.com:ROCm/AMDMIGraphX into …
CharlieL7 Mar 24, 2026
3eea60c
Move and change tests
CharlieL7 Mar 25, 2026
9b2f759
Update API to set onnx_options use_debug_symbols
CharlieL7 Mar 26, 2026
fc3850c
Merge branch 'develop' of github.com:ROCm/AMDMIGraphX into ins_debug_…
CharlieL7 Mar 26, 2026
58dfa49
Add debug symbols
CharlieL7 Mar 27, 2026
17d4595
Review comments
CharlieL7 Mar 27, 2026
e5b2009
Formatting
CharlieL7 Mar 27, 2026
e710cf6
License
CharlieL7 Mar 27, 2026
ce9d36c
Add tidy const to header
CharlieL7 Mar 30, 2026
a9519a5
Add debug symbols interface to api
CharlieL7 Apr 1, 2026
14cb668
Revert "Add debug symbols interface to api"
CharlieL7 Apr 1, 2026
f0f5b78
clean up const-ness
CharlieL7 Apr 1, 2026
b758300
Add to api
CharlieL7 Apr 1, 2026
3f69f9b
Merge branch 'develop' of github.com:ROCm/AMDMIGraphX into netron_out…
CharlieL7 Apr 13, 2026
fe15f32
Fix merge conflicts leftover
CharlieL7 Apr 13, 2026
57e649b
Resolve conflict markers
CharlieL7 Apr 14, 2026
801bf36
Make program ir version static constexpr
CharlieL7 Apr 14, 2026
31fd8c1
netron output only main module
CharlieL7 Apr 14, 2026
40e8e99
api check output stream
CharlieL7 Apr 14, 2026
8c9599a
Remove raw_data entry
CharlieL7 Apr 14, 2026
78445f8
Licensing
CharlieL7 Apr 14, 2026
836cf4d
Add ostream checking for python api
CharlieL7 Apr 14, 2026
ab03d6d
remove typos
CharlieL7 Apr 14, 2026
b6c35dc
Update tests to have ONNX protobuff expected value
CharlieL7 Apr 14, 2026
930d480
license
CharlieL7 Apr 17, 2026
6681273
formatting
CharlieL7 Apr 17, 2026
a99ab17
add changelog
CharlieL7 Apr 17, 2026
0a11c12
Merge branch 'netron_output_update' of github.com:ROCm/AMDMIGraphX in…
CharlieL7 Apr 17, 2026
f4a960b
Merge branch 'develop' of github.com:ROCm/AMDMIGraphX into python_api…
CharlieL7 Apr 20, 2026
9fae5c4
Merge branch 'netron_output_update' of github.com:ROCm/AMDMIGraphX in…
CharlieL7 Apr 20, 2026
7055913
Add tests and pybind funcs
CharlieL7 Apr 20, 2026
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Full documentation for MIGraphX is available at
* Updated `argmin` and `argmax` ops to be implemented as reduction ops, so they now have JIT support and can fuse (#4620).
* Replaced usages of `std::cout` and `std::cerr` with the logger (#4732)
* Converted RNN variable sequence length operations (`rnn_var_sl_shift_sequence`, `rnn_var_sl_shift_output`, `rnn_var_sl_last_output`) from device implementation to JIT compilation (#4755).
* Updated netron output to create an ONNX-like protobuff. Now also includes debug symbols if enabled. (#4701)
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

The changelog entry says "protobuff"; the correct term is "protobuf".

Suggested change
* Updated netron output to create an ONNX-like protobuff. Now also includes debug symbols if enabled. (#4701)
* Updated netron output to create an ONNX-like protobuf. Now also includes debug symbols if enabled. (#4701)

Copilot uses AI. Check for mistakes.
Comment thread
CharlieL7 marked this conversation as resolved.

### Resolved issues

Expand Down
1 change: 0 additions & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ ignore:
- "test/"
- "src/driver"
- "build/"
- "src/netron_output.cpp"
2 changes: 1 addition & 1 deletion docs/driver/read.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Print out program as json.

.. option:: --netron

Print out program as a Netron viewable json file.
Print out program as ONNX protobuf binary viewable in Netron.

.. option:: --text

Expand Down
2 changes: 1 addition & 1 deletion docs/migraphx-driver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ To learn which options can be used with which commands, see the :ref:`MIGraphX d
* - --binary
- Prints the program in binary format
* - --netron
- Prints the program in Netron viewable JSON format
- Prints the program as ONNX protobuf binary viewable in Netron
* - --output | -o
- Writes output in a file
* - --fill0
Expand Down
1 change: 0 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ add_library(migraphx
memory_coloring.cpp
module.cpp
msgpack.cpp
netron_output.cpp
normalize_attributes.cpp
normalize_ops.cpp
op_enums.cpp
Expand Down
22 changes: 22 additions & 0 deletions src/api/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
#include <migraphx/json.hpp>
#include <migraphx/convert_to_json.hpp>
#include <migraphx/source_location.hpp>
#include <migraphx/netron_output.hpp>
#include <array>
#include <fstream>
#include <algorithm>
#include <cstdarg>

Expand Down Expand Up @@ -337,6 +339,15 @@ static std::vector<shape> get_output_shapes(program& p) { return p.get_output_sh

static void print_program(const program& p) { std::cout << p << std::endl; }

static void write_netron_output_file(const program& p, const char* filename)
{
std::ofstream os(filename, std::ios::binary);
if(not os.is_open())
MIGRAPHX_THROW(migraphx_status_bad_param,
"Failed to open file for writing: " + std::string(filename));
write_netron_output(p, os);
Comment on lines +342 to +348
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

write_netron_output_file constructs std::ofstream and later builds std::string(filename) without validating filename. If the C API is called with a null pointer, this is undefined behavior and can crash before returning a status. Add an explicit filename == nullptr (and ideally empty-string) check and throw migraphx_status_bad_param before using it.

Copilot uses AI. Check for mistakes.
}

static void print_module(const module& m) { std::cout << m << std::endl; }

static migraphx::instruction_ref add_allocation(module& m, const migraphx::shape& s)
Expand Down Expand Up @@ -1756,6 +1767,17 @@ extern "C" migraphx_status migraphx_program_print(const_migraphx_program_t progr
return api_error_result;
}

extern "C" migraphx_status migraphx_program_write_netron_output(const_migraphx_program_t program,
const char* filename)
{
auto api_error_result = migraphx::try_([&] {
if(program == nullptr)
MIGRAPHX_THROW(migraphx_status_bad_param, "Bad parameter program: Null pointer");
migraphx::write_netron_output_file((program->object), (filename));
});
return api_error_result;
}

extern "C" migraphx_status migraphx_program_sort(migraphx_program_t program)
{
auto api_error_result = migraphx::try_([&] {
Expand Down
3 changes: 3 additions & 0 deletions src/api/include/migraphx/migraphx.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@ MIGRAPHX_C_EXPORT migraphx_status migraphx_program_get_output_shapes(migraphx_sh

MIGRAPHX_C_EXPORT migraphx_status migraphx_program_print(const_migraphx_program_t program);

MIGRAPHX_C_EXPORT migraphx_status
migraphx_program_write_netron_output(const_migraphx_program_t program, const char* filename);

MIGRAPHX_C_EXPORT migraphx_status migraphx_program_sort(migraphx_program_t program);

MIGRAPHX_C_EXPORT migraphx_status migraphx_program_run(migraphx_arguments_t* out,
Expand Down
5 changes: 5 additions & 0 deletions src/api/include/migraphx/migraphx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,11 @@ struct program : MIGRAPHX_HANDLE_BASE(program)

void print() const { call(&migraphx_program_print, this->get_handle_ptr()); }

void write_netron_output(const char* filename) const
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why are we adding this to the C++ API?

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.

This is from #4701. There wasn't a way to write out as ONNX-like protobuff from the C++ API before, only the driver.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is #4701 in this PR? The python API debug symbols are not related to this.

{
call(&migraphx_program_write_netron_output, this->get_handle_ptr(), filename);
}

program sort()
{
call(&migraphx_program_sort, this->get_handle_ptr());
Expand Down
19 changes: 18 additions & 1 deletion src/api/migraphx.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ def shapes(h):

@api.handle('migraphx_instruction', 'migraphx::instruction_ref')
def instruction(h):
pass
h.method('get_debug_symbols',
fname='get_debug_symbols',
returns='const std::set<std::string>&',
const=True)


@api.handle('migraphx_instructions', 'std::vector<migraphx::instruction_ref>')
Expand Down Expand Up @@ -265,6 +268,16 @@ def module(h):
api.params(s='const migraphx::shape&'),
invoke='migraphx::add_allocation($@)',
returns='migraphx::instruction_ref')
h.method('has_debug_symbols',
fname='has_debug_symbols',
returns='bool',
const=True)
h.method('add_debug_symbols',
api.params(ins='migraphx::instruction_ref', symbols='std::set<std::string>'),
fname='add_debug_symbols')
h.method('remove_debug_symbols',
api.params(ins='migraphx::instruction_ref'),
fname='remove_debug_symbols')


@auto_handle()
Expand All @@ -284,6 +297,10 @@ def program(h):
invoke='migraphx::get_output_shapes($@)',
returns='std::vector<migraphx::shape>')
h.method('print', invoke='migraphx::print_program($@)', const=True)
h.method('write_netron_output',
api.params(filename='const char*'),
invoke='migraphx::write_netron_output_file($@)',
const=True)
h.method('sort')
h.method('run',
api.params(
Expand Down
4 changes: 2 additions & 2 deletions src/driver/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ struct loader
ap.set_value("binary"));
ap(output_type,
{"--netron"},
ap.help("Print out program as Netron readable json."),
ap.help("Print out program as ONNX protobuf binary viewable in Netron."),
ap.set_value("netron"));
ap(output, {"--output", "-o"}, ap.help("Output to file."));
}
Expand Down Expand Up @@ -543,7 +543,7 @@ struct loader
else if(type == "binary")
write(*os, save_buffer(p));
else if(type == "netron")
*os << make_netron_output(p) << std::endl;
write_netron_output(p, *os);
}
};

Expand Down
7 changes: 4 additions & 3 deletions src/include/migraphx/netron_output.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand All @@ -24,14 +24,15 @@
#ifndef MIGRAPHX_GUARD_RTGLIB_NETRON_OUTPUT_HPP
#define MIGRAPHX_GUARD_RTGLIB_NETRON_OUTPUT_HPP

#include <string>
#include <ostream>
#include <migraphx/config.hpp>
#include <migraphx/program.hpp>
#include <migraphx/onnx/export.h>

namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {

MIGRAPHX_EXPORT std::string make_netron_output(const program& prog);
MIGRAPHX_ONNX_EXPORT void write_netron_output(const program& prog, std::ostream& os);
Comment on lines +27 to +35
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

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

This header replaces the existing make_netron_output(const program&) -> std::string API with write_netron_output(program, ostream), which is a breaking change for C++ consumers. Consider keeping make_netron_output as a compatibility wrapper (e.g., implemented via std::ostringstream + write_netron_output) and/or deprecating it instead of removing it outright.

Copilot uses AI. Check for mistakes.

} // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx
Expand Down
8 changes: 7 additions & 1 deletion src/include/migraphx/program.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2025 Advanced Micro Devices, Inc. All rights reserved.
* Copyright (c) 2015-2026 Advanced Micro Devices, Inc. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -56,6 +56,7 @@ struct marker;
*/
struct MIGRAPHX_EXPORT program
{

program();

explicit program(module m);
Expand All @@ -79,6 +80,8 @@ struct MIGRAPHX_EXPORT program

std::unordered_map<std::string, shape> get_parameter_shapes() const;

int get_program_file_version() const;

std::size_t total_instructions() const;

std::vector<argument> eval(const parameter_map& params,
Expand Down Expand Up @@ -165,6 +168,9 @@ struct MIGRAPHX_EXPORT program
private:
void assign(const program& p);
std::unique_ptr<program_impl> impl;
// program file version is for the data structure or format of the MXR file. Version should be bumped
// if any changes occur to the format of the MXR file.
static constexpr int program_file_version = 8;
Comment thread
eddieliao marked this conversation as resolved.
};
} // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx
Expand Down
Loading
Loading