Skip to content

Conversation

@Lunderberg
Copy link
Contributor

When debugging IRModule transformations, it can be useful to know the exact C++ address of an object. For example, to determine whether an undefined TIR variable was caused by erroneous insertion of a new variable, or from failing to remove a previous variable. While TVMScript does de-duplicate all names within a single print statement, there isn't a convenient way to identify which variable in TVMScript corresponds to a specific variable in C++ logging statements.

This commit adds show_object_address to the PrinterConfig. If false (the default), no change is made to the TVMScript variable names. If true, the address of the C++ object is appended to the variable name. For example, printing a tir.Var('my_name','int64') as "my_name_0x1234abcd".

@tvm-bot
Copy link
Collaborator

tvm-bot commented Aug 16, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

Generated by tvm-bot

When debugging IRModule transformations, it can be useful to
know the exact C++ address of an object.  For example, to determine
whether an undefined TIR variable was caused by erroneous insertion of
a new variable, or from failing to remove a previous variable.  While
TVMScript does de-duplicate all names within a single print statement,
there isn't a convenient way to identify which variable in TVMScript
corresponds to a specific variable in C++ logging statements.

This commit adds `show_object_address` to the `PrinterConfig`.  If
false (the default), no change is made to the TVMScript variable
names.  If true, the address of the C++ object is appended to the
variable name.  For example, printing a `tir.Var('my_name','int64')`
as `"my_name_0x1234abcd"`.
@Lunderberg Lunderberg force-pushed the tvmscript_optionally_print_cpp_address branch from a9d3f42 to 3827ac1 Compare August 19, 2023 01:27
The `private=True` branch is only on the unity branch.
@quic-sanirudh quic-sanirudh merged commit 072a5c1 into apache:main Aug 21, 2023
@Lunderberg Lunderberg deleted the tvmscript_optionally_print_cpp_address branch August 21, 2023 15:44
Hzfengsy pushed a commit to Hzfengsy/tvm that referenced this pull request Sep 8, 2023
The new feature of printing object addresses is introduced in apache#15579.
It's an excellent feature for debugging, but it should not be turned on
by default.
junrushao pushed a commit that referenced this pull request Sep 9, 2023
…#15705)

The new feature of printing object addresses is introduced in #15579.
It's an excellent feature for debugging, but it should not be turned on
by default.
junrushao pushed a commit to junrushao/tvm that referenced this pull request Sep 10, 2023
…apache#15705)

The new feature of printing object addresses is introduced in apache#15579.
It's an excellent feature for debugging, but it should not be turned on
by default.
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