Reapply #9842: Save some size in dtype_util when dtype selective build is not in use#10490
Merged
Reapply #9842: Save some size in dtype_util when dtype selective build is not in use#10490
Conversation
Contributor
Author
|
Stack from ghstack (oldest at bottom): |
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/10490
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit 92357fb with merge base bf5b99a ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Apr 25, 2025
swolchok
commented
Apr 25, 2025
| } | ||
|
|
||
| #ifndef EXECUTORCH_SELECTIVE_BUILD_DTYPE | ||
| inline constexpr const char kGenericElementwiseOpName[] = |
Contributor
Author
There was a problem hiding this comment.
marking this inline was needed for size (it changes the linkage for this, otherwise it's duplicated across translation units) and is a difference from the first attempt.
kimishpatel
reviewed
Apr 28, 2025
Contributor
kimishpatel
left a comment
There was a problem hiding this comment.
I dont think I understand selective dtype build enough to comment here. Maybe @larryliu0820 can
manuelcandales
approved these changes
Apr 29, 2025
kedarnath03
pushed a commit
to kedarnath03/executorch
that referenced
this pull request
Jun 25, 2025
…d is not in use We duplicate a lot of functions depending on the operator name so that dtype selective build will work. We can just detect if dtype selective build is in use and, if not, stop duplicating. Test Plan: compared results of bash test/build_optimized_size_test.sh before/after this rev. Before: ``` ExecuTorch with no ops binary size, unstripped: -rwxr-xr-x 1 swolchok staff 153928 Apr 25 12:24 cmake-out/test/size_test ExecuTorch with portable ops binary size, unstripped: -rwxr-xr-x 1 swolchok staff 2150960 Apr 25 12:24 cmake-out/test/size_test_all_ops ExecuTorch with optimized ops binary size, unstripped: -rwxr-xr-x 1 swolchok staff 5887368 Apr 25 12:24 cmake-out/test/size_test_all_optimized_ops (.venv) swolchok@swolchok-mac ~/src/executorch> size cmake-out/test/size_test* __TEXT __DATA __OBJC others dec hex 81920 81920 0 4295049216 4295213056 10003c000 cmake-out/test/size_test 1474560 81920 0 4295655424 4297211904 100224000 cmake-out/test/size_test_all_ops 4489216 98304 0 4296359936 4300947456 1005b4000 cmake-out/test/size_test_all_optimized_ops ``` After: ``` ExecuTorch with no ops binary size, unstripped: -rwxr-xr-x 1 swolchok staff 153928 Apr 25 12:51 cmake-out/test/size_test ExecuTorch with portable ops binary size, unstripped: -rwxr-xr-x 1 swolchok staff 1796928 Apr 25 12:51 cmake-out/test/size_test_all_ops ExecuTorch with optimized ops binary size, unstripped: -rwxr-xr-x 1 swolchok staff 5605176 Apr 25 12:51 cmake-out/test/size_test_all_optimized_ops (.venv) swolchok@swolchok-mac ~/src/executorch> size cmake-out/test/size_test* __TEXT __DATA __OBJC others dec hex 81920 81920 0 4295049216 4295213056 10003c000 cmake-out/test/size_test 1310720 81920 0 4295458816 4296851456 1001cc000 cmake-out/test/size_test_all_ops 4358144 98304 0 4296212480 4300668928 100570000 cmake-out/test/size_test_all_optimized_ops ``` (This was reverted because the diff it was stacked on was a size regression. Reversing the order instead this time around, and reverted part of the change that was actually regressing size.) ghstack-source-id: 4eb4f02 ghstack-comment-id: 2831329046 Pull-Request-resolved: pytorch/executorch#10490
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We duplicate a lot of functions depending on the operator name so that
dtype selective build will work. We can just detect if dtype selective
build is in use and, if not, stop duplicating.
Test Plan: compared results of bash test/build_optimized_size_test.sh before/after this rev.
Before:
After:
(This was reverted because the diff it was stacked on was a size
regression. Reversing the order instead this time around, and reverted
part of the change that was actually regressing size.)