topology: cmake: build topologies in parallel, add -s to force sequen… - #11119
topology: cmake: build topologies in parallel, add -s to force sequen…#11119ujfalusi wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enables parallel topology builds by default while adding an opt-in sequential debugging mode.
Changes:
- Makes topology command serialization conditional.
- Adds
TPLG_SEQUENTIAL_BUILDand thebuild-tools.sh -soption. - Supports updating existing build trees.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Summary | Final comments |
|---|---|---|
tools/topology/CMakeLists.txt |
Controls topology build parallelism. | None |
scripts/build-tools.sh |
Adds sequential-build configuration and CLI handling. | Document -s in scripts/README.md (nit, 2 votes). Reset the cached option when -s is omitted (moderate, 4 votes). |
Suppressed comments (1)
tools/topology/CMakeLists.txt:8
- The new public build control is missing from the repository's existing topology documentation:
scripts/README.md:45-55lists thebuild-tools.shoptions but omits-s, andtools/topology/README.md:14-22does not explain the sequential/parallel CMake option. Please update those READMEs so users can discover and understand this behavior.
option(TPLG_SEQUENTIAL_BUILD "Build topologies one at a time (for debugging)" OFF)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| -s Force sequential (one at a time) topology builds, for debugging. | ||
| Normally topologies build in parallel with -j "$NO_PROCESSORS". |
| # -s must apply even to an already configured, incremental build tree. | ||
| if [ "$TPLG_SEQUENTIAL_BUILD" = ON ]; then | ||
| update_sequential_build_option | ||
| fi |
bd98ca2 to
04a133f
Compare
…tial alsatplg custom commands were marked USES_TERMINAL. With the Ninja generator this places them in the single-job "console" pool, which serializes every topology build regardless of the -j value passed to ninja. Building all 579 topologies therefore never used more than one core, even on a many-core machine. Drop USES_TERMINAL by default so Ninja can run alsatplg invocations in parallel, controlled by a new TPLG_SEQUENTIAL_BUILD CMake option (default OFF). Add a -s flag to build-tools.sh that sets TPLG_SEQUENTIAL_BUILD=ON, to restore the old, easier to debug one-at-a-time behavior when needed. It updates the CMake cache in place, so it also works on an existing incremental build tree without deleting it. Results Sequential (before this patch or with -T -s with this patch): ./scripts/build-tools.sh -T -s 19.30s user 2.34s system 99% cpu 21.817 total Parallel: rm -rf tools/build_tools; time ./scripts/build-tools.sh -T ./scripts/build-tools.sh -T 33.79s user 3.52s system 986% cpu 3.783 total The build time changes from ~22s to ~4s Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
04a133f to
fa711da
Compare
|
Changes since v1:
|
|
@ujfalusi (mostly) out of curiosity - IIUC this "19.30s user 2.34s system 99% cpu 21.817 total" is the |
This is zsh's built in time, with bash: parallel: I tried both shell builtin |
…tial
alsatplg custom commands were marked USES_TERMINAL. With the Ninja generator this places them in the single-job "console" pool, which serializes every topology build regardless of the -j value passed to ninja. Building all 579 topologies therefore never used more than one core, even on a many-core machine.
Drop USES_TERMINAL by default so Ninja can run alsatplg invocations in parallel, controlled by a new TPLG_SEQUENTIAL_BUILD CMake option (default OFF).
Add a -s flag to build-tools.sh that sets TPLG_SEQUENTIAL_BUILD=ON, to restore the old, easier to debug one-at-a-time behavior when needed. It updates the CMake cache in place, so it also works on an existing incremental build tree without deleting it.
Results
Sequential (before this patch or with -T -s with this patch): ./scripts/build-tools.sh -T -s 19.30s user 2.34s system 99% cpu 21.817 total
Parallel:
rm -rf tools/build_tools; time ./scripts/build-tools.sh -T ./scripts/build-tools.sh -T 33.79s user 3.52s system 986% cpu 3.783 total
The build time changes from ~22s to ~4s