Skip to content
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

Make all useful data structures in Glow easy to dump in a textual form #2831

Open
opti-mix opened this issue Apr 30, 2019 · 2 comments
Open

Comments

@opti-mix
Copy link
Contributor

Being able to dump any interesting data structures is very useful for interactive debugging and print debugging.

Currently, many of interesting data structures (e.g. glow::Value) have dump methods. Some others, e.g. glow::Node have getDebugDesc() method, but no dump method. And many interesting data structures don't have any method to dump their content, e.g. glow::Type.

Ideally, it would be nice to have the same uniform way to dump any data structure. LLVM usually uses dump for it.

It is also very useful to be able to get a string representation of the dumped content of any data structure as it allows for including it into a bigger composite output consisting of many different parts.

So, in short it would be nice to have e.g. the following methods for all interesting data structures in Glow:

  • dump(llvm::raw_ostream &os)
  • dump() which just calls dump(llvm::raw_ostream &os) with a default output stream as a parameter
  • std::string toString(), which dumps into string
@superwizard2019
Copy link
Contributor

superwizard2019 commented May 24, 2019

@opti-mix
I've inserted those dump functions to glow::Node and glow::Type at #2969.
Could you list some other useful data structures that require dump functions?

@opti-mix
Copy link
Contributor Author

Could you list some other useful data structures that require dump functions?

Add any missing helper methods (e.g. to produce a string or operator <<) for glow::Module, glow::Fucnction, glow::IRFunction, glow::Value, glow::Instruction and glow::Tensor. These are those most widely used data types in Glow.

In general it would be nice to also be able to dump/print all major runtime data-structures, e.g. ExecutionContext and the like. But all this probably would need to be implemented manually as C++ does not allow for introspection of types defined in the program (at least not without using a lot of macros/templates magic).

superwizard2019 added a commit to superwizard2019/glow that referenced this issue Jun 3, 2019
[Dump information] add dump function for Glow data structure

Summary:
add dump(llvm::raw_ostream &os), dump() and std::string toString() to
data structure glow::Node, glow::Type, glow::Module, glow::Function,
glow::IRFunction, glow::Value and glow::Tensor.

add overloading << operator to those data structures.

Test:
add test under BackendTest, GraphTest, IROptTest and TensorsTest to
verify the dump functions.

Fixes:
This PR fixes pytorch#2831
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants