-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[RFC] Roadmap to minimize libtaichi_c_api.so library size #6793
Labels
doc
Documentation related issues & PRs
Comments
This was referenced Dec 2, 2022
cc: @ghuau-innopeak |
This was referenced Dec 6, 2022
This was referenced Dec 8, 2022
After turning on function level linking for libtaichi_c_api.so with #6840 as well as stripping the debug info with #6845, significant code size reduction was observed:
libtaichi_c_api.so built with LLVM does not benefit that much from function level linking, mainly because libLLVM.a is not compiled with TODO List:
|
jim19930609
added a commit
that referenced
this issue
Dec 13, 2022
Issue: #6793 | Size (Original) | Size (Optimized) -- | -- | -- Vulkan | 14 MB | 1.5 MB Vulkan + LLVM | 82 MB | 51 MB libtaichi_c_api.so built with LLVM does not benefit much from function level linking, mainly because libLLVM.a is not compiled with `-ffunction-sections -fdata-sections`. We'll have that fixed later.
quadpixels
pushed a commit
to quadpixels/taichi
that referenced
this issue
May 13, 2023
…aichi-dev#6830) Issue: taichi-dev#6793 ### Brief Summary
quadpixels
pushed a commit
to quadpixels/taichi
that referenced
this issue
May 13, 2023
…pi.so (taichi-dev#6831) Issue: taichi-dev#6793 ### Brief Summary
quadpixels
pushed a commit
to quadpixels/taichi
that referenced
this issue
May 13, 2023
) Issue: taichi-dev#6793 ### Brief Summary
quadpixels
pushed a commit
to quadpixels/taichi
that referenced
this issue
May 13, 2023
…i-dev#6845) Issue: taichi-dev#6793 | Size (Original) | Size (Optimized) -- | -- | -- Vulkan | 14 MB | 1.5 MB Vulkan + LLVM | 82 MB | 51 MB libtaichi_c_api.so built with LLVM does not benefit much from function level linking, mainly because libLLVM.a is not compiled with `-ffunction-sections -fdata-sections`. We'll have that fixed later.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We roughly planed three stages to optimize the library size for libtaichi_c_api.so:
1. Turn on function-level linking
1.1 Convert CMake OBJECT targets to STATIC targets
Removes unnecessary entry files that compiles into libtaichi_c_api.so
[Before]
[After]
1.2 Apply version script to libtaichi_c_api.so
Convert unnecessary global symbols to local symbols, leading to more optimization opportunities.
[Before]
[After]
1.3 Add compile option
-ffunction-sections
,-fdata-sections
and link option--gc-sections
Turns on function level linking eventually.
[Before]
[After]
Based on some experiment results, after turning on function-level-linking, we're expecting ~80% code size reduction from 12 MB to 1.7 MB (Vulkan C-API library, #6388)
2. Symbol rearrangement and clean up
Further detect and clean up redundant symbols via symbol analysis (tooling: https://github.com/google/bloaty)
3. Customized C-API features
In certain situations, library size can be the killing blocker to ship a product. Therefore we should provide options to further remove unimportant features to further reduce the library size. Some possible options are:
fno-except
fno-rtti
The text was updated successfully, but these errors were encountered: