-
Notifications
You must be signed in to change notification settings - Fork 537
[ExecuTorch] Separate extension.Module
Namespaces from Aten and non-Aten
#10576
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
base: gh/zhenyan-zhang-meta/7/base
Are you sure you want to change the base?
[ExecuTorch] Separate extension.Module
Namespaces from Aten and non-Aten
#10576
Conversation
…-Aten Separate `extension.Module` Namespaces to be `executorch::extension::module` and `executorch::extension::module_aten`, otherwise in the future there will be issues like P1799454769. It's similar to what we already did for bundled_program in #10307 Differential Revision: [D73903870](https://our.internmc.facebook.com/intern/diff/D73903870/) [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/10576
Note: Links to docs will display an error until the docs builds have been completed. This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D73903870 |
Something seems off, not sure we can just introduce macros like that in public APIs. |
@shoumikhin This is a fix to unblock future issues where we see targets using both aten and non-aten together and there will be issues like:
But the problem is that, in original implementation 361b295 it will break existing usages of the public API. The workaround here is that we introduce a namespace alias, so that existing use cases won't get affected. Since namespace alias doesn't create additional symbols, there won't be duplicate symbol issue. The change now looks more straightforward. Also cc @larryliu0820 @tarun292 if you have other context that could justify separating namespaces. At least I think since Also cc @Gasoonjia |
…ten and non-Aten" Separate `extension.Module` Namespaces to be `executorch::extension::module` and `executorch::extension::module_aten`, otherwise in the future there will be issues like P1799454769. It's similar to what we already did for bundled_program in #10307 Differential Revision: [D73903870](https://our.internmc.facebook.com/intern/diff/D73903870/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D73903870 |
…ten and non-Aten" # Context Separate `extension.Module` Namespaces to be `executorch::extension::module` and `executorch::extension::module::aten`, otherwise if a package relies on both aten and non-aten of the same implementation and the namespace is the same, there will be duplicate symbol issue like: ``` ld.lld: error: duplicate symbol: vtable for executorch::extension::Module >>> defined at {redacted}/executorch/extension/module/__module__/__stripped__/module.cpp.pic.stripped.o:(vtable for executorch::extension::Module) >>> defined at {redacted}/executorch/extension/module/__module_aten__/__stripped__/module.cpp.pic.stripped.o: ``` # Proposal Doing something similar to what we already did for `bundled_program` in #10307 Since `extension.Module` is a public API, we introduce a namespace alias, so that existing use cases won't get affected. Since namespace alias doesn't create additional symbols, there won't be duplicate symbol issue. Differential Revision: [D73903870](https://our.internmc.facebook.com/intern/diff/D73903870/) [ghstack-poisoned]
This pull request was exported from Phabricator. Differential Revision: D73903870 |
Sorry, I still don't get the bigger picture and need to look closer at where we're heading by introducing this pattern. |
@shoumikhin I've provided some detailed context in the internal diff, basically we see places where both aten and non-aten version of To justify the current change:
|
I'm skeptical of the original goal to support mixing ATen and non-ATen mode builds of ExecuTorch files in the same binary. I suspect that that is just asking for ODR violations to crop up eventually. |
Is this a yes to this change, since this change fixes the ODR violation of this module. Seems like similar things has been done for all deps of |
No, I'm saying that we should instead stop mixing aten mode with non-aten mode. |
Stack from ghstack (oldest at bottom):
PyBundledModule
withextension.BundledModule
#10450extension.BundledModule
to Wrapextension.Module
with Bundled Program Logic #10449extension.Module
Namespaces from Aten and non-Aten #10576Context
Separate
extension.Module
Namespaces to beexecutorch::extension::module
andexecutorch::extension::module::aten
, otherwise if a package relies on both aten and non-aten of the same implementation and the namespace is the same, there will be duplicate symbol issue like:Proposal
Doing something similar to what we already did for
bundled_program
in #10307Since
extension.Module
is a public API, we introduce a namespace alias, so that existing use cases won't get affected. Since namespace alias doesn't create additional symbols, there won't be duplicate symbol issue.Differential Revision: D73903870