Skip to content

Document that ThinLTO parallelism is limited to the number of bitcode files #148759

@nh2

Description

@nh2

The documentation on https://clang.llvm.org/docs/ThinLTO.html says

all transformations, including function importing, occur later when the modules are optimized in fully parallel backends

the ThinLTO link step will launch as many threads in parallel as there are cores

so I had high hopes that ThinLTO would allow to achieve very fast unity builds, because optimisation would be "parallel".

However, testing it, I noticed that there is no pallelism in that case. I observed that the linker only spawns as many threads as there were .o files created during the bitcode-creation steps.

This meant that, contrary to my hopes, ThinLTO can never compile faster than a normal non-ThinLTO build.

Is this expected / as designed, or could it be made faster (e.g. per-function optimisation parallelism)?

If it is as designed, it would be great to document this constraint on that page.

CC @teresajohnson

Metadata

Metadata

Assignees

No one assigned

    Labels

    LTOLink time optimization (regular/full LTO or ThinLTO)documentation

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions