This repository has been archived by the owner on May 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
[Fix][TVMScript] Parse and print tir_vars
of call_tir
properly
#361
Merged
tqchen
merged 1 commit into
tlc-pack:relax
from
MasterJH5574:relax-dev/2023-01-16-call-tir-tir-args
Jan 18, 2023
Merged
[Fix][TVMScript] Parse and print tir_vars
of call_tir
properly
#361
tqchen
merged 1 commit into
tlc-pack:relax
from
MasterJH5574:relax-dev/2023-01-16-call-tir-tir-args
Jan 18, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MasterJH5574
added a commit
to MasterJH5574/tlc-relax
that referenced
this pull request
Jan 16, 2023
YuchenJin
approved these changes
Jan 16, 2023
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!
MasterJH5574
force-pushed
the
relax-dev/2023-01-16-call-tir-tir-args
branch
from
January 16, 2023 20:49
31e4479
to
0b0b893
Compare
spectrometerHBH
referenced
this pull request
in mlc-ai/relax
Jan 16, 2023
* [TIR][Fix] Buffer slicing using index dtype as extent (#13788) [Fix] Buffer slicing using index dtype as extent * [TIR][Fix] IndexDataTypeNormalizer not unwrapping float casting (#13789) * [Fix][TVMScript] Parse and print `tir_vars` of `call_tir` properly (tlc-pack#361) * [Transform] Operator legalizer * Documentation
tqchen
approved these changes
Jan 18, 2023
junrushao
pushed a commit
to junrushao/relax
that referenced
this pull request
Jan 25, 2023
junrushao
pushed a commit
to junrushao/relax
that referenced
this pull request
Jan 26, 2023
MasterJH5574
referenced
this pull request
in mlc-ai/relax
Jan 28, 2023
* [TIR][Fix] Buffer slicing using index dtype as extent (#13788) [Fix] Buffer slicing using index dtype as extent * [TIR][Fix] IndexDataTypeNormalizer not unwrapping float casting (#13789) * [Fix][TVMScript] Parse and print `tir_vars` of `call_tir` properly (tlc-pack#361) * [Transform] Operator legalizer * Documentation
junrushao
pushed a commit
to junrushao/relax
that referenced
this pull request
Jan 29, 2023
MasterJH5574
referenced
this pull request
in mlc-ai/relax
Jan 31, 2023
* [TIR][Fix] Buffer slicing using index dtype as extent (#13788) [Fix] Buffer slicing using index dtype as extent * [TIR][Fix] IndexDataTypeNormalizer not unwrapping float casting (#13789) * [Fix][TVMScript] Parse and print `tir_vars` of `call_tir` properly (tlc-pack#361) * [Transform] Operator legalizer * Documentation
junrushao
pushed a commit
to junrushao/relax
that referenced
this pull request
Feb 5, 2023
junrushao
pushed a commit
to junrushao/relax
that referenced
this pull request
Feb 6, 2023
MasterJH5574
referenced
this pull request
in mlc-ai/relax
Feb 8, 2023
* [TIR][Fix] Buffer slicing using index dtype as extent (#13788) [Fix] Buffer slicing using index dtype as extent * [TIR][Fix] IndexDataTypeNormalizer not unwrapping float casting (#13789) * [Fix][TVMScript] Parse and print `tir_vars` of `call_tir` properly (tlc-pack#361) * [Transform] Operator legalizer * Documentation
junrushao
pushed a commit
that referenced
this pull request
Feb 8, 2023
junrushao
pushed a commit
that referenced
this pull request
Feb 8, 2023
junrushao
pushed a commit
that referenced
this pull request
Feb 8, 2023
junrushao
pushed a commit
that referenced
this pull request
Feb 8, 2023
junrushao
pushed a commit
that referenced
this pull request
Feb 9, 2023
junrushao
pushed a commit
that referenced
this pull request
Feb 9, 2023
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR patches both the TVMScript parser and printer on handling the
tir_vars
parameter ofcall_tir
.When a TIR function contains symbolic shapes, its signature can have trailing TIR vars in the param list. In such cases, when using
call_tir
to call into the TIR function, we should provide the instances of those TIR vars through the paramtir_vars
.tir_vars
is the last parameter ofcall_tir
, one behinddtype
.relax/python/tvm/relax/op/base.py
Lines 45 to 51 in 697675b
The specific issues fixed in this PR is:
call_tir
, the printer always explicitly prints"dtype="
, while doesn’t print"tir_vars="
when there is. This will make the printed script looks likecall_tir
’s handling on TIR vars: the TIR vars will be parsed as a list or a tuple of Python, while on thecall_tir
side the parsed tuple/list will be treated as a Expr and passed to C++ side through FFI. This will incur FFI error likeTherefore, this PR fixes both sides. On printer side, we now print
tir_vars
afterdtype
and explicitly print"tir_vars="
. Oncall_tir
side, we wrap the inputtir_vars
to ShapeExpr if we find it a tuple or list. One regression test that covers both issues is provided.cc @YuchenJin