-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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][TIR] Pretty print TIR LLVM function name #15953
Conversation
aec0876
to
22a08ed
Compare
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.
This has been bugging me for a while, thanks for fixing it @cbalint13! I'm conscious this is still marked as draft, I'd love to take a closer look when you're ready :)
Ready for review. I kept it as Draft, avoiding to "spam" people until all-in green CI status. Adding to Cc: @Lunderberg , @junrushao , @masahi , @vinx13, @quic-sanirudh , @kparzysz-quic |
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.
This has been in my todo list for a while too, so thanks a lot for this. I just mentioned one small comment about using ICHECK in place of assertion, but otherwise it looks good to me.
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.
LGTM!
691822c
to
a85adb8
Compare
d6e0f57
to
300a592
Compare
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.
Thanks
It looks like this changes the underlying IR on the C++ side, which is a wider change than I expected given the name of the PR. Using I like the user-friendliness of this change, and thing it should be implemented on the TVMScript side instead. When printing out a |
300a592
to
13f8fe4
Compare
Thanks a lot for the feedback ! |
13f8fe4
to
af63424
Compare
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.
Thank you for making the changes, and LGTM! If we have more TVM intrinsics that should have custom print methods, we may want to add some per-intrinsic function with signature Array<PrimExpr>(Array<PrimExpr>)
. That way, each TVM intrinsic could mutate the printed arguments prior to printing.
Thanks @lhutton1 , @quic-sanirudh and @Lunderberg ! |
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.
LGTM, Thanks
Thanks @cbalint13 for the great work on this! |
This allows printing of the LLVM function real name in TIR printer.
Prior to this a counter-intuitive T.int32() value was printed instead of the real name.
Changes
Before:
T.call_llvm_pure_intrin("int32x4", T.uint32(62), T.uint32(0))
After:
T.call_llvm_pure_intrin("int32x4", "llvm.donothing", T.uint32(0))
Notes
* This preserves the llvm IR emitter to still accept IntImm along with StringImm argument.* Python tir interface now sends StringImm instead of IntImm making it printing friendly.* There are subarches that still uses IntImm for custom things, those will just keep working fine.* It is not possible to teach the tir-printer instead, CallNode context is lost away at the IntImm handling point.This is part of #15918 .