Skip to content
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

[Hexagon]: Add upload function to hexagon session #13161

Merged
merged 13 commits into from
Oct 26, 2022

Conversation

mehrdadh
Copy link
Member

This PR adds upload to hexagon RPC server running on Hexagon side. This will remove the need of adb command for uploading/executing binary files on hexagon.

@tvm-bot
Copy link
Collaborator

tvm-bot commented Oct 20, 2022

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

  • No users to tag found in teams: hexagon See #10317 for details
  • Built docs for commit 7f29069 can be found here.

Generated by tvm-bot

@mehrdadh mehrdadh marked this pull request as ready for review October 21, 2022 18:20
@mehrdadh mehrdadh requested a review from Lunderberg October 21, 2022 18:20
Copy link
Contributor

@Lunderberg Lunderberg left a comment

Choose a reason for hiding this comment

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

I like the session-scoped uploads, and allowing tests to be reliant solely on the hexagon_session instead of the hexagon_launcher. This is a strictly better usage for a testing environment, where all state should be session-scoped. However, it doesn't allow for a production use case in which a model is uploaded once, and then run many times across many connections.

I'd propose the following design, which would allow for both use cases:

  • A HexagonSession has a single workspace, which should be cleared when closing a session. Calls to HexagonSession.upload go into that session's workspace. Calls to HexagonSession.load_module may only be a tvm.runtime.Module, and not a str or pathlib.Path, because persistent uploads are not supported.
  • A HexagonLauncher has a single workspace, which should be persistent across multiple connections to the same device. Calls to HexagonLauncher.upload go into the persistent workspace. Calls to HexagonLauncher.load_module may be a tvm.runtime.Module, or a str/pathlib.Path to access previously uploaded artifacts.

This would be simplest to implement by having a upload method in both HexagonLauncher and HexagonSession. Each would call a private method of HexagonLauncher that takes an explicit workspace, but those workspaces would not otherwise be exposed to the user.

python/tvm/contrib/hexagon/build.py Outdated Show resolved Hide resolved
python/tvm/contrib/hexagon/build.py Show resolved Hide resolved
python/tvm/contrib/hexagon/build.py Show resolved Hide resolved
python/tvm/contrib/hexagon/meta_schedule.py Outdated Show resolved Hide resolved
python/tvm/contrib/hexagon/session.py Outdated Show resolved Hide resolved
python/tvm/contrib/hexagon/session.py Outdated Show resolved Hide resolved
tests/python/contrib/test_hexagon/test_meta_schedule.py Outdated Show resolved Hide resolved
@mehrdadh mehrdadh changed the title [Draft][Hexagon]: Add upload function to hexagon session [Hexagon]: Add upload function to hexagon session Oct 21, 2022
@mehrdadh mehrdadh force-pushed the hexagon/fix_parallel_permission_issue branch 4 times, most recently from b7cb360 to 97384e8 Compare October 25, 2022 15:55
@mehrdadh mehrdadh force-pushed the hexagon/fix_parallel_permission_issue branch 2 times, most recently from 6bd00a8 to feb64c5 Compare October 25, 2022 20:19
@mehrdadh mehrdadh force-pushed the hexagon/fix_parallel_permission_issue branch from feb64c5 to 7f29069 Compare October 25, 2022 21:34
@Lunderberg
Copy link
Contributor

Thank you, and the changes made address all the specific changes requested. I think the last item remaining is how the new design would support persistent artifacts stored on the hexagon device across multiple sessions.

Copy link
Contributor

@Lunderberg Lunderberg left a comment

Choose a reason for hiding this comment

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

Following conversation with @mehrdadh , support for persistence across sessions to be re-added in a follow-up PR.

@mehrdadh mehrdadh merged commit 7cdb7a7 into apache:main Oct 26, 2022
@mehrdadh mehrdadh deleted the hexagon/fix_parallel_permission_issue branch October 26, 2022 15:46
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 10, 2022
* [Hexagon]: Add upload to hexagon session

* lint

* fix typo

* fix serial device skips

* fix test on device

* add serial device to rpc key

* update error name

* fix comment

* move create_session to launcher

* add is_simulator

* lint

* address Eric comment on Session object

* rebase with main
xinetzone pushed a commit to daobook/tvm that referenced this pull request Nov 25, 2022
* [Hexagon]: Add upload to hexagon session

* lint

* fix typo

* fix serial device skips

* fix test on device

* add serial device to rpc key

* update error name

* fix comment

* move create_session to launcher

* add is_simulator

* lint

* address Eric comment on Session object

* rebase with main
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