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

[microNPU] Move the compilation to use Target Hooks. #9597

Merged
merged 9 commits into from
Dec 1, 2021

Conversation

manupak
Copy link
Contributor

@manupak manupak commented Nov 26, 2021

This commits moves the current compilation flow
to use target hooks, so that the generated TIR
is provided to unified module to for unified
optimizations.

@manupak
Copy link
Contributor Author

manupak commented Nov 29, 2021

@mbaret @leandron @ekalda PTAL when you have some time.
We need this in a bit urgently as it is a refactor of the codegen and it has the tendency to get conflicted.

If you can provide feedback, I ll create a followup ASAP with addressing them while we could take this in as it is green now.

@manupak
Copy link
Contributor Author

manupak commented Nov 29, 2021

@grant-arm @Mousius

Copy link
Contributor

@ekalda ekalda left a comment

Choose a reason for hiding this comment

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

I don't understand all of it in great detail, but the bits I do understand look good!

Copy link
Contributor

@grant-arm grant-arm left a comment

Choose a reason for hiding this comment

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

Apart from a few nits, it LGTM!

python/tvm/relay/backend/contrib/ethosu/codegen.py Outdated Show resolved Hide resolved
src/relay/backend/contrib/ethosu/source_module.cc Outdated Show resolved Hide resolved
src/relay/backend/contrib/ethosu/source_module.cc Outdated Show resolved Hide resolved
@manupak
Copy link
Contributor Author

manupak commented Nov 29, 2021

Thanks @ekalda @grant-arm for speedy reviews :).
I've created the follow up to anwser the comments : #9605

@manupak
Copy link
Contributor Author

manupak commented Nov 30, 2021

@leandron , do you think whether we can get this version in? Ive opened a follow up : #9605 to capture and address feedback. This should avoid grief from conflicts.

Copy link
Contributor

@huajsj huajsj 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.

include/tvm/tir/transform.h Outdated Show resolved Hide resolved
python/tvm/relay/backend/contrib/ethosu/codegen.py Outdated Show resolved Hide resolved
python/tvm/relay/backend/contrib/ethosu/codegen.py Outdated Show resolved Hide resolved
python/tvm/relay/backend/contrib/ethosu/codegen.py Outdated Show resolved Hide resolved
python/tvm/relay/backend/contrib/ethosu/codegen.py Outdated Show resolved Hide resolved
python/tvm/relay/backend/contrib/ethosu/codegen.py Outdated Show resolved Hide resolved
python/tvm/relay/backend/contrib/ethosu/codegen.py Outdated Show resolved Hide resolved
This commits moves the current compilation flow
to use target hooks, so that the generated TIR
is provided to unified module to for unified
optimizations.

Change-Id: Ib3239a04ab201748e7f1b1ffa503cfe2aa7ccb7b
*Fixing unpacked API tests
*Adding use_device_api target attr to example target hooks

Change-Id: I72c51caa57e9a0c2a538f40eb73939e28d4f112f
* Modifed CLZ test case to support target hooks
* Modifed reference TIR for test to include allocate annotation
* TIR to CS translation tests are modified to run MakeUnpackedAPI

Change-Id: I3a3d28777a6995e7f2b8789e14c5cb0f280dc763
* Added a missed documentation to changes in source module
* Skipping device api test for packed API as microNPU does not
  support it.

Change-Id: I6da1adcf8fdd3f972ec9b37ff530ff673e93058c
* fixed tvmc test use unpacked-api for microNPU compilation

Change-Id: Ib722d91ca3b3e4c6d13075ee0873acb86f487247
* adjust target name.

Change-Id: I862957324440705fb6093939b97b1a00fa1d4b46
* Fixed few typos and cleaned up as per suggestions

Change-Id: I2a744a4bc4015e1884dbef4165252aa13aa30b31
Fixing some typos and change params to
const_dict as it seems more clearer

Change-Id: Ia36a4635a68f6490bcc3eeaa72eeeeaadb6aa7f6
@manupak
Copy link
Contributor Author

manupak commented Dec 1, 2021

Thanks @huajsj . I ve modified and responded to your queries.

Fixing up lookup table tests to use new runtime module
import structure resulted from using target hooks.

Change-Id: I250aedef7cc73edad3812bb7e9aab013ed8bed5b
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.

LGTM. Merging this to avoid further git conflicts, and given that we have #9605 already taking care of follow-up changes.

Thanks @manupa-arm @ekalda @grant-arm @huajsj!

@leandron leandron merged commit c22d80d into apache:main Dec 1, 2021
@manupak
Copy link
Contributor Author

manupak commented Dec 1, 2021

Thanks! @leandron and Im happy to take further comments on this PR which I will include in #9605

@manupak
Copy link
Contributor Author

manupak commented Dec 1, 2021

I've created another follow up PR to modify the CMake to keep utils.cc that carries a Object definition that needs to be compiled always.
#9630

lhutton1 pushed a commit to lhutton1/tvm that referenced this pull request Dec 22, 2021
It looks like in apache#9597 the LayoutOptimizer pass was accidentally removed.
Probably due to a race condition in PR's. Re-enabling this feature.

Change-Id: I4fc16a440f90277c5fcd887715166332af052c6b
manupak pushed a commit that referenced this pull request Dec 23, 2021
* [microNPU] Re-enable LayoutOptimizer pass

It looks like in #9597 the LayoutOptimizer pass was accidentally removed.
Probably due to a race condition in PR's. Re-enabling this feature.

Change-Id: I4fc16a440f90277c5fcd887715166332af052c6b

* change pass ordering

Change-Id: I6e7a22f46660029bbf4be3deb2be929cecf5d365

Co-authored-by: lukhut01 (generated by with_the_same_user script) <lukhut01@e127400.cambridge.arm.com>
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
* [microNPU] Move the compilation to use Target Hooks.

This commits moves the current compilation flow
to use target hooks, so that the generated TIR
is provided to unified module to for unified
optimizations.

Change-Id: Ib3239a04ab201748e7f1b1ffa503cfe2aa7ccb7b

* [microNPU] Move the compilation to use Target Hooks.

*Fixing unpacked API tests
*Adding use_device_api target attr to example target hooks

Change-Id: I72c51caa57e9a0c2a538f40eb73939e28d4f112f

* [microNPU] Move the compilation to use Target Hooks.

* Modifed CLZ test case to support target hooks
* Modifed reference TIR for test to include allocate annotation
* TIR to CS translation tests are modified to run MakeUnpackedAPI

Change-Id: I3a3d28777a6995e7f2b8789e14c5cb0f280dc763

* [microNPU] Move the compilation to use Target Hooks.

* Added a missed documentation to changes in source module
* Skipping device api test for packed API as microNPU does not
  support it.

Change-Id: I6da1adcf8fdd3f972ec9b37ff530ff673e93058c

* [microNPU] Move the compilation to use Target Hooks.

* fixed tvmc test use unpacked-api for microNPU compilation

Change-Id: Ib722d91ca3b3e4c6d13075ee0873acb86f487247

* [microNPU] Move the compilation to use Target Hooks.

* adjust target name.

Change-Id: I862957324440705fb6093939b97b1a00fa1d4b46

* [microNPU] follow up on using target hooks

* Fixed few typos and cleaned up as per suggestions

Change-Id: I2a744a4bc4015e1884dbef4165252aa13aa30b31

* [microNPU] follow up on using target hooks

Fixing some typos and change params to
const_dict as it seems more clearer

Change-Id: Ia36a4635a68f6490bcc3eeaa72eeeeaadb6aa7f6

* [microNPU] Move the compilation to use Target Hooks.

Fixing up lookup table tests to use new runtime module
import structure resulted from using target hooks.

Change-Id: I250aedef7cc73edad3812bb7e9aab013ed8bed5b
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 7, 2022
* [microNPU] Re-enable LayoutOptimizer pass

It looks like in apache#9597 the LayoutOptimizer pass was accidentally removed.
Probably due to a race condition in PR's. Re-enabling this feature.

Change-Id: I4fc16a440f90277c5fcd887715166332af052c6b

* change pass ordering

Change-Id: I6e7a22f46660029bbf4be3deb2be929cecf5d365

Co-authored-by: lukhut01 (generated by with_the_same_user script) <lukhut01@e127400.cambridge.arm.com>
yangulei pushed a commit to yangulei/tvm that referenced this pull request Jan 11, 2022
* [microNPU] Move the compilation to use Target Hooks.

This commits moves the current compilation flow
to use target hooks, so that the generated TIR
is provided to unified module to for unified
optimizations.

Change-Id: Ib3239a04ab201748e7f1b1ffa503cfe2aa7ccb7b

* [microNPU] Move the compilation to use Target Hooks.

*Fixing unpacked API tests
*Adding use_device_api target attr to example target hooks

Change-Id: I72c51caa57e9a0c2a538f40eb73939e28d4f112f

* [microNPU] Move the compilation to use Target Hooks.

* Modifed CLZ test case to support target hooks
* Modifed reference TIR for test to include allocate annotation
* TIR to CS translation tests are modified to run MakeUnpackedAPI

Change-Id: I3a3d28777a6995e7f2b8789e14c5cb0f280dc763

* [microNPU] Move the compilation to use Target Hooks.

* Added a missed documentation to changes in source module
* Skipping device api test for packed API as microNPU does not
  support it.

Change-Id: I6da1adcf8fdd3f972ec9b37ff530ff673e93058c

* [microNPU] Move the compilation to use Target Hooks.

* fixed tvmc test use unpacked-api for microNPU compilation

Change-Id: Ib722d91ca3b3e4c6d13075ee0873acb86f487247

* [microNPU] Move the compilation to use Target Hooks.

* adjust target name.

Change-Id: I862957324440705fb6093939b97b1a00fa1d4b46

* [microNPU] follow up on using target hooks

* Fixed few typos and cleaned up as per suggestions

Change-Id: I2a744a4bc4015e1884dbef4165252aa13aa30b31

* [microNPU] follow up on using target hooks

Fixing some typos and change params to
const_dict as it seems more clearer

Change-Id: Ia36a4635a68f6490bcc3eeaa72eeeeaadb6aa7f6

* [microNPU] Move the compilation to use Target Hooks.

Fixing up lookup table tests to use new runtime module
import structure resulted from using target hooks.

Change-Id: I250aedef7cc73edad3812bb7e9aab013ed8bed5b
yangulei pushed a commit to yangulei/tvm that referenced this pull request Jan 12, 2022
* [microNPU] Move the compilation to use Target Hooks.

This commits moves the current compilation flow
to use target hooks, so that the generated TIR
is provided to unified module to for unified
optimizations.

Change-Id: Ib3239a04ab201748e7f1b1ffa503cfe2aa7ccb7b

* [microNPU] Move the compilation to use Target Hooks.

*Fixing unpacked API tests
*Adding use_device_api target attr to example target hooks

Change-Id: I72c51caa57e9a0c2a538f40eb73939e28d4f112f

* [microNPU] Move the compilation to use Target Hooks.

* Modifed CLZ test case to support target hooks
* Modifed reference TIR for test to include allocate annotation
* TIR to CS translation tests are modified to run MakeUnpackedAPI

Change-Id: I3a3d28777a6995e7f2b8789e14c5cb0f280dc763

* [microNPU] Move the compilation to use Target Hooks.

* Added a missed documentation to changes in source module
* Skipping device api test for packed API as microNPU does not
  support it.

Change-Id: I6da1adcf8fdd3f972ec9b37ff530ff673e93058c

* [microNPU] Move the compilation to use Target Hooks.

* fixed tvmc test use unpacked-api for microNPU compilation

Change-Id: Ib722d91ca3b3e4c6d13075ee0873acb86f487247

* [microNPU] Move the compilation to use Target Hooks.

* adjust target name.

Change-Id: I862957324440705fb6093939b97b1a00fa1d4b46

* [microNPU] follow up on using target hooks

* Fixed few typos and cleaned up as per suggestions

Change-Id: I2a744a4bc4015e1884dbef4165252aa13aa30b31

* [microNPU] follow up on using target hooks

Fixing some typos and change params to
const_dict as it seems more clearer

Change-Id: Ia36a4635a68f6490bcc3eeaa72eeeeaadb6aa7f6

* [microNPU] Move the compilation to use Target Hooks.

Fixing up lookup table tests to use new runtime module
import structure resulted from using target hooks.

Change-Id: I250aedef7cc73edad3812bb7e9aab013ed8bed5b
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* [microNPU] Move the compilation to use Target Hooks.

This commits moves the current compilation flow
to use target hooks, so that the generated TIR
is provided to unified module to for unified
optimizations.

Change-Id: Ib3239a04ab201748e7f1b1ffa503cfe2aa7ccb7b

* [microNPU] Move the compilation to use Target Hooks.

*Fixing unpacked API tests
*Adding use_device_api target attr to example target hooks

Change-Id: I72c51caa57e9a0c2a538f40eb73939e28d4f112f

* [microNPU] Move the compilation to use Target Hooks.

* Modifed CLZ test case to support target hooks
* Modifed reference TIR for test to include allocate annotation
* TIR to CS translation tests are modified to run MakeUnpackedAPI

Change-Id: I3a3d28777a6995e7f2b8789e14c5cb0f280dc763

* [microNPU] Move the compilation to use Target Hooks.

* Added a missed documentation to changes in source module
* Skipping device api test for packed API as microNPU does not
  support it.

Change-Id: I6da1adcf8fdd3f972ec9b37ff530ff673e93058c

* [microNPU] Move the compilation to use Target Hooks.

* fixed tvmc test use unpacked-api for microNPU compilation

Change-Id: Ib722d91ca3b3e4c6d13075ee0873acb86f487247

* [microNPU] Move the compilation to use Target Hooks.

* adjust target name.

Change-Id: I862957324440705fb6093939b97b1a00fa1d4b46

* [microNPU] follow up on using target hooks

* Fixed few typos and cleaned up as per suggestions

Change-Id: I2a744a4bc4015e1884dbef4165252aa13aa30b31

* [microNPU] follow up on using target hooks

Fixing some typos and change params to
const_dict as it seems more clearer

Change-Id: Ia36a4635a68f6490bcc3eeaa72eeeeaadb6aa7f6

* [microNPU] Move the compilation to use Target Hooks.

Fixing up lookup table tests to use new runtime module
import structure resulted from using target hooks.

Change-Id: I250aedef7cc73edad3812bb7e9aab013ed8bed5b
ylc pushed a commit to ylc/tvm that referenced this pull request Jan 13, 2022
* [microNPU] Re-enable LayoutOptimizer pass

It looks like in apache#9597 the LayoutOptimizer pass was accidentally removed.
Probably due to a race condition in PR's. Re-enabling this feature.

Change-Id: I4fc16a440f90277c5fcd887715166332af052c6b

* change pass ordering

Change-Id: I6e7a22f46660029bbf4be3deb2be929cecf5d365

Co-authored-by: lukhut01 (generated by with_the_same_user script) <lukhut01@e127400.cambridge.arm.com>
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.

5 participants