[TVMScript][TIR] Pretty print TIR LLVM function name#15953
[TVMScript][TIR] Pretty print TIR LLVM function name#15953ekalda merged 1 commit intoapache:mainfrom
Conversation
aec0876 to
22a08ed
Compare
lhutton1
left a comment
There was a problem hiding this comment.
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 |
quic-sanirudh
left a comment
There was a problem hiding this comment.
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.
691822c to
a85adb8
Compare
d6e0f57 to
300a592
Compare
|
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
Lunderberg
left a comment
There was a problem hiding this comment.
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 ! |
|
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 .