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

[BYOC] Allow custom codegens to register their own constant updater #6697

Merged
merged 6 commits into from
Oct 30, 2020

Conversation

mbaret
Copy link
Contributor

@mbaret mbaret commented Oct 16, 2020

Currently, all codegens using BYOC must make use of the default ConstantUpdater pass. However, certain codegens, like Ethos-N, don't want to store any constants in metadata module. This provides an interface (via a global) to register a custom constant updating method and assigns a 'null' updater for the Ethos-N codegen.

@mbaret
Copy link
Contributor Author

mbaret commented Oct 16, 2020

cc @manupa-arm @zhiics @comaniac

@mbaret
Copy link
Contributor Author

mbaret commented Oct 27, 2020

It seems the custom updater I registered in the test persists between tests in CI and causes failures. Is there a way to unregister a function? @tqchen

@tqchen
Copy link
Member

tqchen commented Oct 27, 2020

this is because pytest will run all testcases together, remove a global func exist in c++ API https://github.com/apache/incubator-tvm/blob/main/src/runtime/registry.cc#L77 we could expose that as a PackedFunc in tvm._ffi.remove_global_func(name)

Currently, all codegens using BYOC must make use of the default
ConstantUpdater pass. However, certain codegens, like Ethos-N,
don't want to store any constants in metadata module. This
provides an interface (via a global) to register a custom
constant updating method and assigns a 'null' updater for the
Ethos-N codegen.

Change-Id: Ibd71d3091f992362eeede5d894eedb373b2dbc8f
Change-Id: I0ade81af9002d413c5b20a50488018e8cd8d8bad
Change-Id: I61967bc4997efb87f87b49dad7e0a660c536ef35
Change-Id: Iea9ee0f689683512fa114afeadeccb7fc9048e4f
Change-Id: I8009940bb2ac949f2c3f0d72c943a5b74afd6954
@manupak
Copy link
Contributor

manupak commented Oct 29, 2020

LGTM

Copy link
Contributor

@leandron leandron left a comment

Choose a reason for hiding this comment

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

It looks like there some CI issue within the validation of this PR, maybe just need to re trigger it.
FWIW, I successfully tested this locally on my machine to generate Ethos-N compiled modules.

Change-Id: I83c8c6f92cfe3be3a7e811e98a4eec17590186ff
@zhiics zhiics merged commit 7196eb8 into apache:main Oct 30, 2020
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 2, 2020
…pache#6697)

* [BYOC] Allow custom codegens to register their own constant updater

Currently, all codegens using BYOC must make use of the default
ConstantUpdater pass. However, certain codegens, like Ethos-N,
don't want to store any constants in metadata module. This
provides an interface (via a global) to register a custom
constant updating method and assigns a 'null' updater for the
Ethos-N codegen.

Change-Id: Ibd71d3091f992362eeede5d894eedb373b2dbc8f

* Fix to use symbol in const name

Change-Id: I0ade81af9002d413c5b20a50488018e8cd8d8bad

* Remove ;

Change-Id: I61967bc4997efb87f87b49dad7e0a660c536ef35

* Remove ccompiler constant updater

Change-Id: Iea9ee0f689683512fa114afeadeccb7fc9048e4f

* Unregister updater after test

Change-Id: I8009940bb2ac949f2c3f0d72c943a5b74afd6954

* Create UpdateConstants utility function

Change-Id: I83c8c6f92cfe3be3a7e811e98a4eec17590186ff
trevor-m pushed a commit to trevor-m/tvm that referenced this pull request Dec 4, 2020
…pache#6697)

* [BYOC] Allow custom codegens to register their own constant updater

Currently, all codegens using BYOC must make use of the default
ConstantUpdater pass. However, certain codegens, like Ethos-N,
don't want to store any constants in metadata module. This
provides an interface (via a global) to register a custom
constant updating method and assigns a 'null' updater for the
Ethos-N codegen.

Change-Id: Ibd71d3091f992362eeede5d894eedb373b2dbc8f

* Fix to use symbol in const name

Change-Id: I0ade81af9002d413c5b20a50488018e8cd8d8bad

* Remove ;

Change-Id: I61967bc4997efb87f87b49dad7e0a660c536ef35

* Remove ccompiler constant updater

Change-Id: Iea9ee0f689683512fa114afeadeccb7fc9048e4f

* Unregister updater after test

Change-Id: I8009940bb2ac949f2c3f0d72c943a5b74afd6954

* Create UpdateConstants utility function

Change-Id: I83c8c6f92cfe3be3a7e811e98a4eec17590186ff
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Dec 4, 2020
…pache#6697)

* [BYOC] Allow custom codegens to register their own constant updater

Currently, all codegens using BYOC must make use of the default
ConstantUpdater pass. However, certain codegens, like Ethos-N,
don't want to store any constants in metadata module. This
provides an interface (via a global) to register a custom
constant updating method and assigns a 'null' updater for the
Ethos-N codegen.

Change-Id: Ibd71d3091f992362eeede5d894eedb373b2dbc8f

* Fix to use symbol in const name

Change-Id: I0ade81af9002d413c5b20a50488018e8cd8d8bad

* Remove ;

Change-Id: I61967bc4997efb87f87b49dad7e0a660c536ef35

* Remove ccompiler constant updater

Change-Id: Iea9ee0f689683512fa114afeadeccb7fc9048e4f

* Unregister updater after test

Change-Id: I8009940bb2ac949f2c3f0d72c943a5b74afd6954

* Create UpdateConstants utility function

Change-Id: I83c8c6f92cfe3be3a7e811e98a4eec17590186ff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants