
This patch adds initial support for Integrated Distributed ThinLTO (DTLTO) in LLVM, which manages distribution internally during the traditional link step. This enables compatibility with any build system that supports in-process ThinLTO. In contrast, existing approaches to distributed ThinLTO, which split the thin-link (--thinlto-index-only), backend compilation, and final link into separate steps, require build system support, e.g. Bazel. This patch implements the core DTLTO mechanism, which enables delegation of ThinLTO backend jobs to an external process (the distributor). The distributor can then manage job distribution through systems like Incredibuild. A generic JSON interface is used to communicate with the distributor, allowing for the creation of new distributors (and thus integration with different distribution systems) without modifying LLVM. Please see llvm/docs/dtlto.rst for more details. RFC: https://discourse.llvm.org/t/rfc-integrated-distributed-thinlto/69641 Design Review: https://github.com/llvm/llvm-project/pull/126654
29 lines
788 B
Python
29 lines
788 B
Python
"""
|
|
DTLTO local serial distributor.
|
|
|
|
This script parses the Distributed ThinLTO (DTLTO) JSON file and serially
|
|
executes the specified code generation tool on the local host to perform each
|
|
backend compilation job. This simple functional distributor is intended to be
|
|
used for integration tests.
|
|
|
|
Usage:
|
|
python local.py <json_file>
|
|
|
|
Arguments:
|
|
- <json_file> : JSON file describing the DTLTO jobs.
|
|
"""
|
|
|
|
import subprocess
|
|
import sys
|
|
import json
|
|
from pathlib import Path
|
|
|
|
if __name__ == "__main__":
|
|
# Load the DTLTO information from the input JSON file.
|
|
with Path(sys.argv[-1]).open() as f:
|
|
data = json.load(f)
|
|
|
|
# Iterate over the jobs and execute the codegen tool.
|
|
for job in data["jobs"]:
|
|
subprocess.check_call(data["common"]["args"] + job["args"])
|