-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Hexagon] Support both 1-d and 2-d VTCM allocations #10846
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
Merged
kparzysz-quic
merged 5 commits into
apache:main
from
Lunderberg:hexagon_1d_and_2d_allocations
Apr 1, 2022
Merged
[Hexagon] Support both 1-d and 2-d VTCM allocations #10846
kparzysz-quic
merged 5 commits into
apache:main
from
Lunderberg:hexagon_1d_and_2d_allocations
Apr 1, 2022
Conversation
This file contains hidden or 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
Previously, all VTCM allocations were assumed to be 2-d buffers. This commit extends `HexagonDeviceAPIv2::AllocVtcmWorkspace` to allow both 1-d and 2-d VTCM allocations. Matching the semantics used in `CodeGenHexagon::CreateBufferPtr`, allocation of 1-d buffers returns a `void*`, and allocation of 2-d buffers returns a `void**`. Co-authored-by: Adam Straw <[email protected]>
Previously, HexagonBuffer represented 1-d buffers as 2-d buffers with `nallocs==1`. Since this is used to determine the return type of the data pointer exposed to the generated code, the ambiguity between `shape=[N]` and `shape=[1,N]` must be avoided. This commit replaces `HexagonBuffer::nallocs_` with `HexagonBuffer::ndim_`, avoiding this ambiguity.
This updates `HexagonDeviceAPIv2::AllocDataSpace` to follow the semantics of `DeviceAPI::AllocDataSpace`, to avoid breaking caller assumptions in `tvm.nd.array` or graph_executor/aot allocation.
Contributor
Author
96f6a2c to
3d7ae57
Compare
adstraw
suggested changes
Mar 31, 2022
Contributor
adstraw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; just need to clean up some unused code.
adstraw
approved these changes
Apr 1, 2022
kparzysz-quic
approved these changes
Apr 1, 2022
| void** GetPointer(); | ||
| /*! \brief Return data pointer | ||
| * | ||
| * The return type depends on the buffer being |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment looks truncated.
Lunderberg
added a commit
to Lunderberg/tvm
that referenced
this pull request
Apr 1, 2022
As a follow-up from apache#10846, completing a docstring that unintentionally ended in the middle of a sentence.
kparzysz-quic
pushed a commit
that referenced
this pull request
Apr 2, 2022
As a follow-up from #10846, completing a docstring that unintentionally ended in the middle of a sentence.
pfk-beta
pushed a commit
to pfk-beta/tvm
that referenced
this pull request
Apr 11, 2022
* [Hexagon] Support both 1-d and 2-d VTCM allocations Previously, all VTCM allocations were assumed to be 2-d buffers. This commit extends `HexagonDeviceAPIv2::AllocVtcmWorkspace` to allow both 1-d and 2-d VTCM allocations. Matching the semantics used in `CodeGenHexagon::CreateBufferPtr`, allocation of 1-d buffers returns a `void*`, and allocation of 2-d buffers returns a `void**`. Co-authored-by: Adam Straw <[email protected]> * [Hexagon] Distinguish between 1-d buffer and single-alloc 2-d buffer Previously, HexagonBuffer represented 1-d buffers as 2-d buffers with `nallocs==1`. Since this is used to determine the return type of the data pointer exposed to the generated code, the ambiguity between `shape=[N]` and `shape=[1,N]` must be avoided. This commit replaces `HexagonBuffer::nallocs_` with `HexagonBuffer::ndim_`, avoiding this ambiguity. * [Hexagon] Treat "global" scope allocations as 1-d This updates `HexagonDeviceAPIv2::AllocDataSpace` to follow the semantics of `DeviceAPI::AllocDataSpace`, to avoid breaking caller assumptions in `tvm.nd.array` or graph_executor/aot allocation. * Updated C++ unit tests for HexagonBuffer * Remove commented GetNumAllocs and unused GetBufferDimension Co-authored-by: Adam Straw <[email protected]>
pfk-beta
pushed a commit
to pfk-beta/tvm
that referenced
this pull request
Apr 11, 2022
As a follow-up from apache#10846, completing a docstring that unintentionally ended in the middle of a sentence.
mehrdadh
pushed a commit
to mehrdadh/tvm
that referenced
this pull request
Apr 11, 2022
* [Hexagon] Support both 1-d and 2-d VTCM allocations Previously, all VTCM allocations were assumed to be 2-d buffers. This commit extends `HexagonDeviceAPIv2::AllocVtcmWorkspace` to allow both 1-d and 2-d VTCM allocations. Matching the semantics used in `CodeGenHexagon::CreateBufferPtr`, allocation of 1-d buffers returns a `void*`, and allocation of 2-d buffers returns a `void**`. Co-authored-by: Adam Straw <[email protected]> * [Hexagon] Distinguish between 1-d buffer and single-alloc 2-d buffer Previously, HexagonBuffer represented 1-d buffers as 2-d buffers with `nallocs==1`. Since this is used to determine the return type of the data pointer exposed to the generated code, the ambiguity between `shape=[N]` and `shape=[1,N]` must be avoided. This commit replaces `HexagonBuffer::nallocs_` with `HexagonBuffer::ndim_`, avoiding this ambiguity. * [Hexagon] Treat "global" scope allocations as 1-d This updates `HexagonDeviceAPIv2::AllocDataSpace` to follow the semantics of `DeviceAPI::AllocDataSpace`, to avoid breaking caller assumptions in `tvm.nd.array` or graph_executor/aot allocation. * Updated C++ unit tests for HexagonBuffer * Remove commented GetNumAllocs and unused GetBufferDimension Co-authored-by: Adam Straw <[email protected]>
mehrdadh
pushed a commit
to mehrdadh/tvm
that referenced
this pull request
Apr 11, 2022
As a follow-up from apache#10846, completing a docstring that unintentionally ended in the middle of a sentence.
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.
This change allows allocation of buffers with
"global.vtcm"to be either 1-d (flat) or 2-d (non-flat) memory allocations.