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

[TIR] Add preserve_unit_iters option to blockize/tensorize #13579

Merged
merged 2 commits into from
Dec 9, 2022

Conversation

vinx13
Copy link
Member

@vinx13 vinx13 commented Dec 7, 2022

This PR added an option preserve_unit_iters to blockize and tensorize, which helps to maintain stability of the loop structure during tuning. It also added an option simplify_trivial_iterator to SubspaceDivide, similar to what's already supported in DetectIterMap.

cc @junrushao @spectrometerHBH @masahi

fixed #13517

@tvm-bot
Copy link
Collaborator

tvm-bot commented Dec 7, 2022

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.

Generated by tvm-bot

Copy link
Contributor

@shingjan shingjan left a comment

Choose a reason for hiding this comment

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

Overall LGTM except some nits. Really appreciate @vinx13 for sending out this fix! mobilenet_v2 being blocked on main is a headache.

src/arith/iter_affine_map.cc Show resolved Hide resolved
@@ -427,7 +430,8 @@ Stmt MakeLoopNest(Stmt stmt, const std::vector<const ForNode*>& loops) {
}

BlockRealize BlockizeImpl(const ScheduleState& self, const StmtSRef& loop_sref,
Map<Block, Block>* block_sref_reuse, arith::Analyzer* analyzer) {
bool preserve_unit_iters, Map<Block, Block>* block_sref_reuse,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: put preserve_unit_iters at the end of argument like other functions with preserve_unit_iters introduced.

tests/python/unittest/test_meta_schedule_runner.py Outdated Show resolved Hide resolved
@@ -74,16 +74,16 @@ def vnni_conv2d_nchwc_0(placeholder: T.Buffer[(1, 4, 56, 56, 16), "uint8"], plac
for i0_0, i1_0, i2_0, i3_0, i4_0_0, i0_1, i1_1, i2_1, i3_1, i4_0_1 in T.grid(1, 8, 28, 56, 1, 1, 2, 1, 1, 1):
for i5_0, i6_0, i7_0, i8_0, i9_0_0, i0_2, i1_2, i2_2, i3_2, i4_0_2, i5_1, i6_1, i7_1, i8_1, i9_0_1, i0_3, i1_3, i2_3, i3_3, i4_0_3 in T.grid(1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1):
with T.block("conv2d_NCHWc_int8_o"):
n = T.axis.spatial(1, 0)
n = T.axis.spatial(1, i0_2 + i0_3 + i0_0 + i0_1)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the result of trivial iters being preserved instead of simplified right?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes

@vinx13 vinx13 force-pushed the feat/blockize-preserve-unit-iters branch from 58e99d6 to 28af660 Compare December 8, 2022 19:13
@vinx13 vinx13 force-pushed the feat/blockize-preserve-unit-iters branch from 28af660 to d0ef417 Compare December 8, 2022 19:17
@masahi masahi merged commit 8545297 into apache:main Dec 9, 2022
fzi-peccia pushed a commit to fzi-peccia/tvm that referenced this pull request Mar 27, 2023
)

* [TIR] Add preserve_unit_iters option to blockize/tensorize

* fix
mikeseven pushed a commit to mikeseven/tvm that referenced this pull request Sep 27, 2023
)

* [TIR] Add preserve_unit_iters option to blockize/tensorize

* fix
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.

[Bug] Subgraph in mobilenetv2 failed during tuning
4 participants