Add option to limit ONNX Runtime build parallelism - #342
Open
LeC911 wants to merge 1 commit into
Open
Conversation
LeC911
force-pushed
the
add-ort-build-parallel
branch
from
May 12, 2026 12:22
e55062f to
756346c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
When building the ONNX Runtime backend through Triton
build.py, the top-level--build-paralleloption limits the outer CMake build, but the generatedDockerfile.ortstill invokes ONNX Runtime build as:without a job count.
On resource-constrained builders this can make the ORT build fail while building libonnxruntime.so, even when Triton is built with --build-parallel=1.
Change
This PR adds an optional CMake cache variable:
TRITON_BUILD_ONNXRUNTIME_PARALLELWhen set, it is forwarded to tools/gen_ort_dockerfile.py as:
and the generated Dockerfile.ort uses:
Default behavior is unchanged. If the option is not set, the generated build continues to use:
The original issue was reproduced on r26.04 while building Triton 2.68.0/container 26.04 with ONNX Runtime backend, CPU-only, HTTP-only, GPU disabled.
Additional validation
Verified opt-in behavior using this PR branch through Triton
build.py:The generated Dockerfile.ort contains:
Also verified default behavior remains unchanged when
TRITON_BUILD_ONNXRUNTIME_PARALLELis not set. With only the outer build parallelism set, the generated Dockerfile.ort still contains: