-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[pytorch] introduce INTERN_DISABLE_AUTOGRAD flag to create inference only library for mobile #25697
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
Conversation
…only library for mobile Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. Test Plan: - will check CI; - test mobile build in sample app;
… inference only library for mobile" Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. Test Plan: - will check CI; - test mobile build in sample app; Differential Revision: [D17202733](https://our.internmc.facebook.com/intern/diff/D17202733)
… inference only library for mobile" Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. When INTERN_DISABLE_AUTOGRAD is set: * On CMake side we exclude Functions.h/cpp, VariableType*.h/cpp, VariableTypeManual.cpp from the build process. Still keep variable_factories.h as we rely on it to create variables instead of tensors. * In source code we gate a couple autograd references (in autograd/variable.cpp) with C10_MOBILE (technically we should use a dedicated c macro but its maintenance cost is higher than cmake macro as we have several build systems to change). * Pass --disable-autograd flag to codegen script, which will stop generating Functions/VariableType code. And for variable_factories.h it will stop generating tracing code. Why we need this change if it's already not calling VariableType and autograd stuff with USE_STATIC_DISPATCH=ON for mobile? It's trying to reduce static library size for iOS build, for which it's relatively harder to strip size with linker approach. Why we need make involved change into codegen script? There isn't a global config system in codegen - autograd/env.py provides similar functionality but it says not adding anything there. Test Plan: - will check CI; - test mobile build in sample app; Differential Revision: [D17202733](https://our.internmc.facebook.com/intern/diff/D17202733)
…only library for mobile Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. When INTERN_DISABLE_AUTOGRAD is set: * On CMake side we exclude Functions.h/cpp, VariableType*.h/cpp, VariableTypeManual.cpp from the build process. Still keep variable_factories.h as we rely on it to create variables instead of tensors. * In source code we gate a couple autograd references (in autograd/variable.cpp) with C10_MOBILE (technically we should use a dedicated c macro but its maintenance cost is higher than cmake macro as we have several build systems to change). * Pass --disable-autograd flag to codegen script, which will stop generating Functions/VariableType code. And for variable_factories.h it will stop generating tracing code. Why we need this change if it's already not calling VariableType and autograd stuff with USE_STATIC_DISPATCH=ON for mobile? It's trying to reduce static library size for iOS build, for which it's relatively harder to strip size with linker approach. Why we need make involved change into codegen script? There isn't a global config system in codegen - autograd/env.py provides similar functionality but it says not adding anything there. Test Plan: - will check CI; - test mobile build in sample app; ghstack-source-id: 31317fc Pull Request resolved: #25697
torch/csrc/autograd/variable.cpp
Outdated
| if (!diff_view_meta->grad_fn_ && !diff_view_meta->base_.requires_grad()) { | ||
| return diff_view_meta->grad_fn_; | ||
| } | ||
| #ifndef C10_MOBILE |
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.
as mentioned over chat, this part seems difficult to maintain.
The rest doesn't seem to be adding that much complexity, because we already expose AutoNonVariableType as part of the pseudo-public interface and you are just slicing along that border.
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.
The reason this is commented out is, I assume, because of the direct reference to generated::AsStridedBackward? That doesn't seem too bad to me.
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.
Yes, generated::AsStridedBackward is the main blocker.
Ok, I updated the PR to keep the Functions.h/cpp for now to keep generated::AsStridedBackward and remove #if/#endif here.
In next PR I can update the codegen script to only generate this single function for mobile build - Does it sound better than the gating? @gchanan
I wanted to claim that it should (morally) be possible to reduce the size of a static library by specifying what symbols you want to keep, and then doing a DCE with those symbols as roots. But I spent a while googling and it doesn't seem like this is a thing people actually do. I want to confirm that the static library size for iOS is a cosmetic issue: in the end, you'll still end up with an executable of the same size--it's just that it looks bad if your static library looks big, is that right? |
… inference only library for mobile" Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. When INTERN_DISABLE_AUTOGRAD is set: * On CMake side we exclude Functions.h/cpp, VariableType*.h/cpp, VariableTypeManual.cpp from the build process. Still keep variable_factories.h as we rely on it to create variables instead of tensors. * In source code we gate a couple autograd references (in autograd/variable.cpp) with C10_MOBILE (technically we should use a dedicated c macro but its maintenance cost is higher than cmake macro as we have several build systems to change). * Pass --disable-autograd flag to codegen script, which will stop generating Functions/VariableType code. And for variable_factories.h it will stop generating tracing code. Why we need this change if it's already not calling VariableType and autograd stuff with USE_STATIC_DISPATCH=ON for mobile? It's trying to reduce static library size for iOS build, for which it's relatively harder to strip size with linker approach. Why we need make involved change into codegen script? There isn't a global config system in codegen - autograd/env.py provides similar functionality but it says not adding anything there. Test Plan: - will check CI; - test mobile build in sample app; Differential Revision: [D17202733](https://our.internmc.facebook.com/intern/diff/D17202733)
Correct |
… inference only library for mobile" Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. When INTERN_DISABLE_AUTOGRAD is set: * On CMake side we exclude Functions.h/cpp, VariableType*.h/cpp, VariableTypeManual.cpp from the build process. Still keep variable_factories.h as we rely on it to create variables instead of tensors. * In source code we gate a couple autograd references (in autograd/variable.cpp) with C10_MOBILE (technically we should use a dedicated c macro but its maintenance cost is higher than cmake macro as we have several build systems to change). * Pass --disable-autograd flag to codegen script, which will stop generating Functions/VariableType code. And for variable_factories.h it will stop generating tracing code. Why we need this change if it's already not calling VariableType and autograd stuff with USE_STATIC_DISPATCH=ON for mobile? It's trying to reduce static library size for iOS build, for which it's relatively harder to strip size with linker approach. Why we need make involved change into codegen script? There isn't a global config system in codegen - autograd/env.py provides similar functionality but it says not adding anything there. Test Plan: - will check CI; - test mobile build in sample app; Differential Revision: [D17202733](https://our.internmc.facebook.com/intern/diff/D17202733)
… inference only library for mobile" Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. When INTERN_DISABLE_AUTOGRAD is set: * On CMake side we exclude Functions.h/cpp, VariableType*.h/cpp, VariableTypeManual.cpp from the build process. Still keep variable_factories.h as we rely on it to create variables instead of tensors. * In source code we gate a couple autograd references (in autograd/variable.cpp) with C10_MOBILE (technically we should use a dedicated c macro but its maintenance cost is higher than cmake macro as we have several build systems to change). * Pass --disable-autograd flag to codegen script, which will stop generating Functions/VariableType code. And for variable_factories.h it will stop generating tracing code. Edit: in this diff we will keep Functions.h/cpp to avoid changing source code. Why we need this change if it's already not calling VariableType and autograd stuff with USE_STATIC_DISPATCH=ON for mobile? It's trying to reduce static library size for iOS build, for which it's relatively harder to strip size with linker approach. Why we need make involved change into codegen script? There isn't a global config system in codegen - autograd/env.py provides similar functionality but it says not adding anything there. Test Plan: - will check CI; - test mobile build in sample app; Pull Request resolved: #25697 Differential Revision: [D17202733](https://our.internmc.facebook.com/intern/diff/D17202733)
…D flag to create inference only library for mobile" Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. When INTERN_DISABLE_AUTOGRAD is set: * On CMake side we exclude Functions.h/cpp, VariableType*.h/cpp, VariableTypeManual.cpp from the build process. Still keep variable_factories.h as we rely on it to create variables instead of tensors. * In source code we gate a couple autograd references (in autograd/variable.cpp) with C10_MOBILE (technically we should use a dedicated c macro but its maintenance cost is higher than cmake macro as we have several build systems to change). * Pass --disable-autograd flag to codegen script, which will stop generating Functions/VariableType code. And for variable_factories.h it will stop generating tracing code. Edit: in this diff we will keep Functions.h/cpp to avoid changing source code. Why we need this change if it's already not calling VariableType and autograd stuff with USE_STATIC_DISPATCH=ON for mobile? It's trying to reduce static library size for iOS build, for which it's relatively harder to strip size with linker approach. Why we need make involved change into codegen script? There isn't a global config system in codegen - autograd/env.py provides similar functionality but it says not adding anything there. Test Plan: - will check CI; - test mobile build in sample app; Pull Request resolved: #25697 Differential Revision: [D17202733](https://our.internmc.facebook.com/intern/diff/D17202733)
…only library for mobile Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. When INTERN_DISABLE_AUTOGRAD is set: * On CMake side we exclude Functions.h/cpp, VariableType*.h/cpp, VariableTypeManual.cpp from the build process. Still keep variable_factories.h as we rely on it to create variables instead of tensors. * In source code we gate a couple autograd references (in autograd/variable.cpp) with C10_MOBILE (technically we should use a dedicated c macro but its maintenance cost is higher than cmake macro as we have several build systems to change). * Pass --disable-autograd flag to codegen script, which will stop generating Functions/VariableType code. And for variable_factories.h it will stop generating tracing code. Edit: in this diff we will keep Functions.h/cpp to avoid changing source code. Why we need this change if it's already not calling VariableType and autograd stuff with USE_STATIC_DISPATCH=ON for mobile? It's trying to reduce static library size for iOS build, for which it's relatively harder to strip size with linker approach. Why we need make involved change into codegen script? There isn't a global config system in codegen - autograd/env.py provides similar functionality but it says not adding anything there. Test Plan: - will check CI; - test mobile build in sample app; ghstack-source-id: 8f45c06 Pull Request resolved: #25697
…D flag to create inference only library for mobile" Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. When INTERN_DISABLE_AUTOGRAD is set: * On CMake side we exclude Functions.h/cpp, VariableType*.h/cpp, VariableTypeManual.cpp from the build process. Still keep variable_factories.h as we rely on it to create variables instead of tensors. * In source code we gate a couple autograd references (in autograd/variable.cpp) with C10_MOBILE (technically we should use a dedicated c macro but its maintenance cost is higher than cmake macro as we have several build systems to change). * Pass --disable-autograd flag to codegen script, which will stop generating Functions/VariableType code. And for variable_factories.h it will stop generating tracing code. Edit: in this diff we will keep Functions.h/cpp to avoid changing source code. Why we need this change if it's already not calling VariableType and autograd stuff with USE_STATIC_DISPATCH=ON for mobile? It's trying to reduce static library size for iOS build, for which it's relatively harder to strip size with linker approach. Why we need make involved change into codegen script? There isn't a global config system in codegen - autograd/env.py provides similar functionality but it says not adding anything there. Test Plan: - will check CI; - test mobile build in sample app; Pull Request resolved: #25697 Differential Revision: [D17202733](https://our.internmc.facebook.com/intern/diff/D17202733)
|
|
||
| # Load deprecated signatures | ||
| deprecated = load_deprecated_signatures( | ||
| aten_decls, os.path.join(autograd_dir, 'deprecated.yaml')) |
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.
Oh? Is this dead? Joyous day!
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.
It's still used by gen_autograd_python code path :)
load_deprecated_signatures() doesn't seem to have side-effect so I assume it's safe to delete since the result is not used here.
… inference only library for mobile" Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. When INTERN_DISABLE_AUTOGRAD is set: * On CMake side we exclude Functions.h/cpp, VariableType*.h/cpp, VariableTypeManual.cpp from the build process. Still keep variable_factories.h as we rely on it to create variables instead of tensors. * In source code we gate a couple autograd references (in autograd/variable.cpp) with C10_MOBILE (technically we should use a dedicated c macro but its maintenance cost is higher than cmake macro as we have several build systems to change). * Pass --disable-autograd flag to codegen script, which will stop generating Functions/VariableType code. And for variable_factories.h it will stop generating tracing code. Edit: in this diff we will keep Functions.h/cpp to avoid changing source code. Why we need this change if it's already not calling VariableType and autograd stuff with USE_STATIC_DISPATCH=ON for mobile? It's trying to reduce static library size for iOS build, for which it's relatively harder to strip size with linker approach. Why we need make involved change into codegen script? There isn't a global config system in codegen - autograd/env.py provides similar functionality but it says not adding anything there. Test Plan: - will check CI; - test mobile build in sample app; Pull Request resolved: #25697 Differential Revision: [D17202733](https://our.internmc.facebook.com/intern/diff/D17202733)
…D flag to create inference only library for mobile" Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. When INTERN_DISABLE_AUTOGRAD is set: * On CMake side we exclude Functions.h/cpp, VariableType*.h/cpp, VariableTypeManual.cpp from the build process. Still keep variable_factories.h as we rely on it to create variables instead of tensors. * In source code we gate a couple autograd references (in autograd/variable.cpp) with C10_MOBILE (technically we should use a dedicated c macro but its maintenance cost is higher than cmake macro as we have several build systems to change). * Pass --disable-autograd flag to codegen script, which will stop generating Functions/VariableType code. And for variable_factories.h it will stop generating tracing code. Edit: in this diff we will keep Functions.h/cpp to avoid changing source code. Why we need this change if it's already not calling VariableType and autograd stuff with USE_STATIC_DISPATCH=ON for mobile? It's trying to reduce static library size for iOS build, for which it's relatively harder to strip size with linker approach. Why we need make involved change into codegen script? There isn't a global config system in codegen - autograd/env.py provides similar functionality but it says not adding anything there. Test Plan: - will check CI; - test mobile build in sample app; Pull Request resolved: #25697 Differential Revision: [D17202733](https://our.internmc.facebook.com/intern/diff/D17202733)
…able_autograd is set" Summary: As discussed on PR #25697 - to remove autograd/functions.* without using intrusive #if/#else we need whitelist "AsStridedBackward" used by variable.cpp. Test Plan: - builds and runs with stacked diffs Pull Request resolved: #25817 Differential Revision: [D17247235](https://our.internmc.facebook.com/intern/diff/D17247235)
…able_autograd is set" Summary: As discussed on PR #25697 - to remove autograd/functions.* without using intrusive #if/#else we need whitelist "AsStridedBackward" used by variable.cpp. Test Plan: - builds and runs with stacked diffs Pull Request resolved: #25817 Differential Revision: [D17247235](https://our.internmc.facebook.com/intern/diff/D17247235)
… inference only library for mobile" Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. When INTERN_DISABLE_AUTOGRAD is set: * On CMake side we exclude Functions.h/cpp, VariableType*.h/cpp, VariableTypeManual.cpp from the build process. Still keep variable_factories.h as we rely on it to create variables instead of tensors. * In source code we gate a couple autograd references (in autograd/variable.cpp) with C10_MOBILE (technically we should use a dedicated c macro but its maintenance cost is higher than cmake macro as we have several build systems to change). * Pass --disable-autograd flag to codegen script, which will stop generating Functions/VariableType code. And for variable_factories.h it will stop generating tracing code. Edit: in this diff we will keep Functions.h/cpp to avoid changing source code. Why we need this change if it's already not calling VariableType and autograd stuff with USE_STATIC_DISPATCH=ON for mobile? It's trying to reduce static library size for iOS build, for which it's relatively harder to strip size with linker approach. Why we need make involved change into codegen script? There isn't a global config system in codegen - autograd/env.py provides similar functionality but it says not adding anything there. Test Plan: - will check CI; - test mobile build in sample app; Pull Request resolved: #25697 Differential Revision: [D17202733](https://our.internmc.facebook.com/intern/diff/D17202733)
…D flag to create inference only library for mobile" Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. When INTERN_DISABLE_AUTOGRAD is set: * On CMake side we exclude Functions.h/cpp, VariableType*.h/cpp, VariableTypeManual.cpp from the build process. Still keep variable_factories.h as we rely on it to create variables instead of tensors. * In source code we gate a couple autograd references (in autograd/variable.cpp) with C10_MOBILE (technically we should use a dedicated c macro but its maintenance cost is higher than cmake macro as we have several build systems to change). * Pass --disable-autograd flag to codegen script, which will stop generating Functions/VariableType code. And for variable_factories.h it will stop generating tracing code. Edit: in this diff we will keep Functions.h/cpp to avoid changing source code. Why we need this change if it's already not calling VariableType and autograd stuff with USE_STATIC_DISPATCH=ON for mobile? It's trying to reduce static library size for iOS build, for which it's relatively harder to strip size with linker approach. Why we need make involved change into codegen script? There isn't a global config system in codegen - autograd/env.py provides similar functionality but it says not adding anything there. Test Plan: - will check CI; - test mobile build in sample app; Pull Request resolved: #25697 Differential Revision: [D17202733](https://our.internmc.facebook.com/intern/diff/D17202733)
…able_autograd is set" Summary: As discussed on PR #25697 - to remove autograd/functions.* without using intrusive #if/#else we need whitelist "AsStridedBackward" used by variable.cpp. Test Plan: - builds and runs with stacked diffs Pull Request resolved: #25817 Differential Revision: [D17247235](https://our.internmc.facebook.com/intern/diff/D17247235)
… inference only library for mobile" Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. When INTERN_DISABLE_AUTOGRAD is set: * On CMake side we exclude Functions.h/cpp, VariableType*.h/cpp, VariableTypeManual.cpp from the build process. Still keep variable_factories.h as we rely on it to create variables instead of tensors. * In source code we gate a couple autograd references (in autograd/variable.cpp) with C10_MOBILE (technically we should use a dedicated c macro but its maintenance cost is higher than cmake macro as we have several build systems to change). * Pass --disable-autograd flag to codegen script, which will stop generating Functions/VariableType code. And for variable_factories.h it will stop generating tracing code. Edit: in this diff we will keep Functions.h/cpp to avoid changing source code. Why we need this change if it's already not calling VariableType and autograd stuff with USE_STATIC_DISPATCH=ON for mobile? It's trying to reduce static library size for iOS build, for which it's relatively harder to strip size with linker approach. Why we need make involved change into codegen script? There isn't a global config system in codegen - autograd/env.py provides similar functionality but it says not adding anything there. Test Plan: - will check CI; - test mobile build in sample app; Pull Request resolved: #25697 Differential Revision: [D17202733](https://our.internmc.facebook.com/intern/diff/D17202733)
…D flag to create inference only library for mobile" Summary: This is the first of a series of changes to reduce build size by cutting autograd functions from mobile build. When INTERN_DISABLE_AUTOGRAD is set: * On CMake side we exclude Functions.h/cpp, VariableType*.h/cpp, VariableTypeManual.cpp from the build process. Still keep variable_factories.h as we rely on it to create variables instead of tensors. * In source code we gate a couple autograd references (in autograd/variable.cpp) with C10_MOBILE (technically we should use a dedicated c macro but its maintenance cost is higher than cmake macro as we have several build systems to change). * Pass --disable-autograd flag to codegen script, which will stop generating Functions/VariableType code. And for variable_factories.h it will stop generating tracing code. Edit: in this diff we will keep Functions.h/cpp to avoid changing source code. Why we need this change if it's already not calling VariableType and autograd stuff with USE_STATIC_DISPATCH=ON for mobile? It's trying to reduce static library size for iOS build, for which it's relatively harder to strip size with linker approach. Why we need make involved change into codegen script? There isn't a global config system in codegen - autograd/env.py provides similar functionality but it says not adding anything there. Test Plan: - will check CI; - test mobile build in sample app; Pull Request resolved: #25697 Differential Revision: [D17202733](https://our.internmc.facebook.com/intern/diff/D17202733)
…able_autograd is set" Summary: As discussed on PR #25697 - to remove autograd/functions.* without using intrusive #if/#else we need whitelist "AsStridedBackward" used by variable.cpp. Test Plan: - builds and runs with stacked diffs Pull Request resolved: #25817 Differential Revision: [D17247235](https://our.internmc.facebook.com/intern/diff/D17247235)
…n codegen if disable_autograd is set" Summary: As discussed on PR #25697 - to remove autograd/functions.* without using intrusive #if/#else we need whitelist "AsStridedBackward" used by variable.cpp. Test Plan: - builds and runs with stacked diffs Pull Request resolved: #25817 Differential Revision: [D17247235](https://our.internmc.facebook.com/intern/diff/D17247235)
…able_autograd is set" Summary: As discussed on PR #25697 - to remove autograd/functions.* without using intrusive #if/#else we need whitelist "AsStridedBackward" used by variable.cpp. Test Plan: - builds and runs with stacked diffs Pull Request resolved: #25817 Differential Revision: [D17247235](https://our.internmc.facebook.com/intern/diff/D17247235)
…n codegen if disable_autograd is set" Summary: As discussed on PR #25697 - to remove autograd/functions.* without using intrusive #if/#else we need whitelist "AsStridedBackward" used by variable.cpp. Test Plan: - builds and runs with stacked diffs Pull Request resolved: #25817 Differential Revision: [D17247235](https://our.internmc.facebook.com/intern/diff/D17247235)
…able_autograd is set" Summary: As discussed on PR #25697 - to remove autograd/functions.* without using intrusive #if/#else we need whitelist "AsStridedBackward" used by variable.cpp. Test Plan: - builds and runs with stacked diffs Pull Request resolved: #25817 Differential Revision: [D17247235](https://our.internmc.facebook.com/intern/diff/D17247235)
…n codegen if disable_autograd is set" Summary: As discussed on PR #25697 - to remove autograd/functions.* without using intrusive #if/#else we need whitelist "AsStridedBackward" used by variable.cpp. Test Plan: - builds and runs with stacked diffs Pull Request resolved: #25817 Differential Revision: [D17247235](https://our.internmc.facebook.com/intern/diff/D17247235)
…able_autograd is set" Summary: As discussed on PR #25697 - to remove autograd/functions.* without using intrusive #if/#else we need whitelist "AsStridedBackward" used by variable.cpp. Test Plan: - builds and runs with stacked diffs Pull Request resolved: #25817 Differential Revision: [D17247235](https://our.internmc.facebook.com/intern/diff/D17247235)
…n codegen if disable_autograd is set" Summary: As discussed on PR #25697 - to remove autograd/functions.* without using intrusive #if/#else we need whitelist "AsStridedBackward" used by variable.cpp. Test Plan: - builds and runs with stacked diffs Pull Request resolved: #25817 Differential Revision: [D17247235](https://our.internmc.facebook.com/intern/diff/D17247235)
…able_autograd is set" Summary: As discussed on PR #25697 - to remove autograd/functions.* without using intrusive #if/#else we need whitelist "AsStridedBackward" used by variable.cpp. Test Plan: - builds and runs with stacked diffs Pull Request resolved: #25817 Differential Revision: [D17247235](https://our.internmc.facebook.com/intern/diff/D17247235)
|
This is already landed: 8485710 Don't know why it's not closed automatically... |
Stack from ghstack:
Summary:
This is the first of a series of changes to reduce build size by cutting
autograd functions from mobile build.
When INTERN_DISABLE_AUTOGRAD is set:
VariableTypeManual.cpp from the build process. Still keep variable_factories.h
as we rely on it to create variables instead of tensors.
with C10_MOBILE (technically we should use a dedicated c macro but its
maintenance cost is higher than cmake macro as we have several build systems
to change).
Functions/VariableType code. And for variable_factories.h it will stop
generating tracing code.
Edit: in this diff we will keep Functions.h/cpp to avoid changing source code.
Why we need this change if it's already not calling VariableType and autograd
stuff with USE_STATIC_DISPATCH=ON for mobile?
It's trying to reduce static library size for iOS build, for which it's
relatively harder to strip size with linker approach.
Why we need make involved change into codegen script?
There isn't a global config system in codegen - autograd/env.py provides similar
functionality but it says not adding anything there.
Test Plan:
Pull Request resolved: #25697
Differential Revision: D17202733