-
Notifications
You must be signed in to change notification settings - Fork 128
Python API debug symbols #4803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Python API debug symbols #4803
Changes from all commits
2e4d205
bb622af
277ff30
432ed83
c2381cb
b00e7e2
1517438
b8e1cdb
ec7487e
f499489
8324d9b
c9f567f
e66c848
42eaac8
a769c11
7321509
2794a66
69c787a
d90382c
107a7e7
f9bb2c8
3d3bc42
66b0a2f
3cff180
b3c8a1c
5830120
f3e9709
593fc75
fbdd1e8
4e1cee9
dadc312
9a32dc4
7476ccf
bd1997a
573ee7f
8e8993d
0336f6d
2788196
0c7506b
95a5d9e
80f3e47
3f6e1a7
c148ea6
e2ea3ae
6c0f142
ac24118
821aab6
3ba71ec
cfe37d6
a5c6706
cb0a3e8
2a0365b
19f6165
7a4b3f4
287b79b
3f1ec9d
508f29b
162c811
acffe7e
5e459d8
3e014fb
3393535
4117546
bb471fb
4a1469b
abfa3d2
0abea08
6b3cce7
5162ceb
a2a4bed
3805cab
b5e6816
6671be0
4b7c5ac
caa2a98
4fb59f0
b95aff8
8b6053e
dfd5f69
716033c
1e237d5
bfa594f
60143f7
7c266dd
6a3ae3c
17d3f1d
56ce83a
6394aae
d99b547
ee4aa21
2874c28
115f111
2feea9b
9d8f0cf
851e5ea
3eea60c
9b2f759
fc3850c
58dfa49
17d4595
e5b2009
e710cf6
ce9d36c
a9519a5
14cb668
f0f5b78
b758300
3f69f9b
fe15f32
57e649b
801bf36
31fd8c1
40e8e99
8c9599a
78445f8
836cf4d
ab03d6d
b6c35dc
930d480
6681273
a99ab17
0a11c12
f4a960b
9fae5c4
7055913
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,3 @@ ignore: | |
| - "test/" | ||
| - "src/driver" | ||
| - "build/" | ||
| - "src/netron_output.cpp" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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> | ||
|
|
||
|
|
@@ -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
|
||
| } | ||
|
|
||
| static void print_module(const module& m) { std::cout << m << std::endl; } | ||
|
|
||
| static migraphx::instruction_ref add_allocation(module& m, const migraphx::shape& s) | ||
|
|
@@ -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_([&] { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we adding this to the C++ API?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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()); | ||
|
|
||
| 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 | ||
|
|
@@ -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
|
||
|
|
||
| } // namespace MIGRAPHX_INLINE_NS | ||
| } // namespace migraphx | ||
|
|
||
There was a problem hiding this comment.
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".