[Hexagon] Support both 1-d and 2-d VTCM allocations#10846
Merged
kparzysz-quic merged 5 commits intoApr 1, 2022
Conversation
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 <astraw@octoml.ai>
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
adstraw
left a comment
Contributor
There was a problem hiding this comment.
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.
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 <astraw@octoml.ai> * [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 <astraw@octoml.ai>
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 <astraw@octoml.ai> * [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 <astraw@octoml.ai>
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.
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
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.