Skip to content

Conversation

@manupak
Copy link
Contributor

@manupak manupak commented Nov 23, 2021

RFC : https://github.com/apache/tvm-rfcs/blob/main/rfcs/0009_Unified_Static_Memory_Planning.md

This commit integrates the USMP to AoT executor codegen as a Pass.
It also introduces two PassContext options to disable USMP as well as
StorageRewrite passes. Currently it will only support U1 usecase where
TVM internally generates a workspace buffer. The creation of constant
buffers will be added when we have tir.allocate_const support.

@manupak
Copy link
Contributor Author

manupak commented Nov 23, 2021

Putting this to draft as it contains the contents of the dependent PRs (See above)

@manupak manupak marked this pull request as ready for review December 9, 2021 20:19
@manupak manupak force-pushed the usmp_integration branch 2 times, most recently from dfa7c93 to 51c0816 Compare January 14, 2022 17:25
This commit intergrates USMP with the AoT
executor codegen. Additionally, this commit
introduces two PassContext options to
disable_usmp and disable_storage_rewrite.

Change-Id: I98d905fab7f49c2de52e126115953a40b0821e21
* This commit breaks out the USMP related tests
to test_crt_aot_usmp.py.
* Switched the polarity of the pass config option
to explicitly enable USMP rather than disable.

Change-Id: Id4bf35b18479b70924ec24e6bb7ba2682b05326e
* Swap pool var and output var ordering in the main function

Change-Id: Id03748e6f3528399a0ddd9cc2d011adfcee8d554
* Improving comments
* Changing the usage of tir Bool to just plain bool

Change-Id: I907cf9a0befa172183ae488bb3b94660aad39807
* fixing unit tests to scope With<Target>
* removing global sanitization of var names

Change-Id: Ifa8934f94744eeaac13e4b4ddcd671842c3dcb21
* changing unpacked_api to accept PrimFunc without
  buffer_maps.

Change-Id: I97e8df5272df7f1f8313f184aa660924989940e3
* Restoring the conditional behaviour as we are
  getting PrimFuncs without buffer maps.

Change-Id: Icd374353e0947515c523d506c1e7c02cf5d930b4
* Adds tir includes to source_module.cc

Change-Id: I8ad5654ea32abb3aabc0fcc9ef8157a609e9d2dc
* fixing c device api tests

Change-Id: I47ac38b5664a00f36b293a0d9d96330d4206173d
* moving algo/algo.h to algorithms.h
* creating two functions for USMP and StorageRewrite
* expanding codegen variable names to more descriptive
* removing unncessary print functions and print statements
* re-using relay::backend::SanitizeName

Change-Id: I890caa0104c07a4883eb0c34d3bfcfb8bb56653f
Moving PrintType from codegen_c.cc to codegen_source_base.cc
to be accessible by source_module.cc

Change-Id: Icb6a85de4c26110d2fea370fbd75e02a3639de59
Moving runtime::metadata to be ExecutorCodegeMetadata
as it contains metadata produced by ExecutorCodegen for
actual codegeneration (not a runtime component).

Change-Id: I13e95573ef331fb995281dbe220db01a7aa91add
Remove unused function declaration

Change-Id: Ib274553938eb5c82fe2b30cecc982481cff3937d
* Remove unncessary header file inclusion

Change-Id: I5575d6226baa74fe09dce1c71176e557d84f669a
@manupak
Copy link
Contributor Author

manupak commented Jan 17, 2022

This is now green! and I think I've addresses your comments. Could you take another look when you have some time ?

@manupak
Copy link
Contributor Author

manupak commented Jan 18, 2022

A friendly ping @Mousius @areusch ...

Copy link
Member

@Mousius Mousius left a comment

Choose a reason for hiding this comment

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

Just minor comments from me, I think the rest of my comments were dealt with 😸

* fixed a typo
* Improved consistenty with arg names for type printers

Change-Id: I25263831c8bbfa11e6e0d6f8f8dd998d254294ff
Copy link
Contributor

@areusch areusch left a comment

Choose a reason for hiding this comment

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

thanks @manupa-arm!

os << "float";
return;
}
if (type.bits() == 64) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should this have an else CHECK(false)? same question elsewhere

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was just moving the already existing implementation to the base class :).
Moreover, there was a LOG(FATAL) at the bottom that should cover this case anyway.

@manupak
Copy link
Contributor Author

manupak commented Jan 19, 2022

@Mousius do you think we could merge this one ?

Copy link
Member

@Mousius Mousius left a comment

Choose a reason for hiding this comment

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

@Mousius do you think we could merge this one ?

Definitely @manupa-arm! Thanks for the reviews from @mbs-octoml and @areusch!

@Mousius Mousius merged commit c3ace20 into apache:main Jan 19, 2022
yuanfz98 pushed a commit to yuanfz98/tvm that referenced this pull request Jan 24, 2022
This commit integrates USMP with the AoT executor codegen. Additionally, this commit introduces two PassContext options to disable_usmp and disable_storage_rewrite.

Moved PrintType from codegen_c.cc to codegen_source_base.cc to be accessible by source_module.cc

Moved runtime::metadata to be ExecutorCodegeMetadata as it contains metadata produced by ExecutorCodegen for actual code generation (not a runtime component).
crazydemo pushed a commit to crazydemo/tvm that referenced this pull request Jan 27, 2022
This commit integrates USMP with the AoT executor codegen. Additionally, this commit introduces two PassContext options to disable_usmp and disable_storage_rewrite.

Moved PrintType from codegen_c.cc to codegen_source_base.cc to be accessible by source_module.cc

Moved runtime::metadata to be ExecutorCodegeMetadata as it contains metadata produced by ExecutorCodegen for actual code generation (not a runtime component).
ylc pushed a commit to ylc/tvm that referenced this pull request Feb 16, 2022
This commit integrates USMP with the AoT executor codegen. Additionally, this commit introduces two PassContext options to disable_usmp and disable_storage_rewrite.

Moved PrintType from codegen_c.cc to codegen_source_base.cc to be accessible by source_module.cc

Moved runtime::metadata to be ExecutorCodegeMetadata as it contains metadata produced by ExecutorCodegen for actual code generation (not a runtime component).
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.

4 participants