[TVMScript] Optionally output the address as part of variable names #15579
+68
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 thePrinterConfig
. 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 atir.Var('my_name','int64')
as"my_name_0x1234abcd"
.