Skip to content

[microTVM] Remove Arduino aot code - #8869

Merged
areusch merged 4 commits into
apache:mainfrom
guberti:remove-arduino-aot-code
Sep 4, 2021
Merged

[microTVM] Remove Arduino aot code#8869
areusch merged 4 commits into
apache:mainfrom
guberti:remove-arduino-aot-code

Conversation

@guberti

@gubertiguberti commented Aug 27, 2021

Copy link
Copy Markdown
Member

PR #8758 changed the way AOT is handled in microTVM, which caused my Arduino PR to stop working. I should have been caught by the unit tests since it caused Arduino project compilation to stop working, but because I called subprocess.run in microtvm_api_server.py without passing check=True, the tests still pass.

This PR fixes the Arduino implementation of microTVM, changes the unit tests for Arduino to use check=True, and adds a regression test to make sure the unit tests will catch compilation failures.

@mehrdadh@areusch

@gubertiguberti changed the title Remove Arduino aot code[microTVM] Remove Arduino aot codeAug 27, 2021
@mehrdadh

mehrdadh commented Aug 27, 2021

Copy link
Copy Markdown
Member

#8857
You guys need to coordinate on this.

@guberti
gubertiforce-pushed the remove-arduino-aot-code branch from c928a2e to 3a36816CompareAugust 27, 2021 22:37
@guberti

Copy link
Copy Markdown
MemberAuthor

I've rebased the PR on top of main now that #8857 is merged. This PR is ready for review.

@areuschareusch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@guberti thanks for this--a couple questions about your test fixtures

Comment threadtests/micro/arduino/test_arduino_workflow.py Outdated
Comment threadtests/micro/arduino/test_arduino_workflow.py Outdated
@guberti

Copy link
Copy Markdown
MemberAuthor

@guberti thanks for this--a couple questions about your test fixtures

The more I think about it, the more the save_generated_project_state fixture seems like a gross hack. It can create really weird bugs where microtvm_api_server.py is still running, but its source file has been repeatedly deleted and restored.

Even more so, the idea of having these saved project tests doesn't really fit with the test's "goal" - of simulating a user workflow of building and deploying a model on device.

IMO, the cleanest solution is to build a whole new test, test_arduino_error_detection, and move them there. I've done that with 3a8ea4c - take a look and LMK if you agree @areusch.

@MousiusMousius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for following up on this @guberti, apologies I didn't pick this up in my original PR - I appreciate your diligence 😸 I just have a few suggestions here.

Comment threadtests/micro/arduino/test_arduino_error_detection.py Outdated

@pytest.fixture(scope="function")
def workspace_dir(request, platform):
return conftest.make_workspace_dir("arduino_error_detection", platform)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Given these fixtures are only used as part of the tests in this folder, and conftest is meant for auto-registration or pytest configuration rather than to hold helpers and utils, could these be either moved fully into conftest as fixtures or the underlying function moved into a more suitably named file?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

The scope fixture of workspace_dir varies from test to test (for example, test_arduino_workflowhas it at module scope), and I suspect tests with more complexworkspace_dirsetups will be added in the future. For that reason, I'd prefer to defineworkspace_dirindividually in each test, but use the helper functionmake_workspace_dir` to avoid code reuse. I've also added a comment to each of these functions to clarify it.

That said, if you feel strongly I'm also open to other solutions, like defining multiple kinds of workspace dirs in conftest (e.g. a module_scope_workspace_dir, per_function_workspace_dir, etc.).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Argh, I feel like I could've been clearer here, my apologies. My suggestion is not to have general functions in conftest.py but rather in a different file such as a workspace.py to include from the test. This means only pytest-specific things end up in conftest.py, I have no issue with fixtures local to the test files which then use those functions.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Ah, that makes more sense. I like the idea of moving non-pytest code into a workspace.py, but I think that might be OOS for this PR. Definitely worth addressing in a follow up though!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed, it'd be good to have the move isolated in another PR 👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i agree with @Mousius sentiment--let's place test_utils in a file called test_utils or similar. can be a follow-up PR.

@guberti

Copy link
Copy Markdown
MemberAuthor

@Mousius Your comments should be addressed by bb37393 - take a look when you have a sec!

Comment threadtests/micro/arduino/test_arduino_error_detection.py Outdated
Comment threadtests/micro/arduino/test_arduino_rpc_server.py
Comment threadtests/micro/arduino/test_arduino_error_detection.py
@Mousius

Copy link
Copy Markdown
Member

Apologies @guberti, I was a bit unclear in my initial response and I've introduced more changes, feel free to reach out if you need more clarification 😸

@guberti
gubertiforce-pushed the remove-arduino-aot-code branch from bb37393 to e873436CompareSeptember 2, 2021 15:21
Break error detection tests into separate file
Address comments from Mousius
Re-add necessary fixture
@guberti
gubertiforce-pushed the remove-arduino-aot-code branch from e873436 to 2e433f6CompareSeptember 2, 2021 15:22
@guberti

Copy link
Copy Markdown
MemberAuthor

Apologies @guberti, I was a bit unclear in my initial response and I've introduced more changes, feel free to reach out if you need more clarification

Oops, it was really late when I made those previous changes :). Should be fixed now @Mousius!

@MousiusMousius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me, removes the AOT code and then some 😸

@leandronleandron left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@areusch
areusch merged commit 9f52e7e into apache:mainSep 4, 2021
ylc pushed a commit to ylc/tvm that referenced this pull request Sep 29, 2021
* Fix Arduino DLDevice includes
* microtvm_api_server fails if commands fail
* Add regression test for microtvm_api_server not failing
* Address PR comments
Break error detection tests into separate file
Address comments from Mousius
Re-add necessary fixture
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* Fix Arduino DLDevice includes
* microtvm_api_server fails if commands fail
* Add regression test for microtvm_api_server not failing
* Address PR comments
Break error detection tests into separate file
Address comments from Mousius
Re-add necessary fixture
Sign up for freeto 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.

5 participants

@guberti@mehrdadh@Mousius@leandron@areusch