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] Make loop unrolling in LoopPartition optional #6823

Merged
merged 7 commits into from
Nov 6, 2020

Conversation

mbaret
Copy link
Contributor

@mbaret mbaret commented Nov 2, 2020

For certain analysis/tensorization, it can be useful to keep the loop structure when partitioning loops. The current behaviour removes For loops of length 1. This change introduces the option to preserve these loops with the 'unroll' flag.

For certain analysis/tensorization, it can be useful
to keep the loop structure when partitioning loops.
The current behaviour removes For loops of length 1.
This change introduces the option to preserve these
loops with the 'unroll' flag.

Change-Id: I9a9fea171c2d1f70b466b37da17e1610c04df2dc
Change-Id: I319301d38e59948d786f3588cc125a9a5c1d4da3
Change-Id: I09116a4e32008ded16c32a3a13a9a4740a44c095
Change-Id: Iad5c9baa8ba48b69db500dcc30faf895eaec2508
Change-Id: Ied48064fe986e4eba43a7cb10fc2c1bd2f28d06c
@mbaret
Copy link
Contributor Author

mbaret commented Nov 3, 2020

cc @tqchen

Copy link
Contributor

@ANSHUMAN87 ANSHUMAN87 left a comment

Choose a reason for hiding this comment

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

Please find some high level comments.
Could you please share if it is possible, in which scenario you need to preserve the single iter loops ?

@ANSHUMAN87
Copy link
Contributor

Also cc @MarisaKirisame !

Change-Id: If1b336eb27da0a728cc99034a362bf86391abd28
@mbaret
Copy link
Contributor Author

mbaret commented Nov 6, 2020

In terms of why I need this, I want to do some pattern matching on loops to determine if they correspond to a particular operation. This is made a lot more consistent if loops of extent 1 aren't dropped from the IR.

@tqchen
Copy link
Member

tqchen commented Nov 6, 2020

Thanks @mbaret I understand where you are coming from. Ideally we would also like to develop tools to be able to detect patterns that also removes these trivial loops. But we can tackle that later

Change-Id: Idcd28eb1d750e057a7ec48be3546e0581efe7c33
@ANSHUMAN87
Copy link
Contributor

In terms of why I need this, I want to do some pattern matching on loops to determine if they correspond to a particular operation. This is made a lot more consistent if loops of extent 1 aren't dropped from the IR.

Thanks @mbaret , i got your point and concur in case of pattern matching. Also I totally support the idea of having more control over optimization techniques :)

Copy link
Contributor

@ANSHUMAN87 ANSHUMAN87 left a comment

Choose a reason for hiding this comment

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

LGTM provided CI is totally green this time 🙂

Copy link
Contributor

@giuseros giuseros left a comment

Choose a reason for hiding this comment

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

Thank for addressing my comments! LGTM

@tqchen tqchen merged commit 6d71a32 into apache:main Nov 6, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 2, 2020
* [TIR] Make loop unrolling in LoopPartition optional

For certain analysis/tensorization, it can be useful
to keep the loop structure when partitioning loops.
The current behaviour removes For loops of length 1.
This change introduces the option to preserve these
loops with the 'unroll' flag.
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 4, 2020
* [TIR] Make loop unrolling in LoopPartition optional

For certain analysis/tensorization, it can be useful
to keep the loop structure when partitioning loops.
The current behaviour removes For loops of length 1.
This change introduces the option to preserve these
loops with the 'unroll' flag.
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Dec 4, 2020
* [TIR] Make loop unrolling in LoopPartition optional

For certain analysis/tensorization, it can be useful
to keep the loop structure when partitioning loops.
The current behaviour removes For loops of length 1.
This change introduces the option to preserve these
loops with the 'unroll' flag.
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.

4 participants