Skip to content

[WIP][Thinlto][Split] Add callgraph-based module splitting(SplitModuleCG) (2/N)#199151

Draft
mmjjpp wants to merge 3 commits into
llvm:mainfrom
mmjjpp:thinlto-splitmodulecg-support
Draft

[WIP][Thinlto][Split] Add callgraph-based module splitting(SplitModuleCG) (2/N)#199151
mmjjpp wants to merge 3 commits into
llvm:mainfrom
mmjjpp:thinlto-splitmodulecg-support

Conversation

@mmjjpp
Copy link
Copy Markdown

@mmjjpp mmjjpp commented May 22, 2026

Stack Pr:
1/N: #198702 [WIP][ThinLTO][Split] Split module for parallel compilation in backend (1/N)
2/N: #199151 [WIP][Thinlto][Split] Add callgraph-based module splitting(SplitModuleCG) (2/N) ⬅
3/N: #199154 [WIP][ThinLTO][SplitModuleCG] Add comdat group handling (3/N)

There are more PRs that have not been submitted yet.

mmjjpp added 3 commits May 22, 2026 10:12
An interface for splitting a module by callgraph is added. This
interface is called in the thinlto backend phase. The module is
split into N Mparts, and opt and codegen are performed on the
Mparts in parallel to implement parallel compilation in the
thinlto backend.
Add a new SplitModuleCG that partitions a module into multiple
parts using function callgraph traversal and cost-based load balancing.
This is intended for use in thinLTO to parallelize code generation by
splitting the module while preserving function call dependencies.

Key features:
- Build a simplified callgraph to track function calls and roots
- Calculate function costs based on IR instruction count
- Partition functions with balanced cost distribution
- Externalize local symbols and rename promoted symbols to avoid
  conflicts
- Clone module partitions and emit them in parallel
Add a new command line option --enable-split-module-CG to llvm-split
tool for testing the SplitModuleCG utility.

The change:
- Adds --enable-split-module-CG flag
- Wire up the SplitModuleCG interface in llvm-split
@mmjjpp mmjjpp changed the title [WIP][Thinlto][Split] Add callgraph-based module splitting(SplitModuleCG) [WIP][Thinlto][Split] Add callgraph-based module splitting(SplitModuleCG) (2/N) May 22, 2026
@github-actions
Copy link
Copy Markdown

Hello @mmjjpp 👋

Thank you for submitting a Pull Request (PR) to the LLVM Project. Since this is your first PR, here are a few useful links covering our main contribution policies and review practices.

  • All contributions to LLVM must follow our LLVM AI Tool Use Policy. In particular, if you used AI while working on this PR, remember to add a note to the PR description.
  • The LLVM Code-Review Policy and Practices document contains practical information about the PR process, including how patches are reviewed and accepted, and who can review a PR.
  • Our LLVM Developer Policy describes our expectations for code quality, commit summaries and contains notes on our CI system.

Please reply to this message to confirm that you have read these policies, especially the LLVM AI Tool Use Policy, and that any AI tool usage has been noted in the PR description.


Frequently asked questions

How do I add reviewers?

This PR will be automatically labeled, and the relevant teams will be notified. For some parts of the project, reviewers may also be added automatically.

You can also add reviewers manually using the Reviewers section on this page. If you cannot use that section, it is probably because you do not have write permissions for the repository. In that case, you can request a review by tagging reviewers in a comment using @ followed by their GitHub username.

What if there are no comments?

If you have not received any comments on your PR after a week, you can request a review by pinging the PR with a comment such as “Ping”. The common courtesy ping rate is once a week. Please remember that you are asking for volunteer time from other developers.

Are any special GitHub settings required to contribute to LLVM?

We only require contributors to have a public email address associated with their GitHub commits, see this section of LLVM Developer Policy for details.


If you have questions, feel free to leave a comment on this PR, or ask on LLVM Discord or LLVM Discourse.

Thank you,
The LLVM Community

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant