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

[AOT] BugFix of workspace calculation #10337

Merged
merged 4 commits into from
Feb 23, 2022

Conversation

manupak
Copy link
Contributor

@manupak manupak commented Feb 21, 2022

Following an investigation from #10022,
it turns out, currently the workspace
calculation assumes there would only be a single
lowered PrimFunc be produced per
primitive Relay Function.

However, the exception turned out to
be the CMSIS-NN codegen that produces
multiple calls/PrimFuncs in the place
of a single call to single relay PrimFunc.

This commit adds changes to workspace
calculation to be done on lowered IRModule.

Additionally, changes the test utils to
not to generate any stack allocator code
when USMP is used to make the tests more
strict.

@manupak
Copy link
Contributor Author

manupak commented Feb 21, 2022

cc : @Mousius

@@ -34,7 +34,7 @@ extern float output_storage[12];

extern const size_t output_len;

static uint8_t g_crt_workspace[TVMGEN_DEFAULT_WORKSPACE_SIZE + 512];
static uint8_t g_crt_workspace[TVMGEN_DEFAULT_WORKSPACE_SIZE];
Copy link
Member

Choose a reason for hiding this comment

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

@manupak manupak force-pushed the micronpu_usmp_followup branch 2 times, most recently from ee4fe4f to 53dcb54 Compare February 22, 2022 19:16
Following an investigation from apache#10022,
it turns out, currently the workspace
calculation assumes there would be a single
lowered PrimFunc could be produced per
primitive Relay Function.

However, the exception turned out to
be the CMSIS-NN codegen that produces
multiple calls/PrimFuncs in the place
of a single call to single relay PrimFunc.

This commit adds changes to workspace
calculation to be done on lowered IRModule.

Additionally, changes the test utils to
not to generate any stack allocator code
when USMP is used to make the tests more
strict.

This change also removes the confusing
"run_model" which has semantics identitical
to "__tvm_main__" in TIR.

Change-Id: I5202d9cc7c6a8c00c73791b82df062a8e13dd224
* fix arduino template

Change-Id: Ic53a73fa5a964300daff7a818fdb96cfa6e1efed
* fix USMP unit tests after main symbol change

Change-Id: I1536d00bf7fe421e7e040ace9a590dd915f13339
* fix c device api tests
* revert back to greedy in simple memory tests

Change-Id: Ie7d75db80267e891ff6044e850516c9d439790a4
@manupak
Copy link
Contributor Author

manupak commented Feb 23, 2022

cc : @leandron

@manupak
Copy link
Contributor Author

manupak commented Feb 23, 2022

This is green now :D !

@Mousius Mousius merged commit d8f639a into apache:main Feb 23, 2022
pfk-beta pushed a commit to pfk-beta/tvm that referenced this pull request Apr 11, 2022
Following an investigation from apache#10022,
it turns out, currently the workspace
calculation assumes there would be a single
lowered PrimFunc could be produced per
primitive Relay Function.

However, the exception turned out to
be the CMSIS-NN codegen that produces
multiple calls/PrimFuncs in the place
of a single call to single relay PrimFunc.

This commit adds changes to workspace
calculation to be done on lowered IRModule.

Additionally, changes the test utils to
not to generate any stack allocator code
when USMP is used to make the tests more
strict.

This change also removes the confusing
"run_model" which has semantics identitical
to "__tvm_main__" in TIR.
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.

2 participants