Skip to content

[TVMC] Add configuration tir.add_lower_pass to option --pass-config - #9817

Merged
leandron merged 1 commit into
apache:mainfrom
leeexyz:tvmc_fix
Feb 14, 2022
Merged

leandron merged 1 commit into
apache:mainfrom
leeexyz:tvmc_fix

Conversation

@leeexyz

@leeexyz leeexyz commented Dec 31, 2021

Copy link
Copy Markdown
Contributor

Hi All,

Sometimes, we should manipulate the Passes order or add new Passes not only for Relay Pass but for TIR Pass. the This PR add the configuration tir.add_lower_pass to --pass-config. It supports two types of TIR Pass, one is the built-in pass in TVM and another one is the external customized pass that is loaded by importlib.

Some use cases.

~/project/apache/tvm$ python -m tvm.driver.tvmc compile --target "llvm"  \
                                                   --output resnet50-v2-7-tvm.tar resnet50.onnx \
                                                   --pass-config "tir.add_lower_pass=1,tir.transform.UnrollLoop,2,tir.transform.UnrollLoop" 
{'tir.add_lower_pass': [(1, PrimFuncPass(tir.UnrollLoop, opt_level=0)), (2, PrimFuncPass(tir.UnrollLoop, opt_level=0))]}
~/project/apache/tvm$ python -m tvm.driver.tvmc compile --target "llvm" \
                                                   --output resnet50-v2-7-tvm.tar resnet50.onnx \
                                                   --pass-config "tir.add_lower_pass=1,tir.transform.UnrollLoop,2,tir.transform.UnrollLoop" \
                                                   --pass-config "tir.add_lower_pass=1,tir.transform.UnrollLoop"
{'tir.add_lower_pass': [(1, PrimFuncPass(tir.UnrollLoop, opt_level=0)), (2, PrimFuncPass(tir.UnrollLoop, opt_level=0)), (1, PrimFuncPass(tir.UnrollLoop, opt_level=0))]}

@leandron leandron left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just one remark, and I think we're good to go with this PR.

Comment thread python/tvm/driver/tvmc/common.py Outdated
@leeexyz
leeexyz force-pushed the tvmc_fix branch 2 times, most recently from f7b3c53 to ee7df62 Compare January 7, 2022 15:38
@leeexyz
leeexyz requested a review from leandron January 8, 2022 08:23
@leeexyz

leeexyz commented Jan 13, 2022

Copy link
Copy Markdown
Contributor Author

@leandron Would you mind helping me review again? :)

@leeexyz

leeexyz commented Jan 22, 2022

Copy link
Copy Markdown
Contributor Author

cc @leandron @junrushao1994 @comaniac 😊

@leandron leandron left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@leandron
leandron merged commit ac9bf1f into apache:main Feb 14, 2022
@leandron

Copy link
Copy Markdown
Contributor

Thanks @leeexyz, this is merged now.

ylc pushed a commit to ylc/tvm that referenced this pull request Feb 16, 2022
@leeexyz
leeexyz deleted the tvmc_fix branch March 9, 2022 06:56
pfk-beta pushed a commit to pfk-beta/tvm that referenced this pull request Apr 11, 2022
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.

2 participants