-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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] Ignore Allocate/AllocateConst in BufferAllocationLocator #10998
Merged
vinx13
merged 2 commits into
apache:main
from
Lunderberg:tir_buffer_planning_ignore_allocateconst
Apr 14, 2022
Merged
[TIR] Ignore Allocate/AllocateConst in BufferAllocationLocator #10998
vinx13
merged 2 commits into
apache:main
from
Lunderberg:tir_buffer_planning_ignore_allocateconst
Apr 14, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prior to this commit, the BufferAllocationLocator mutator used in the PlanAndUpdateBufferAllocationLocation pass would erroneously insert an entry to `BlockNode::alloc_buffers` for buffers allocated using `Allocate` or `AllocateConst` nodes. This error was introduced in apache#9727, which deprecated `Load` and `Store` nodes, replacing them with `BufferLoad` and `BufferStore` nodes. As a result, BufferAllocationLocator identified these as buffers whose allocations should be moved to inner loops, rather than as unmanaged allocations that should be ignored. This commit restores the earlier behavior by only operating on buffer allocations in `BlockNode::alloc_buffers`, and explicitly ignoring any buffers whose allocation is done with `Allocate` or `AllocateConst`.
vinx13
approved these changes
Apr 13, 2022
joshherr-quic
approved these changes
Apr 13, 2022
Previously, all buffers found were managed buffers, so this check wasn't needed.
Lucien0
pushed a commit
to Lucien0/tvm
that referenced
this pull request
Apr 19, 2022
…e#10998) * [TIR] Ignore Allocate/AllocateConst in BufferAllocationLocator Prior to this commit, the BufferAllocationLocator mutator used in the PlanAndUpdateBufferAllocationLocation pass would erroneously insert an entry to `BlockNode::alloc_buffers` for buffers allocated using `Allocate` or `AllocateConst` nodes. This error was introduced in apache#9727, which deprecated `Load` and `Store` nodes, replacing them with `BufferLoad` and `BufferStore` nodes. As a result, BufferAllocationLocator identified these as buffers whose allocations should be moved to inner loops, rather than as unmanaged allocations that should be ignored. This commit restores the earlier behavior by only operating on buffer allocations in `BlockNode::alloc_buffers`, and explicitly ignoring any buffers whose allocation is done with `Allocate` or `AllocateConst`. * Only inject opaque block if managed buffers exist. Previously, all buffers found were managed buffers, so this check wasn't needed.
altanh
pushed a commit
to altanh/tvm
that referenced
this pull request
Apr 28, 2022
…e#10998) * [TIR] Ignore Allocate/AllocateConst in BufferAllocationLocator Prior to this commit, the BufferAllocationLocator mutator used in the PlanAndUpdateBufferAllocationLocation pass would erroneously insert an entry to `BlockNode::alloc_buffers` for buffers allocated using `Allocate` or `AllocateConst` nodes. This error was introduced in apache#9727, which deprecated `Load` and `Store` nodes, replacing them with `BufferLoad` and `BufferStore` nodes. As a result, BufferAllocationLocator identified these as buffers whose allocations should be moved to inner loops, rather than as unmanaged allocations that should be ignored. This commit restores the earlier behavior by only operating on buffer allocations in `BlockNode::alloc_buffers`, and explicitly ignoring any buffers whose allocation is done with `Allocate` or `AllocateConst`. * Only inject opaque block if managed buffers exist. Previously, all buffers found were managed buffers, so this check wasn't needed.
Lunderberg
added a commit
to Lunderberg/tvm
that referenced
this pull request
Mar 14, 2024
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.
Lunderberg
added a commit
to Lunderberg/tvm
that referenced
this pull request
Mar 15, 2024
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
pushed a commit
that referenced
this pull request
Mar 18, 2024
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.
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prior to this commit, the BufferAllocationLocator mutator used in the PlanAndUpdateBufferAllocationLocation pass would erroneously insert an entry to
BlockNode::alloc_buffers
for buffers allocated usingAllocate
orAllocateConst
nodes. This error was introduced in #9727, which deprecatedLoad
andStore
nodes, replacing them withBufferLoad
andBufferStore
nodes. As a result, BufferAllocationLocator identified these as buffers whose allocations should be moved to inner loops, rather than as unmanaged allocations that should be ignored.This commit restores the earlier behavior by only operating on buffer allocations in
BlockNode::alloc_buffers
, and explicitly ignoring any buffers whose allocation is done withAllocate
orAllocateConst
.