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

[TVMScript] Migrate More to TVMScripr Printer #13785

Merged
merged 1 commit into from
Jan 17, 2023

Conversation

junrushao
Copy link
Member

@junrushao junrushao commented Jan 14, 2023

This PR gradually migrates more pieces of the default printing to
TVMScript printer for TIR. Details:

  • Introduced a method AsLegacyRepr which preserves existing
    AsRepr provided by ReprPrinter, so that the legacy behavior
    could be 100% preserved.
  • Introduced Script method to IRModule, PrimFunc, tir.Stmt,
    tir.PrimExpr. The script method exists in python side before,
    and this PR introduced them to C++ to be consistent.
  • Replace TIR's PrettyPrint to operator << that is provided by
    the new ReprPrinter, which outputs in TVMScript format by default.
    PrettyPrint on Relay is all preserved for backward compatibility.

@tvm-bot
Copy link
Collaborator

tvm-bot commented Jan 14, 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.

  • No users to tag found in teams: tvmscript See #10317 for details

Generated by tvm-bot

@junrushao junrushao force-pushed the feature/2023-01-12/tvmscript-coverage branch 10 times, most recently from 3ab4d76 to d02bcf3 Compare January 17, 2023 05:48
@junrushao junrushao marked this pull request as ready for review January 17, 2023 05:53
@junrushao junrushao force-pushed the feature/2023-01-12/tvmscript-coverage branch 2 times, most recently from 4330d6f to 1b13018 Compare January 17, 2023 07:15
This PR gradually migrates more pieces of the default printing to
TVMScript printer for TIR.

This PR gradually migrates more pieces of the default printing to
TVMScript printer for TIR. Details:
- Introduced a method `AsLegacyRepr` which preserves existing
`AsRepr` provided by `ReprPrinter`, so that the legacy behavior
could be 100% preserved.
- Introduced `Script` method to `IRModule`, `PrimFunc`, `tir.Stmt`,
`tir.PrimExpr`. The `script` method exists in python side before,
and this PR introduced them to C++ to be consistent.
- Replace TIR's `PrettyPrint` to `operator <<` that is provided by
the new `ReprPrinter`, which outputs in TVMScript format by default.
`PrettyPrint` on Relay is all preserved for backward compatibility.
@junrushao junrushao force-pushed the feature/2023-01-12/tvmscript-coverage branch from 1b13018 to a3fb7a8 Compare January 17, 2023 18:00
Copy link
Contributor

@MasterJH5574 MasterJH5574 left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the migration. Just a few nits

@@ -69,6 +69,9 @@ class IRDocsifierFunctor {
if ((pf = LookupDispatchTable("", type_index)) != nullptr) {
return (*pf)(obj, args...);
}
LOG(WARNING) << "ObjectFunctor calls un-registered function on type: "
<< runtime::Object::TypeIndex2Key(type_index) << " (token: " << token << ")"
<< ". ObjectType: " << obj->GetTypeKey() << ". Object: " << obj;
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems this warning is duplicate with the ICHECK(false)

Copy link
Member Author

Choose a reason for hiding this comment

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

This is used to provide helpful debug information when there is outer logic that accidentally catches the error being thrown out

Comment on lines +888 to +889
# tvm.testing.main()
test_cache_read_specify_consumer()
Copy link
Contributor

Choose a reason for hiding this comment

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

Please revert this change :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh ooops! Will do in a quick follow-up PR!

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay thanks

@tqchen tqchen merged commit 7e3dc45 into apache:main Jan 17, 2023
comaniac added a commit to awslabs/raf that referenced this pull request Jan 23, 2023
comaniac added a commit to awslabs/raf that referenced this pull request Jan 23, 2023
comaniac added a commit to awslabs/raf that referenced this pull request Jan 23, 2023
* [TVM] Update Submodule

* [Compatible] apache/tvm#13785

* [Compatible] more apache/tvm#13785

Co-authored-by: SubmoduleUpdaterBot <[email protected]>
Co-authored-by: Cody Yu <[email protected]>
fzi-peccia pushed a commit to fzi-peccia/tvm that referenced this pull request Mar 27, 2023
This PR gradually migrates more pieces of the default printing to
TVMScript printer for TIR.

This PR gradually migrates more pieces of the default printing to
TVMScript printer for TIR. Details:
- Introduced a method `AsLegacyRepr` which preserves existing
`AsRepr` provided by `ReprPrinter`, so that the legacy behavior
could be 100% preserved.
- Introduced `Script` method to `IRModule`, `PrimFunc`, `tir.Stmt`,
`tir.PrimExpr`. The `script` method exists in python side before,
and this PR introduced them to C++ to be consistent.
- Replace TIR's `PrettyPrint` to `operator <<` that is provided by
the new `ReprPrinter`, which outputs in TVMScript format by default.
`PrettyPrint` on Relay is all preserved for backward compatibility.
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.

4 participants