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][USMP] adding the pass to convert to pool offsets #9418

Merged
merged 7 commits into from
Dec 9, 2021

Conversation

manupak
Copy link
Contributor

@manupak manupak commented Nov 1, 2021

This commit adds a transform pass that consumes the planned pool allocations using memory planning algorithm that convertes them to pool offsets.

* adds two test cases for a linear structure with two pools
* adds test case with a single pool for residual structures

@manupak
Copy link
Contributor Author

manupak commented Nov 1, 2021

This is blocked on #8468 and then #9214. This contains the contents of the dependent PRs.

@manupak
Copy link
Contributor Author

manupak commented Nov 1, 2021

a friendly ping @mbs-octoml !

@manupak manupak force-pushed the usmp_pool_allocations_to_offsets branch from 93a81d8 to f95f642 Compare November 22, 2021 18:36
@mbs-octoml
Copy link
Contributor

Hi @manupa-arm, I was waiting for #8468 to go in and #9214 to come out of DRAFT. Is that ok?

@manupak
Copy link
Contributor Author

manupak commented Nov 22, 2021

@mbs-octoml , yes Im also waiting for #8468 to go in :D -- so when #9214 comes out of draft it doesn't include changes belonging to #8468

@manupak manupak force-pushed the usmp_pool_allocations_to_offsets branch from f95f642 to f2841f5 Compare November 23, 2021 17:53
@manupak manupak force-pushed the usmp_pool_allocations_to_offsets branch 2 times, most recently from e5f1867 to 508b61d Compare December 2, 2021 18:05
@manupak manupak marked this pull request as ready for review December 2, 2021 18:06
@manupak manupak requested a review from icemelon as a code owner December 2, 2021 18:06
@manupak
Copy link
Contributor Author

manupak commented Dec 3, 2021

Ping for reviews : @mbaret @mbs-octoml

Copy link
Contributor

@mbs-octoml mbs-octoml left a comment

Choose a reason for hiding this comment

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

Thanks for including the comments. Made the mistake of looking at this late on a Fri afternoon and my eyes started glazing over, but seems the main things are the new load_node in the AllocateNode visitor and capturing AllocatedPoolInfo on func/global params.

I'm still finding my way in TIR land so defer to say @junrushao1994 or similar for proper review.

include/tvm/tir/usmp/utils.h Outdated Show resolved Hide resolved
@@ -35,7 +35,12 @@ namespace tir {
LetStmt::LetStmt(Var var, PrimExpr value, Stmt body, Span span) {
ICHECK(value.defined());
ICHECK(body.defined());
ICHECK_EQ(value.dtype(), var.dtype());
auto vdtype = value.dtype();
if (var->type_annotation.as<PointerTypeNode>()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

could you add a comment? how did this ever work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a comment.

@manupak manupak force-pushed the usmp_pool_allocations_to_offsets branch from 508b61d to 977608e Compare December 6, 2021 16:54
@manupak
Copy link
Contributor Author

manupak commented Dec 6, 2021

Thanks @mbs-octoml ! I've done the necessary changes.

Pinging folks @lhutton1 @ekalda @leandron @NicolaLancellotti for review/approval

Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

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

Thanks @manupa-arm, I'm not all that familiar with USMP but gave this a quick look over. Just a few minor things - feel free to address them in a follow up.

@manupak manupak force-pushed the usmp_pool_allocations_to_offsets branch from 977608e to 52a4f12 Compare December 8, 2021 14:46
@manupak
Copy link
Contributor Author

manupak commented Dec 8, 2021

Thanks! @NicolaLancellotti @lhutton1 . I've addressed your comments.

Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

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

LGTM

This commit adds a transform pass that consumes
the planned pool allocations using memory planning algorithm
that convertes them to pool offsets.

* adds two test cases for a linear structure with two pools
* adds test case with a single pool for residual structures

Change-Id: I9d31e854461b5c21df72d1452120d286b96791c0
* Adding a toggle to produce TIR that is TVMScript printable for unit
testing
* Fixing the unit tests
* Ensure deterministic pool variable ordering.

Change-Id: I317675df03327b0ebbf4ca074255384e63f07cd6
Fixing the references after changes in the memory planning
algorithm.

Change-Id: Id7c22356fd5de43d10a2b4fc70e978af2c6d599d
* fixing the lint

Change-Id: I7ff920b92d14a9919c930a4b35a2169c77a57dd1
* removing unnecessary defitinitions
* remove global var map
* adding explaination for let bindings to pointer type

Change-Id: I31bd1a9f3057ee7f06252263565b0f75c51e6d13
* rebase changes
* making imports absolute
* fixing typos and removing unnecesary lines

Change-Id: I4c94b9955b001513fecb39ca94f81b1ad99c7bfc
* fixing typos

Change-Id: I42c557fd394aefdf8c2e825c4e88770eb0732f9b
@manupak manupak force-pushed the usmp_pool_allocations_to_offsets branch from 9ce59ee to 2c6cf6c Compare December 8, 2021 15:49
@manupak
Copy link
Contributor Author

manupak commented Dec 9, 2021

@leandron can we get this in ?

Copy link
Contributor

@leandron leandron left a comment

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 3ce4fe4 into apache:main Dec 9, 2021
mikepapadim pushed a commit to mikepapadim/tvm that referenced this pull request Dec 9, 2021
* [TIR][USMP] adding the pass to convert to pool offsets

This commit adds a transform pass that consumes
the planned pool allocations using memory planning algorithm
that convertes them to pool offsets.

* adds two test cases for a linear structure with two pools
* adds test case with a single pool for residual structures

Change-Id: I9d31e854461b5c21df72d1452120d286b96791c0

* [TIR][USMP] adding the pass to convert to pool offsets

* Adding a toggle to produce TIR that is TVMScript printable for unit
testing
* Fixing the unit tests
* Ensure deterministic pool variable ordering.

Change-Id: I317675df03327b0ebbf4ca074255384e63f07cd6

* [TIR][USMP] adding the pass to convert to pool offsets

Fixing the references after changes in the memory planning
algorithm.

Change-Id: Id7c22356fd5de43d10a2b4fc70e978af2c6d599d

* [TIR][USMP] adding the pass to convert to pool offsets

* fixing the lint

Change-Id: I7ff920b92d14a9919c930a4b35a2169c77a57dd1

* [TIR][USMP] adding the pass to convert to pool offsets

* removing unnecessary defitinitions
* remove global var map
* adding explaination for let bindings to pointer type

Change-Id: I31bd1a9f3057ee7f06252263565b0f75c51e6d13

* [TIR][USMP] adding the pass to convert to pool offsets

* rebase changes
* making imports absolute
* fixing typos and removing unnecesary lines

Change-Id: I4c94b9955b001513fecb39ca94f81b1ad99c7bfc

* [TIR][USMP] adding the pass to convert to pool offsets

* fixing typos

Change-Id: I42c557fd394aefdf8c2e825c4e88770eb0732f9b
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
* [TIR][USMP] adding the pass to convert to pool offsets

This commit adds a transform pass that consumes
the planned pool allocations using memory planning algorithm
that convertes them to pool offsets.

* adds two test cases for a linear structure with two pools
* adds test case with a single pool for residual structures

Change-Id: I9d31e854461b5c21df72d1452120d286b96791c0

* [TIR][USMP] adding the pass to convert to pool offsets

* Adding a toggle to produce TIR that is TVMScript printable for unit
testing
* Fixing the unit tests
* Ensure deterministic pool variable ordering.

Change-Id: I317675df03327b0ebbf4ca074255384e63f07cd6

* [TIR][USMP] adding the pass to convert to pool offsets

Fixing the references after changes in the memory planning
algorithm.

Change-Id: Id7c22356fd5de43d10a2b4fc70e978af2c6d599d

* [TIR][USMP] adding the pass to convert to pool offsets

* fixing the lint

Change-Id: I7ff920b92d14a9919c930a4b35a2169c77a57dd1

* [TIR][USMP] adding the pass to convert to pool offsets

* removing unnecessary defitinitions
* remove global var map
* adding explaination for let bindings to pointer type

Change-Id: I31bd1a9f3057ee7f06252263565b0f75c51e6d13

* [TIR][USMP] adding the pass to convert to pool offsets

* rebase changes
* making imports absolute
* fixing typos and removing unnecesary lines

Change-Id: I4c94b9955b001513fecb39ca94f81b1ad99c7bfc

* [TIR][USMP] adding the pass to convert to pool offsets

* fixing typos

Change-Id: I42c557fd394aefdf8c2e825c4e88770eb0732f9b
yangulei pushed a commit to yangulei/tvm that referenced this pull request Jan 11, 2022
* [TIR][USMP] adding the pass to convert to pool offsets

This commit adds a transform pass that consumes
the planned pool allocations using memory planning algorithm
that convertes them to pool offsets.

* adds two test cases for a linear structure with two pools
* adds test case with a single pool for residual structures

Change-Id: I9d31e854461b5c21df72d1452120d286b96791c0

* [TIR][USMP] adding the pass to convert to pool offsets

* Adding a toggle to produce TIR that is TVMScript printable for unit
testing
* Fixing the unit tests
* Ensure deterministic pool variable ordering.

Change-Id: I317675df03327b0ebbf4ca074255384e63f07cd6

* [TIR][USMP] adding the pass to convert to pool offsets

Fixing the references after changes in the memory planning
algorithm.

Change-Id: Id7c22356fd5de43d10a2b4fc70e978af2c6d599d

* [TIR][USMP] adding the pass to convert to pool offsets

* fixing the lint

Change-Id: I7ff920b92d14a9919c930a4b35a2169c77a57dd1

* [TIR][USMP] adding the pass to convert to pool offsets

* removing unnecessary defitinitions
* remove global var map
* adding explaination for let bindings to pointer type

Change-Id: I31bd1a9f3057ee7f06252263565b0f75c51e6d13

* [TIR][USMP] adding the pass to convert to pool offsets

* rebase changes
* making imports absolute
* fixing typos and removing unnecesary lines

Change-Id: I4c94b9955b001513fecb39ca94f81b1ad99c7bfc

* [TIR][USMP] adding the pass to convert to pool offsets

* fixing typos

Change-Id: I42c557fd394aefdf8c2e825c4e88770eb0732f9b
yangulei pushed a commit to yangulei/tvm that referenced this pull request Jan 12, 2022
* [TIR][USMP] adding the pass to convert to pool offsets

This commit adds a transform pass that consumes
the planned pool allocations using memory planning algorithm
that convertes them to pool offsets.

* adds two test cases for a linear structure with two pools
* adds test case with a single pool for residual structures

Change-Id: I9d31e854461b5c21df72d1452120d286b96791c0

* [TIR][USMP] adding the pass to convert to pool offsets

* Adding a toggle to produce TIR that is TVMScript printable for unit
testing
* Fixing the unit tests
* Ensure deterministic pool variable ordering.

Change-Id: I317675df03327b0ebbf4ca074255384e63f07cd6

* [TIR][USMP] adding the pass to convert to pool offsets

Fixing the references after changes in the memory planning
algorithm.

Change-Id: Id7c22356fd5de43d10a2b4fc70e978af2c6d599d

* [TIR][USMP] adding the pass to convert to pool offsets

* fixing the lint

Change-Id: I7ff920b92d14a9919c930a4b35a2169c77a57dd1

* [TIR][USMP] adding the pass to convert to pool offsets

* removing unnecessary defitinitions
* remove global var map
* adding explaination for let bindings to pointer type

Change-Id: I31bd1a9f3057ee7f06252263565b0f75c51e6d13

* [TIR][USMP] adding the pass to convert to pool offsets

* rebase changes
* making imports absolute
* fixing typos and removing unnecesary lines

Change-Id: I4c94b9955b001513fecb39ca94f81b1ad99c7bfc

* [TIR][USMP] adding the pass to convert to pool offsets

* fixing typos

Change-Id: I42c557fd394aefdf8c2e825c4e88770eb0732f9b
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* [TIR][USMP] adding the pass to convert to pool offsets

This commit adds a transform pass that consumes
the planned pool allocations using memory planning algorithm
that convertes them to pool offsets.

* adds two test cases for a linear structure with two pools
* adds test case with a single pool for residual structures

Change-Id: I9d31e854461b5c21df72d1452120d286b96791c0

* [TIR][USMP] adding the pass to convert to pool offsets

* Adding a toggle to produce TIR that is TVMScript printable for unit
testing
* Fixing the unit tests
* Ensure deterministic pool variable ordering.

Change-Id: I317675df03327b0ebbf4ca074255384e63f07cd6

* [TIR][USMP] adding the pass to convert to pool offsets

Fixing the references after changes in the memory planning
algorithm.

Change-Id: Id7c22356fd5de43d10a2b4fc70e978af2c6d599d

* [TIR][USMP] adding the pass to convert to pool offsets

* fixing the lint

Change-Id: I7ff920b92d14a9919c930a4b35a2169c77a57dd1

* [TIR][USMP] adding the pass to convert to pool offsets

* removing unnecessary defitinitions
* remove global var map
* adding explaination for let bindings to pointer type

Change-Id: I31bd1a9f3057ee7f06252263565b0f75c51e6d13

* [TIR][USMP] adding the pass to convert to pool offsets

* rebase changes
* making imports absolute
* fixing typos and removing unnecesary lines

Change-Id: I4c94b9955b001513fecb39ca94f81b1ad99c7bfc

* [TIR][USMP] adding the pass to convert to pool offsets

* fixing typos

Change-Id: I42c557fd394aefdf8c2e825c4e88770eb0732f9b
qsqqsqqsq-intellif pushed a commit to qsqqsqqsq-intellif/tvm that referenced this pull request Apr 29, 2022
* [TIR][USMP] adding the pass to convert to pool offsets

This commit adds a transform pass that consumes
the planned pool allocations using memory planning algorithm
that convertes them to pool offsets.

* adds two test cases for a linear structure with two pools
* adds test case with a single pool for residual structures

Change-Id: I9d31e854461b5c21df72d1452120d286b96791c0

* [TIR][USMP] adding the pass to convert to pool offsets

* Adding a toggle to produce TIR that is TVMScript printable for unit
testing
* Fixing the unit tests
* Ensure deterministic pool variable ordering.

Change-Id: I317675df03327b0ebbf4ca074255384e63f07cd6

* [TIR][USMP] adding the pass to convert to pool offsets

Fixing the references after changes in the memory planning
algorithm.

Change-Id: Id7c22356fd5de43d10a2b4fc70e978af2c6d599d

* [TIR][USMP] adding the pass to convert to pool offsets

* fixing the lint

Change-Id: I7ff920b92d14a9919c930a4b35a2169c77a57dd1

* [TIR][USMP] adding the pass to convert to pool offsets

* removing unnecessary defitinitions
* remove global var map
* adding explaination for let bindings to pointer type

Change-Id: I31bd1a9f3057ee7f06252263565b0f75c51e6d13

* [TIR][USMP] adding the pass to convert to pool offsets

* rebase changes
* making imports absolute
* fixing typos and removing unnecesary lines

Change-Id: I4c94b9955b001513fecb39ca94f81b1ad99c7bfc

* [TIR][USMP] adding the pass to convert to pool offsets

* fixing typos

Change-Id: I42c557fd394aefdf8c2e825c4e88770eb0732f9b
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.

5 participants