-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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] Introducing AOT in TVM #7785
Conversation
Thanks for this awesome contribution @giuseros, its definitely a big milestone for the project. I looked through your changes and didn't find any docs or tutorials on how to use the AOT. Although there are some tests that show it being used, I think a doc would go a long way for encouraging others to use this approach. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work @giuseros and thanks for your contribution! I left a bunch of comments, many for my understanding--so please don't take them as an over-critique of the code. I think this is definitely going in the right direction and I think most of the things to debate here are specifics.
it looks like there are a couple of renames that have landed since you've been working on this:
- DLDevice rename
- GraphExecutor rename
would be great if you could update the PR to include those changes too.
Hi @areusch , just back from holidays. First of all, thank you so much to be so thorough in the review. I appreciate this. Instead of a big single reply, I will gradually reply to your comments |
Hi @jwfromm , Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @giuseros ,
Thanks and looking good.
I did an initial pass of at the export_library_format and build_module.py changes. I will look at the rest in another pass.
Hi all,
|
Spin off from PR apache#7785 to decide the correct name to use for the AOT main executor function Change-Id: I62b29e809a88d797afbb0c155fdc7be80659f7cf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@giuseros did another pass. GH decided that many of my previous comments are now outdated--I know best practice is to force-push iterations on your PR, but can you use git merge to sync it rather than force-pushing? I think there's enough open comments here I won't be able to keep track of them otherwise.
cc @tqchen -- we need to address this limitation with our code review tool.
@giuseros sorry for the delay, lots to review and stuff. I commented on our codegen thread, let's agree on a path forward for this PR, then we can launch some separate discussions about the pieces we're deferring. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @giuseros for your work on this, I think it's shaping up! took another look and replied to our mega-comment on PR direction.
Hi @areusch ,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @giuseros ,
Did a second pass -- my comments are mostly based on the structure and mostly around overloading with graph executor codegen. See if you agree.
d5f2e81
to
218760b
Compare
Hi @manupa-arm , @areusch ,
Please, let me know what you think! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just few nits and a suggestion to add a test case to check BYOC compilation pathway.
Its looking good @giuseros .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here's another review pass, I think this is looking good. couldn't reply to your executor param comment thread while doing this review, will try after I hit submit review.
Hi @areusch ,
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@giuseros great! took another look here. here's my thoughts:
- maybe we could just move the constants in
meta_data.h
into theinclude
tree? the bar for what should be there is "is it user-facing?" I think those two constants are definitely user-facing but nothing in this change promotes the other structs/classes declared there. - I left some comments about when to enable but the impl looks fine.
- merging the two seems fine. left some comments on the top-level ExecutorFactory interface.
- I sort of think the final problem could be fixed by just turning the check on all the time. alternatively, you could create a
crt_config.h
for testing and update the test include path
Hi @areusch , |
Hi @areusch , |
Change-Id: I90bced4e18259a6d42e6a406d93958e204f3859e
Change-Id: I06c9f280de0a9bf0ca5545bbbbfcc70cb66831b3
Change-Id: I739f29779862f05def36e5f3e0722019596d17f8
Change-Id: Ie736f40a5225f4e56e79006753d7732127da5408
Change-Id: I83e16068b93aaccc7a86b79d42f13328bc76b53d
Change-Id: I443d72f53913849f3c28fd6e416162d1ca99e647
Change-Id: I7fefbd0076949b9c38d0abbf2759ebf1502de330
Change-Id: Iad028144d7b394b2dd2fce41a35ca689d1680200
Change-Id: I14286e665dcdba1e9bc10bb5a27dd6ced50372b0
Change-Id: I7b4c966da9680870ceda1704c749ee3bdc751926
Change-Id: Icf62128a604998ed1b7d5af4cbeadf7d39196d0b
@manupa-arm please take another look and explicitly approve if you're okay with this! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
thanks @giuseros for your hard work on this effort and for bearing with me through a long review! and thanks @manupa-arm @jroesch @tqchen @tkonolige @jwfromm for helping to review the PR! |
* [AOT] Introducing AOT in TVM This change adds the code generation and minimal runtime API to use the Ahead Of Time (AOT) compilation flow. The main logic is contained in: - src/relay/backend/aot_codegen.cc Which produces a TIR PrimFunc traversing the Relay graph The runtime interface (authored by @Mousius) leaves a gap for future iterations using platform-specific features from RTOS. Currently AOT runs successfully on x86 in a host OS, running these tests on micro is coming soon. This PR is based on the RFC described here: https://discuss.tvm.apache.org/t/implementing-aot-in-tvm/9206 Co-authored-by: Christopher Sidebottom <Christopher.Sidebottom@arm.com> Change-Id: I9f731c953231f129e1472298915dddc01788efd7 * Rebasing 2 Change-Id: Ia0a533a49960f1cb4bf3c3833511e539cf7c459f * Applying comments/refactoring Change-Id: Iea1832355f8b1d4c921d02c6b4ceec7db3a681c1 * Fixing comments + refactoring - 2 Change-Id: I7200cc17b297e42bf67dcdef6f643e86991ca0a8 * fix linting Change-Id: Iba6544ac7101595696b352b8702345cf916625f6 * fix linting - 2 Change-Id: I7f80d16005f2c621d37a9aae2cbbd61df0277cbe * fix linting - 3 Change-Id: I7a1ba40afeea46d5f122563a20cd4b2f08751a1e * fix tests Change-Id: I1297ccc54dd6d93647f421e0beb226f410bf73f5 * Addressing comments - 3 Change-Id: Id25d1382c30d6d0a0013b5e8986fb8cd886666dc * Addressing comments - 4 Change-Id: Ibe29676abe3b75161b5a0903e007118a8318d862 * fix tests - 2 Change-Id: I2117f9d4392bfd87102ecbef0993c8b320f479a0 * fix tests - 3 Change-Id: Ic0373543b0f9a54dbd4dc32d428272f7293200ba * fix tests - 4 Change-Id: I8a6f229c9a3a9e169779c8d49cbfa3f473348b1f * Addressing comments - 5 Change-Id: Ib9ccd07c87392034a21b2eb70955d0b091b780f1 * fix tests - 5 Change-Id: I4b13c3b548ced414991e83072e9e6fc99b64f939 * fix tests - 6 Change-Id: Id5af1f778ae25bc60849cc054a605181c1b7a765 * addressing comments - 6 Change-Id: Id94a2bbcaae891f9498d41be538f13a952f55b81 * fix linting - 4 Change-Id: I371a0aa5b81824b5a3a1278fac22ace57832027a * add missing file Change-Id: If359bef96dd0773ead4f75f0d9f5234276347e2d * fix build Change-Id: I73fc1feb6f7b5d454a528e3289228484dc2b07d5 * addressing comments - 7 Change-Id: I7f908f3908ffc77e408391f62edcc06f2600c6c2 * addressing comments - 8 Change-Id: I90bced4e18259a6d42e6a406d93958e204f3859e * rebasing Change-Id: Id28751b069bd046f00faee301b2b446b2ea4fab8 * Addressing comments - 9 Change-Id: I06c9f280de0a9bf0ca5545bbbbfcc70cb66831b3 * fix tests - 7 Change-Id: I739f29779862f05def36e5f3e0722019596d17f8 * Addressing comments - 9 Change-Id: Ie736f40a5225f4e56e79006753d7732127da5408 * Applying comments + fixing tests Change-Id: I83e16068b93aaccc7a86b79d42f13328bc76b53d * Applying comments - 10 Change-Id: I443d72f53913849f3c28fd6e416162d1ca99e647 * Addressing comments - 11 Change-Id: I7fefbd0076949b9c38d0abbf2759ebf1502de330 * Addressing comments - 11 Change-Id: Iad028144d7b394b2dd2fce41a35ca689d1680200 * fix tests - 7 Change-Id: I14286e665dcdba1e9bc10bb5a27dd6ced50372b0 * fixing tests -8 Change-Id: I7b4c966da9680870ceda1704c749ee3bdc751926 * fixing tests - 9 Change-Id: Icf62128a604998ed1b7d5af4cbeadf7d39196d0b Co-authored-by: Christopher Sidebottom <Christopher.Sidebottom@arm.com>
* [AOT] Introducing AOT in TVM This change adds the code generation and minimal runtime API to use the Ahead Of Time (AOT) compilation flow. The main logic is contained in: - src/relay/backend/aot_codegen.cc Which produces a TIR PrimFunc traversing the Relay graph The runtime interface (authored by @Mousius) leaves a gap for future iterations using platform-specific features from RTOS. Currently AOT runs successfully on x86 in a host OS, running these tests on micro is coming soon. This PR is based on the RFC described here: https://discuss.tvm.apache.org/t/implementing-aot-in-tvm/9206 Co-authored-by: Christopher Sidebottom <Christopher.Sidebottom@arm.com> Change-Id: I9f731c953231f129e1472298915dddc01788efd7 * Rebasing 2 Change-Id: Ia0a533a49960f1cb4bf3c3833511e539cf7c459f * Applying comments/refactoring Change-Id: Iea1832355f8b1d4c921d02c6b4ceec7db3a681c1 * Fixing comments + refactoring - 2 Change-Id: I7200cc17b297e42bf67dcdef6f643e86991ca0a8 * fix linting Change-Id: Iba6544ac7101595696b352b8702345cf916625f6 * fix linting - 2 Change-Id: I7f80d16005f2c621d37a9aae2cbbd61df0277cbe * fix linting - 3 Change-Id: I7a1ba40afeea46d5f122563a20cd4b2f08751a1e * fix tests Change-Id: I1297ccc54dd6d93647f421e0beb226f410bf73f5 * Addressing comments - 3 Change-Id: Id25d1382c30d6d0a0013b5e8986fb8cd886666dc * Addressing comments - 4 Change-Id: Ibe29676abe3b75161b5a0903e007118a8318d862 * fix tests - 2 Change-Id: I2117f9d4392bfd87102ecbef0993c8b320f479a0 * fix tests - 3 Change-Id: Ic0373543b0f9a54dbd4dc32d428272f7293200ba * fix tests - 4 Change-Id: I8a6f229c9a3a9e169779c8d49cbfa3f473348b1f * Addressing comments - 5 Change-Id: Ib9ccd07c87392034a21b2eb70955d0b091b780f1 * fix tests - 5 Change-Id: I4b13c3b548ced414991e83072e9e6fc99b64f939 * fix tests - 6 Change-Id: Id5af1f778ae25bc60849cc054a605181c1b7a765 * addressing comments - 6 Change-Id: Id94a2bbcaae891f9498d41be538f13a952f55b81 * fix linting - 4 Change-Id: I371a0aa5b81824b5a3a1278fac22ace57832027a * add missing file Change-Id: If359bef96dd0773ead4f75f0d9f5234276347e2d * fix build Change-Id: I73fc1feb6f7b5d454a528e3289228484dc2b07d5 * addressing comments - 7 Change-Id: I7f908f3908ffc77e408391f62edcc06f2600c6c2 * addressing comments - 8 Change-Id: I90bced4e18259a6d42e6a406d93958e204f3859e * rebasing Change-Id: Id28751b069bd046f00faee301b2b446b2ea4fab8 * Addressing comments - 9 Change-Id: I06c9f280de0a9bf0ca5545bbbbfcc70cb66831b3 * fix tests - 7 Change-Id: I739f29779862f05def36e5f3e0722019596d17f8 * Addressing comments - 9 Change-Id: Ie736f40a5225f4e56e79006753d7732127da5408 * Applying comments + fixing tests Change-Id: I83e16068b93aaccc7a86b79d42f13328bc76b53d * Applying comments - 10 Change-Id: I443d72f53913849f3c28fd6e416162d1ca99e647 * Addressing comments - 11 Change-Id: I7fefbd0076949b9c38d0abbf2759ebf1502de330 * Addressing comments - 11 Change-Id: Iad028144d7b394b2dd2fce41a35ca689d1680200 * fix tests - 7 Change-Id: I14286e665dcdba1e9bc10bb5a27dd6ced50372b0 * fixing tests -8 Change-Id: I7b4c966da9680870ceda1704c749ee3bdc751926 * fixing tests - 9 Change-Id: Icf62128a604998ed1b7d5af4cbeadf7d39196d0b Co-authored-by: Christopher Sidebottom <Christopher.Sidebottom@arm.com>
* [AOT] Introducing AOT in TVM This change adds the code generation and minimal runtime API to use the Ahead Of Time (AOT) compilation flow. The main logic is contained in: - src/relay/backend/aot_codegen.cc Which produces a TIR PrimFunc traversing the Relay graph The runtime interface (authored by @Mousius) leaves a gap for future iterations using platform-specific features from RTOS. Currently AOT runs successfully on x86 in a host OS, running these tests on micro is coming soon. This PR is based on the RFC described here: https://discuss.tvm.apache.org/t/implementing-aot-in-tvm/9206 Co-authored-by: Christopher Sidebottom <Christopher.Sidebottom@arm.com> Change-Id: I9f731c953231f129e1472298915dddc01788efd7 * Rebasing 2 Change-Id: Ia0a533a49960f1cb4bf3c3833511e539cf7c459f * Applying comments/refactoring Change-Id: Iea1832355f8b1d4c921d02c6b4ceec7db3a681c1 * Fixing comments + refactoring - 2 Change-Id: I7200cc17b297e42bf67dcdef6f643e86991ca0a8 * fix linting Change-Id: Iba6544ac7101595696b352b8702345cf916625f6 * fix linting - 2 Change-Id: I7f80d16005f2c621d37a9aae2cbbd61df0277cbe * fix linting - 3 Change-Id: I7a1ba40afeea46d5f122563a20cd4b2f08751a1e * fix tests Change-Id: I1297ccc54dd6d93647f421e0beb226f410bf73f5 * Addressing comments - 3 Change-Id: Id25d1382c30d6d0a0013b5e8986fb8cd886666dc * Addressing comments - 4 Change-Id: Ibe29676abe3b75161b5a0903e007118a8318d862 * fix tests - 2 Change-Id: I2117f9d4392bfd87102ecbef0993c8b320f479a0 * fix tests - 3 Change-Id: Ic0373543b0f9a54dbd4dc32d428272f7293200ba * fix tests - 4 Change-Id: I8a6f229c9a3a9e169779c8d49cbfa3f473348b1f * Addressing comments - 5 Change-Id: Ib9ccd07c87392034a21b2eb70955d0b091b780f1 * fix tests - 5 Change-Id: I4b13c3b548ced414991e83072e9e6fc99b64f939 * fix tests - 6 Change-Id: Id5af1f778ae25bc60849cc054a605181c1b7a765 * addressing comments - 6 Change-Id: Id94a2bbcaae891f9498d41be538f13a952f55b81 * fix linting - 4 Change-Id: I371a0aa5b81824b5a3a1278fac22ace57832027a * add missing file Change-Id: If359bef96dd0773ead4f75f0d9f5234276347e2d * fix build Change-Id: I73fc1feb6f7b5d454a528e3289228484dc2b07d5 * addressing comments - 7 Change-Id: I7f908f3908ffc77e408391f62edcc06f2600c6c2 * addressing comments - 8 Change-Id: I90bced4e18259a6d42e6a406d93958e204f3859e * rebasing Change-Id: Id28751b069bd046f00faee301b2b446b2ea4fab8 * Addressing comments - 9 Change-Id: I06c9f280de0a9bf0ca5545bbbbfcc70cb66831b3 * fix tests - 7 Change-Id: I739f29779862f05def36e5f3e0722019596d17f8 * Addressing comments - 9 Change-Id: Ie736f40a5225f4e56e79006753d7732127da5408 * Applying comments + fixing tests Change-Id: I83e16068b93aaccc7a86b79d42f13328bc76b53d * Applying comments - 10 Change-Id: I443d72f53913849f3c28fd6e416162d1ca99e647 * Addressing comments - 11 Change-Id: I7fefbd0076949b9c38d0abbf2759ebf1502de330 * Addressing comments - 11 Change-Id: Iad028144d7b394b2dd2fce41a35ca689d1680200 * fix tests - 7 Change-Id: I14286e665dcdba1e9bc10bb5a27dd6ced50372b0 * fixing tests -8 Change-Id: I7b4c966da9680870ceda1704c749ee3bdc751926 * fixing tests - 9 Change-Id: Icf62128a604998ed1b7d5af4cbeadf7d39196d0b Co-authored-by: Christopher Sidebottom <Christopher.Sidebottom@arm.com>
* [AOT] Introducing AOT in TVM This change adds the code generation and minimal runtime API to use the Ahead Of Time (AOT) compilation flow. The main logic is contained in: - src/relay/backend/aot_codegen.cc Which produces a TIR PrimFunc traversing the Relay graph The runtime interface (authored by @Mousius) leaves a gap for future iterations using platform-specific features from RTOS. Currently AOT runs successfully on x86 in a host OS, running these tests on micro is coming soon. This PR is based on the RFC described here: https://discuss.tvm.apache.org/t/implementing-aot-in-tvm/9206 Co-authored-by: Christopher Sidebottom <Christopher.Sidebottom@arm.com> Change-Id: I9f731c953231f129e1472298915dddc01788efd7 * Rebasing 2 Change-Id: Ia0a533a49960f1cb4bf3c3833511e539cf7c459f * Applying comments/refactoring Change-Id: Iea1832355f8b1d4c921d02c6b4ceec7db3a681c1 * Fixing comments + refactoring - 2 Change-Id: I7200cc17b297e42bf67dcdef6f643e86991ca0a8 * fix linting Change-Id: Iba6544ac7101595696b352b8702345cf916625f6 * fix linting - 2 Change-Id: I7f80d16005f2c621d37a9aae2cbbd61df0277cbe * fix linting - 3 Change-Id: I7a1ba40afeea46d5f122563a20cd4b2f08751a1e * fix tests Change-Id: I1297ccc54dd6d93647f421e0beb226f410bf73f5 * Addressing comments - 3 Change-Id: Id25d1382c30d6d0a0013b5e8986fb8cd886666dc * Addressing comments - 4 Change-Id: Ibe29676abe3b75161b5a0903e007118a8318d862 * fix tests - 2 Change-Id: I2117f9d4392bfd87102ecbef0993c8b320f479a0 * fix tests - 3 Change-Id: Ic0373543b0f9a54dbd4dc32d428272f7293200ba * fix tests - 4 Change-Id: I8a6f229c9a3a9e169779c8d49cbfa3f473348b1f * Addressing comments - 5 Change-Id: Ib9ccd07c87392034a21b2eb70955d0b091b780f1 * fix tests - 5 Change-Id: I4b13c3b548ced414991e83072e9e6fc99b64f939 * fix tests - 6 Change-Id: Id5af1f778ae25bc60849cc054a605181c1b7a765 * addressing comments - 6 Change-Id: Id94a2bbcaae891f9498d41be538f13a952f55b81 * fix linting - 4 Change-Id: I371a0aa5b81824b5a3a1278fac22ace57832027a * add missing file Change-Id: If359bef96dd0773ead4f75f0d9f5234276347e2d * fix build Change-Id: I73fc1feb6f7b5d454a528e3289228484dc2b07d5 * addressing comments - 7 Change-Id: I7f908f3908ffc77e408391f62edcc06f2600c6c2 * addressing comments - 8 Change-Id: I90bced4e18259a6d42e6a406d93958e204f3859e * rebasing Change-Id: Id28751b069bd046f00faee301b2b446b2ea4fab8 * Addressing comments - 9 Change-Id: I06c9f280de0a9bf0ca5545bbbbfcc70cb66831b3 * fix tests - 7 Change-Id: I739f29779862f05def36e5f3e0722019596d17f8 * Addressing comments - 9 Change-Id: Ie736f40a5225f4e56e79006753d7732127da5408 * Applying comments + fixing tests Change-Id: I83e16068b93aaccc7a86b79d42f13328bc76b53d * Applying comments - 10 Change-Id: I443d72f53913849f3c28fd6e416162d1ca99e647 * Addressing comments - 11 Change-Id: I7fefbd0076949b9c38d0abbf2759ebf1502de330 * Addressing comments - 11 Change-Id: Iad028144d7b394b2dd2fce41a35ca689d1680200 * fix tests - 7 Change-Id: I14286e665dcdba1e9bc10bb5a27dd6ced50372b0 * fixing tests -8 Change-Id: I7b4c966da9680870ceda1704c749ee3bdc751926 * fixing tests - 9 Change-Id: Icf62128a604998ed1b7d5af4cbeadf7d39196d0b Co-authored-by: Christopher Sidebottom <Christopher.Sidebottom@arm.com>
This change adds the code generation and minimal runtime API to use the
Ahead Of Time (AOT) compilation flow. The main logic is contained in:
Which produces a TIR PrimFunc traversing the Relay graph
The runtime interface (authored by @Mousius) leaves a gap for future
iterations using platform-specific features from RTOS.
Currently AOT runs successfully on x86 in a host OS, running these
tests on micro is coming soon.
This PR is based on the RFC described here: https://discuss.tvm.apache.org/t/implementing-aot-in-tvm/9206
Co-authored-by: Christopher Sidebottom Christopher.Sidebottom@arm.com