From e5782c7485a4389bf7d14e43ec29d12bd0044c41 Mon Sep 17 00:00:00 2001 From: Marcel Date: Wed, 25 Jun 2025 19:13:17 +0200 Subject: [PATCH 1/3] Remove Bazel files from wheel Once the wheel is built, the Bazel files are no longer needed. Fixes #3477 --- setup.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/setup.py b/setup.py index fb96d85453..652e0593b2 100644 --- a/setup.py +++ b/setup.py @@ -612,8 +612,6 @@ def run(self): package_data.update( { "torch_tensorrt": [ - "BUILD", - "WORKSPACE", "include/torch_tensorrt/*.h", "include/torch_tensorrt/core/*.h", "include/torch_tensorrt/core/conversion/*.h", @@ -643,8 +641,6 @@ def run(self): package_data.update( { "torch_tensorrt": [ - "BUILD", - "WORKSPACE", "include/torch_tensorrt/*.h", "include/torch_tensorrt/core/*.h", "include/torch_tensorrt/core/runtime/*.h", From 7024bf2f7fdc904a72f23bcf263f405b56b47835 Mon Sep 17 00:00:00 2001 From: apbose Date: Mon, 30 Jun 2025 21:08:37 -0700 Subject: [PATCH 2/3] changes for DLFW for l4t target and removal of BUILD files from package --- docker/MODULE.bazel.ngc | 27 ++++++++++++-- third_party/BUILD | 83 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+), 3 deletions(-) diff --git a/docker/MODULE.bazel.ngc b/docker/MODULE.bazel.ngc index e406a2cee7..b3c3560d9d 100644 --- a/docker/MODULE.bazel.ngc +++ b/docker/MODULE.bazel.ngc @@ -24,14 +24,17 @@ git_override( local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "local_repository") + +new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository") + + # External dependency for torch_tensorrt if you already have precompiled binaries. -local_repository( +new_local_repository( name = "torch_tensorrt", + build_file = "@//third_party:BUILD", path = "/usr/local/lib/python3.12/dist-packages/torch_tensorrt/", ) -new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository") - # CUDA should be installed on the system locally new_local_repository( @@ -55,8 +58,26 @@ new_local_repository( build_file = "third_party/libtorch/BUILD" ) +new_local_repository( + name = "torch_l4t", + path = "/usr/local/lib/python3.12/dist-packages/torch/", + build_file = "third_party/libtorch/BUILD" +) + new_local_repository( name = "tensorrt", path = "/usr/", build_file = "@//third_party/tensorrt/local:BUILD" ) + +new_local_repository( + name = "tensorrt_sbsa", + path = "/usr/", + build_file = "@//third_party/tensorrt/local:BUILD" +) + +new_local_repository( + name = "tensorrt_l4t", + path = "/usr/", + build_file = "@//third_party/tensorrt/local:BUILD" +) \ No newline at end of file diff --git a/third_party/BUILD b/third_party/BUILD index e69de29bb2..b6c8ded980 100644 --- a/third_party/BUILD +++ b/third_party/BUILD @@ -0,0 +1,83 @@ +load("@rules_cc//cc:cc_library.bzl", "cc_library") + +package(default_visibility = ["//visibility:public"]) + +load("@rules_cc//cc:defs.bzl", "cc_library") + +config_setting( + name = "aarch64_linux", + constraint_values = [ + "@platforms//cpu:aarch64", + "@platforms//os:linux", + ], +) + +config_setting( + name = "windows", + constraint_values = [ + "@platforms//os:windows", + ], +) + +cc_library( + name = "libtorchtrt", + srcs = select({ + ":windows": [ + "lib/x64/torchtrt.dll", + ], + "//conditions:default": [ + "lib/libtorchtrt.so", + ], + }), + hdrs = glob([ + "include/**/*.h", + ]), + includes = ["include/"], + strip_include_prefix = "include", +) + +cc_library( + name = "libtorchtrt_runtime", + srcs = select({ + ":windows": [ + "lib/x64/torchtrt_runtime.dll", + ], + "//conditions:default": [ + "lib/libtorchtrt_runtime.so", + ], + }), +) + +cc_library( + name = "libtorchtrt_plugins", + srcs = select({ + ":windows": [ + "lib/x64/torchtrt_plugins.dll", + ], + "//conditions:default": [ + "lib/libtorchtrt_plugins.so", + ], + }), + hdrs = glob([ + "include/torch_tensorrt/core/plugins/**/*.h", + ]), + includes = ["include/"], + strip_include_prefix = "include", +) + +cc_library( + name = "torch_tensorrt_core_hdrs", + hdrs = glob([ + "include/torch_tensorrt/core/**/*.h", + ]), + includes = ["include/torch_tensorrt/"], + strip_include_prefix = "include/torch_tensorrt", +) + +# Alias for ease of use +cc_library( + name = "torch_tensorrt", + deps = [ + ":libtorchtrt", + ], +) From 5f27f638f031346f70d5fa0301cce216ec61774d Mon Sep 17 00:00:00 2001 From: apbose Date: Mon, 7 Jul 2025 14:26:13 -0700 Subject: [PATCH 3/3] removing the C++ library target not required by cpp and core tests --- third_party/BUILD | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/third_party/BUILD b/third_party/BUILD index b6c8ded980..28b50c39cd 100644 --- a/third_party/BUILD +++ b/third_party/BUILD @@ -1,9 +1,8 @@ load("@rules_cc//cc:cc_library.bzl", "cc_library") +load("@rules_cc//cc:defs.bzl", "cc_library") package(default_visibility = ["//visibility:public"]) -load("@rules_cc//cc:defs.bzl", "cc_library") - config_setting( name = "aarch64_linux", constraint_values = [ @@ -36,35 +35,6 @@ cc_library( strip_include_prefix = "include", ) -cc_library( - name = "libtorchtrt_runtime", - srcs = select({ - ":windows": [ - "lib/x64/torchtrt_runtime.dll", - ], - "//conditions:default": [ - "lib/libtorchtrt_runtime.so", - ], - }), -) - -cc_library( - name = "libtorchtrt_plugins", - srcs = select({ - ":windows": [ - "lib/x64/torchtrt_plugins.dll", - ], - "//conditions:default": [ - "lib/libtorchtrt_plugins.so", - ], - }), - hdrs = glob([ - "include/torch_tensorrt/core/plugins/**/*.h", - ]), - includes = ["include/"], - strip_include_prefix = "include", -) - cc_library( name = "torch_tensorrt_core_hdrs", hdrs = glob([