Skip to content

Conversation

@Lunderberg
Copy link
Contributor

Prior to this commit, the tir.PlanAndUpdateBufferAllocationLocation pass would attempt to merge buffer allocations, unless the buffer's backing allocation was found in a Allocate, AllocateConst, or PrimFuncNode::params. Previous
PRs (e.g. #10998) collected these locations and marked them as unmanaged. However, this requires exhaustively checking all locations where unmanaged allocations could occur.

This PR updates tir.PlanAndUpdateBufferAllocationLocation to instead collect the managed buffers, and only perform rewrites of these managed buffers. This only required inspection of BlockNode, and no other constructs.

The unit test added in this PR is another location where unmanaged buffers may be produced.

Prior to this commit, the `tir.PlanAndUpdateBufferAllocationLocation`
pass would attempt to merge buffer allocations, unless the buffer's
backing allocation was found in a `Allocate`, `AllocateConst`, or
`PrimFuncNode::params`.  Previous
PRs (e.g. apache#10998) collected these
locations and marked them as unmanaged.  However, this requires
exhaustively checking all locations where unmanaged allocations could
occur.

This PR updates `tir.PlanAndUpdateBufferAllocationLocation` to instead
collect the managed buffers, and only perform rewrites of these
managed buffers.  This only required inspection of `BlockNode`, and no
other constructs.

The unit test added in this PR is another location where unmanaged
buffers may be produced.
@vinx13 vinx13 merged commit 6df42d4 into apache:main Mar 18, 2024
@Lunderberg Lunderberg deleted the tir_bugfix_planning_with_unmanaged_buffers branch March 18, 2024 19:36
thaisacs pushed a commit to thaisacs/tvm that referenced this pull request Apr 3, 2024
…#16726)

Prior to this commit, the `tir.PlanAndUpdateBufferAllocationLocation`
pass would attempt to merge buffer allocations, unless the buffer's
backing allocation was found in a `Allocate`, `AllocateConst`, or
`PrimFuncNode::params`.  Previous
PRs (e.g. apache#10998) collected these
locations and marked them as unmanaged.  However, this requires
exhaustively checking all locations where unmanaged allocations could
occur.

This PR updates `tir.PlanAndUpdateBufferAllocationLocation` to instead
collect the managed buffers, and only perform rewrites of these
managed buffers.  This only required inspection of `BlockNode`, and no
other constructs.

The unit test added in this PR is another location where unmanaged
buffers may be produced.
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