Skip to content

Conversation

@adstraw
Copy link
Contributor

@adstraw adstraw commented Nov 17, 2021

This PR uses memcpy. DMA support still pending. Code for VTCM allocation is present in this PR. VTCM allocation code is stubbed out when not building on Hexagon in favor or “mock” VTCM allocations using malloc which allows for unit testing of the HexagonBuffer class on CPU. The Hexagon Device API is modified to use the HexagonBuffer class including implementation of the CopyDataFromTo API.

}

void* HexagonBuffer::GetPointer() {
void** HexagonBuffer::GetPointer() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Returning a void ** here disambiguates between the cases where there is a single allocation vs. multiple. We always return a pointer to a pointer. This may be controversial.

Copy link
Contributor

Choose a reason for hiding this comment

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

Did we decide to revert this change so that tests pass and revisit once codegen supports pointer array indexing?

Copy link
Contributor Author

@adstraw adstraw Dec 10, 2021

Choose a reason for hiding this comment

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

I decided to keep HexagonBuffer as-is returning a void** which means that it (HexagonBuffer) supports discontiguous allocation. And, I noted the portions of the device API that force / assume contiguous allocation awaiting RFC 39 with "TODO" for myself.

Copy link
Contributor

@csullivan csullivan left a comment

Choose a reason for hiding this comment

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

Thanks @adstraw, looking great! Partial review

@adstraw adstraw force-pushed the hexagon-vtcm branch 3 times, most recently from e099787 to e01dc93 Compare November 18, 2021 18:36
@adstraw adstraw changed the title Add Hexagon VTCM support Add Hexagon VTCM support and discontiguous allocation Nov 18, 2021
@adstraw adstraw changed the title Add Hexagon VTCM support and discontiguous allocation Add Hexagon VTCM and discontiguous allocation support Nov 19, 2021
@adstraw adstraw marked this pull request as ready for review November 20, 2021 17:31
@adstraw adstraw requested a review from a team as a code owner November 20, 2021 17:31
Copy link
Contributor

@csullivan csullivan left a comment

Choose a reason for hiding this comment

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

Requesting changes until we have verified with integration.

@adstraw adstraw removed the request for review from a team November 29, 2021 23:19

mod["add"](A_data, B_data, C_data)
result = C_data.numpy()
assert (result == np.array([6, 7])).all()
Copy link
Contributor

Choose a reason for hiding this comment

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

Safer to use all_close, and probably want to make another test where with larger tensors.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's consider adding some more testing in a follow up.

Copy link
Contributor

@csullivan csullivan left a comment

Choose a reason for hiding this comment

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

Looks really great! Thanks @adstraw!

Copy link
Contributor

@tmoreau89 tmoreau89 left a comment

Choose a reason for hiding this comment

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

Thanks @adstraw, LGTM

@tmoreau89 tmoreau89 merged commit 2b35cfd into apache:main Dec 11, 2021
@tmoreau89
Copy link
Contributor

Thank you for the great work @adstraw and for the review @csullivan ; the PR has been merged!

@adstraw adstraw deleted the hexagon-vtcm branch December 13, 2021 19:06
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
* WIP Allocation abstraction for VTCM and DDR.

* Add Hexagon VTCM and discontiguous allocation support

* differentiate between dimensions and allocations

* remove change to llvm codegen

* add integration test_add_vtcm to demo vtcm alloc

* remove cmake change

* forcing contiguous allocation in device API, for now

Co-authored-by: Chris Sullivan <[email protected]>
yangulei pushed a commit to yangulei/tvm that referenced this pull request Jan 11, 2022
* WIP Allocation abstraction for VTCM and DDR.

* Add Hexagon VTCM and discontiguous allocation support

* differentiate between dimensions and allocations

* remove change to llvm codegen

* add integration test_add_vtcm to demo vtcm alloc

* remove cmake change

* forcing contiguous allocation in device API, for now

Co-authored-by: Chris Sullivan <[email protected]>
yangulei pushed a commit to yangulei/tvm that referenced this pull request Jan 12, 2022
* WIP Allocation abstraction for VTCM and DDR.

* Add Hexagon VTCM and discontiguous allocation support

* differentiate between dimensions and allocations

* remove change to llvm codegen

* add integration test_add_vtcm to demo vtcm alloc

* remove cmake change

* forcing contiguous allocation in device API, for now

Co-authored-by: Chris Sullivan <[email protected]>
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* WIP Allocation abstraction for VTCM and DDR.

* Add Hexagon VTCM and discontiguous allocation support

* differentiate between dimensions and allocations

* remove change to llvm codegen

* add integration test_add_vtcm to demo vtcm alloc

* remove cmake change

* forcing contiguous allocation in device API, for now

Co-authored-by: Chris Sullivan <[email protected]>
qsqqsqqsq-intellif pushed a commit to qsqqsqqsq-intellif/tvm that referenced this pull request Apr 29, 2022
* WIP Allocation abstraction for VTCM and DDR.

* Add Hexagon VTCM and discontiguous allocation support

* differentiate between dimensions and allocations

* remove change to llvm codegen

* add integration test_add_vtcm to demo vtcm alloc

* remove cmake change

* forcing contiguous allocation in device API, for now

Co-authored-by: Chris Sullivan <[email protected]>
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.

3 participants