From b9e459620976836a4058b9092f125feb642b0e56 Mon Sep 17 00:00:00 2001 From: Kevin Pedro Date: Tue, 12 Aug 2025 18:49:48 -0500 Subject: [PATCH 1/5] arg to disable docker cache --- build.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/build.py b/build.py index ddefbdbbfe..6fc6071f53 100755 --- a/build.py +++ b/build.py @@ -1770,6 +1770,11 @@ def create_docker_build_script(script_name, container_install_dir, container_ci_ "--pull", ] + if FLAGS.no_container_cache: + baseargs += [ + "--no-cache", + ] + # Windows docker runs in a VM and memory needs to be specified # explicitly (at least for some configurations of docker). if target_platform() == "windows": @@ -2445,6 +2450,12 @@ def enable_all(): required=False, help="Do not use Docker --pull argument when building container.", ) + parser.add_argument( + "--no-container-cache", + action="store_true", + required=False, + help="Use Docker --no-cache argument when building container.", + ) parser.add_argument( "--container-memory", default=None, From 7e685debf3eba929eca10495f50c8d426cc011e5 Mon Sep 17 00:00:00 2001 From: Kevin Pedro Date: Tue, 12 Aug 2025 19:18:09 -0500 Subject: [PATCH 2/5] add arg to override default repo tag for all dependencies --- build.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build.py b/build.py index 6fc6071f53..e46ffc88b0 100755 --- a/build.py +++ b/build.py @@ -2716,6 +2716,12 @@ def enable_all(): default=DEFAULT_TRITON_VERSION_MAP["upstream_container_version"], help="This flag sets the upstream container version for Triton Inference Server to be built. Default: the latest released version.", ) + parser.add_argument( + "--default-repo-tag", + required=False, + default=None, + help="Override the calculated default-repo-tag value", + ) parser.add_argument( "--ort-version", required=False, @@ -2857,6 +2863,8 @@ def enable_all(): if FLAGS.triton_container_version.endswith("dev") else "r" + FLAGS.triton_container_version ) + if FLAGS.default_repo_tag: + default_repo_tag = FLAGS.default_repo_tag log("default repo-tag: {}".format(default_repo_tag)) # For other versions use the TRITON_VERSION_MAP unless explicitly From 2390b9232fd0222de3c8820f9e28f9b762b4cfd1 Mon Sep 17 00:00:00 2001 From: Kevin Pedro Date: Tue, 19 Aug 2025 16:40:49 -0500 Subject: [PATCH 3/5] add explicit buildbase option to use temporary container for backend builds --- build.py | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/build.py b/build.py index e46ffc88b0..0d416c0250 100755 --- a/build.py +++ b/build.py @@ -692,17 +692,17 @@ def onnxruntime_cmake_args(images, library_paths): ) if target_platform() == "windows": - if "base" in images: + if "buildbase" in images: cargs.append( cmake_backend_arg( - "onnxruntime", "TRITON_BUILD_CONTAINER", None, images["base"] + "onnxruntime", "TRITON_BUILD_CONTAINER", None, images["buildbase"] ) ) else: - if "base" in images: + if "buildbase" in images: cargs.append( cmake_backend_arg( - "onnxruntime", "TRITON_BUILD_CONTAINER", None, images["base"] + "onnxruntime", "TRITON_BUILD_CONTAINER", None, images["buildbase"] ) ) else: @@ -758,17 +758,17 @@ def openvino_cmake_args(): ) ] if target_platform() == "windows": - if "base" in images: + if "buildbase" in images: cargs.append( cmake_backend_arg( - "openvino", "TRITON_BUILD_CONTAINER", None, images["base"] + "openvino", "TRITON_BUILD_CONTAINER", None, images["buildbase"] ) ) else: - if "base" in images: + if "buildbase" in images: cargs.append( cmake_backend_arg( - "openvino", "TRITON_BUILD_CONTAINER", None, images["base"] + "openvino", "TRITON_BUILD_CONTAINER", None, images["buildbase"] ) ) else: @@ -805,9 +805,9 @@ def dali_cmake_args(): def fil_cmake_args(images): cargs = [cmake_backend_enable("fil", "TRITON_FIL_DOCKER_BUILD", True)] - if "base" in images: + if "buildbase" in images: cargs.append( - cmake_backend_arg("fil", "TRITON_BUILD_CONTAINER", None, images["base"]) + cmake_backend_arg("fil", "TRITON_BUILD_CONTAINER", None, images["buildbase"]) ) else: cargs.append( @@ -2569,6 +2569,12 @@ def enable_all(): required=False, help='Use specified Docker image in build as ,. can be "base", "gpu-base", or "pytorch".', ) + parser.add_argument( + "--use-buildbase", + default=False, + action="store_true", + help='Use local temporary "buildbase" Docker image as "base" image to build backends', + ) parser.add_argument( "--enable-all", @@ -2936,6 +2942,11 @@ def enable_all(): ) log('image "{}": "{}"'.format(parts[0], parts[1])) images[parts[0]] = parts[1] + if FLAGS.use_buildbase: + images["buildbase"] = "tritonserver_buildbase" + else: + if "base" in images: + images["buildbase"] = images["base"] # Initialize map of library paths for each backend. library_paths = {} From 6352ea043a1a0043013de9f59d0f60a255adb9a4 Mon Sep 17 00:00:00 2001 From: Kevin Pedro Date: Thu, 14 Aug 2025 16:27:02 -0500 Subject: [PATCH 4/5] allow changing github org for individual backends --- build.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/build.py b/build.py index 0d416c0250..28d5bbcc07 100755 --- a/build.py +++ b/build.py @@ -32,6 +32,7 @@ import os.path import pathlib import platform +import re import stat import subprocess import sys @@ -2045,14 +2046,14 @@ def tensorrtllm_postbuild(cmake_script, repo_install_dir, tensorrtllm_be_dir): def backend_build( be, cmake_script, - tag, + tag_org, build_dir, install_dir, - github_organization, images, components, library_paths, ): + tag, github_organization = tag_org repo_build_dir = os.path.join(build_dir, be, "build") repo_install_dir = os.path.join(build_dir, be, "install") @@ -2110,11 +2111,11 @@ def backend_build( def backend_clone( be, clone_script, - tag, + tag_org, build_dir, install_dir, - github_organization, ): + tag, github_organization = tag_org clone_script.commentln(8) clone_script.comment(f"'{be}' backend") clone_script.comment("Delete this section to remove backend from build") @@ -2654,7 +2655,7 @@ def enable_all(): "--backend", action="append", required=False, - help='Include specified backend in build as [:]. If starts with "pull/" then it refers to a pull-request reference, otherwise indicates the git tag/branch to use for the build. If the version is non-development then the default is the release branch matching the container version (e.g. version YY.MM -> branch rYY.MM); otherwise the default is "main" (e.g. version YY.MMdev -> branch main).', + help='Include specified backend in build as [:][:]. If starts with "pull/" then it refers to a pull-request reference, otherwise indicates the git tag/branch to use for the build. If the version is non-development then the default is the release branch matching the container version (e.g. version YY.MM -> branch rYY.MM); otherwise the default is "main" (e.g. version YY.MMdev -> branch main). allows using a forked repository instead of the default --github-organization value.', ) parser.add_argument( "--repo-tag", @@ -2890,11 +2891,14 @@ def enable_all(): # Initialize map of backends to build and repo-tag for each. backends = {} for be in FLAGS.backend: - parts = be.split(":") + pattern = r"(https?:\/\/[^\s:]+)|:" + parts = list(filter(None,re.split(pattern, be))) if len(parts) == 1: parts.append(default_repo_tag) - log('backend "{}" at tag/branch "{}"'.format(parts[0], parts[1])) - backends[parts[0]] = parts[1] + if len(parts) == 2: + parts.append(FLAGS.github_organization) + log('backend "{}" at tag/branch "{}" from org "{}"'.format(parts[0], parts[1], parts[2])) + backends[parts[0]] = parts[1:] if "vllm" in backends: if "python" not in backends: @@ -3105,7 +3109,6 @@ def enable_all(): backends[be], script_build_dir, script_install_dir, - github_organization, ) else: backend_build( @@ -3114,7 +3117,6 @@ def enable_all(): backends[be], script_build_dir, script_install_dir, - github_organization, images, components, library_paths, From 77d5590d9947bc1def9c2e9dcf42ebc38bd1b337 Mon Sep 17 00:00:00 2001 From: Kevin Pedro Date: Tue, 19 Aug 2025 16:51:07 -0500 Subject: [PATCH 5/5] update build docs --- docs/customization_guide/build.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/customization_guide/build.md b/docs/customization_guide/build.md index 948fbafb06..7bd2c0ae88 100644 --- a/docs/customization_guide/build.md +++ b/docs/customization_guide/build.md @@ -111,6 +111,8 @@ building with Docker. build Triton. When building without GPU support, the *min* image is the standard ubuntu:22.04 image. + * The flag `--use-buildbase` can be specified to automate the use of the *tritonserver_buildbase* image to build backends that require a base image. + * Run the cmake_build script within the *tritonserver_buildbase* image to actually build Triton. The cmake_build script performs the following steps. @@ -157,7 +159,7 @@ If you want to enable only certain Triton features, backends and repository agents, do not specify --enable-all. Instead you must specify the individual flags as documented by --help. -#### Building With Specific GitHub Branches +#### Building With Specific GitHub Branches and Organization As described above, the build is performed in the server repo, but source from several other repos is fetched during the build @@ -180,7 +182,12 @@ instead use the corresponding branch/tag in the build. For example, if you have a branch called "mybranch" in the [onnxruntime_backend](https://github.com/triton-inference-server/onnxruntime_backend) repo that you want to use in the build, you would specify ---backend=onnxruntime:mybranch. +`--backend=onnxruntime:mybranch`. + +If you want to build a backend from an alternative organization or user ``, you can extend this syntax as follows: +```bash +$ ./build.py ... --backend=onnxruntime:mybranch:https://github.com/ +``` #### CPU-Only Build