Skip to content

[TIR][USMP] adding the pass to convert to pool offsets - #9418

Merged
leandron merged 7 commits into
apache:mainfrom
manupak:usmp_pool_allocations_to_offsets
Dec 9, 2021
Merged

[TIR][USMP] adding the pass to convert to pool offsets#9418
leandron merged 7 commits into
apache:mainfrom
manupak:usmp_pool_allocations_to_offsets

Conversation

@manupak

Copy link
Copy Markdown
Contributor

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

manupak commented Nov 1, 2021

Copy link
Copy Markdown
ContributorAuthor

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

@manupak

Copy link
Copy Markdown
ContributorAuthor

a friendly ping @mbs-octoml !

@manupak
manupakforce-pushed the usmp_pool_allocations_to_offsets branch from 93a81d8 to f95f642CompareNovember 22, 2021 18:36
@mbs-octoml

Copy link
Copy Markdown
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
Copy Markdown
ContributorAuthor

@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
manupakforce-pushed the usmp_pool_allocations_to_offsets branch from f95f642 to f2841f5CompareNovember 23, 2021 17:53
@manupak
manupakforce-pushed the usmp_pool_allocations_to_offsets branch 2 times, most recently from e5f1867 to 508b61dCompareDecember 2, 2021 18:05
@manupak
manupak marked this pull request as ready for review December 2, 2021 18:06
@manupak

Copy link
Copy Markdown
ContributorAuthor

Ping for reviews : @mbaret@mbs-octoml

@mbs-octomlmbs-octoml 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.

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.

Comment threadinclude/tvm/tir/usmp/utils.h Outdated
Comment threadsrc/tir/ir/stmt.cc
ICHECK(body.defined());
ICHECK_EQ(value.dtype(), var.dtype());
auto vdtype = value.dtype();
if (var->type_annotation.as<PointerTypeNode>()) {

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.

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

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Added a comment.

Comment threadsrc/tir/usmp/transform/convert_pool_allocations_to_offsets.cc Outdated
Comment threadsrc/tir/usmp/transform/convert_pool_allocations_to_offsets.cc Outdated
@manupak
manupakforce-pushed the usmp_pool_allocations_to_offsets branch from 508b61d to 977608eCompareDecember 6, 2021 16:54
@manupak

Copy link
Copy Markdown
ContributorAuthor

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

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

@lhutton1lhutton1 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.

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.

Comment threadpython/tvm/tir/usmp/transform/transform.py Outdated
Comment threadpython/tvm/tir/usmp/transform/transform.py Outdated
Comment threadsrc/tir/usmp/transform/convert_pool_allocations_to_offsets.cc Outdated
Comment threadsrc/tir/usmp/transform/convert_pool_allocations_to_offsets.cc Outdated
Comment threadsrc/tir/usmp/transform/convert_pool_allocations_to_offsets.cc Outdated
@manupak
manupakforce-pushed the usmp_pool_allocations_to_offsets branch from 977608e to 52a4f12CompareDecember 8, 2021 14:46
@manupak

Copy link
Copy Markdown
ContributorAuthor

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

@lhutton1lhutton1 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

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
manupakforce-pushed the usmp_pool_allocations_to_offsets branch from 9ce59ee to 2c6cf6cCompareDecember 8, 2021 15:49
@manupak

Copy link
Copy Markdown
ContributorAuthor

@leandron can we get this in ?

@leandronleandron 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 3ce4fe4 into apache:mainDec 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 freeto 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

@manupak@mbs-octoml@leandron@NicolaLancellotti@lhutton1