Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ build:cxx11_abi --define=abi=cxx11_abi
build:jetpack --//toolchains/dep_collection:compute_libs=jetpack

build:rtx --//toolchains/dep_collection:compute_libs=rtx
build:dlfw --//:package_executorch=false

build:ci_testing --define=torchtrt_src=prebuilt --cxxopt="-DDISABLE_TEST_IN_CI" --action_env "NVIDIA_TF32_OVERRIDE=0"
build:use_precompiled_torchtrt --define=torchtrt_src=prebuilt
Expand Down
148 changes: 0 additions & 148 deletions .github/scripts/setup-executorch-ci.sh

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/build-test-linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ jobs:
test-infra-repository: pytorch/test-infra
test-infra-ref: main
build-matrix: ${{ needs.filter-matrix.outputs.matrix }}
# it can pin to a specific version of executorch(can be a tag or a branch etc.)
executorch-ref: "main"


L0-dynamo-converter-tests:
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/executorch-static-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ on:
description: 'Reference to checkout, defaults to ""'
default: ""
type: string
executorch-ref:
description: "ExecuTorch branch or tag to checkout; defaults to latest main"
default: "main"
type: string
test-infra-repository:
description: "Test infra repository to use"
default: "pytorch/test-infra"
Expand Down Expand Up @@ -73,10 +69,6 @@ jobs:
fail-on-empty: false
script: |
set -euo pipefail
export EXECUTORCH_ROOT="${RUNNER_TEMP}/executorch"
export EXECUTORCH_REF="${{ inputs.executorch-ref }}"
source .github/scripts/setup-executorch-ci.sh || exit 1

BAZELISK_VERSION="1.26.0"
case "$(uname -m)" in
aarch64|arm64)
Expand All @@ -99,6 +91,9 @@ jobs:

# this is to build the libtorchtrt.tar.gz
bazel build //:libtorchtrt --compilation_mode opt --config=linux
executorch_cmake_location="$(bazel query @executorch//:CMakeLists.txt --output=location)"
export EXECUTORCH_SOURCE_DIR="$(dirname "${executorch_cmake_location%%:*}")"
export EXECUTORCH_ROOT="${EXECUTORCH_SOURCE_DIR}"
# this is to verify the end user's workflow
python -m pip install pyyaml
.github/scripts/verify-executorch-reference-runner.sh
27 changes: 21 additions & 6 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@rules_pkg//:pkg.bzl", "pkg_tar", "pkg_zip")
load("@rules_pkg//pkg:mappings.bzl", "pkg_files")

bool_flag(
name = "package_executorch",
build_setting_default = True,
)

config_setting(
name = "windows",
constraint_values = [
Expand Down Expand Up @@ -39,6 +45,13 @@ config_setting(
},
)

config_setting(
name = "no_package_executorch",
flag_values = {
":package_executorch": "false",
},
)

pkg_tar(
name = "include_core",
package_dir = "include/torch_tensorrt",
Expand Down Expand Up @@ -112,9 +125,9 @@ pkg_tar(

genrule(
name = "executorch_core_archive",
srcs = ["@executorch//:libexecutorch_core.a"],
srcs = ["@executorch//:executorch_core"],
outs = ["libexecutorch_core.a"],
cmd = "cp $(location @executorch//:libexecutorch_core.a) $@",
cmd = "cp $(location @executorch//:executorch_core) $@",
)

genrule(
Expand Down Expand Up @@ -199,10 +212,11 @@ pkg_tar(
pkg_tar(
name = "bin",
srcs = ["//cpp/bin/torchtrtc"] + select({
":rtx_win": [],
":windows": [],
":jetpack": [],
":no_package_executorch": [],
":rtx_win": [],
":rtx_x86_64": [],
":windows": [],
"//conditions:default": [
"//examples/executorch_reference_runner:example_executorch_runner",
],
Expand Down Expand Up @@ -241,10 +255,11 @@ pkg_tar(
":include_core",
":lib",
] + select({
":rtx_win": [],
":windows": [],
":jetpack": [],
":no_package_executorch": [],
":rtx_win": [],
":rtx_x86_64": [],
":windows": [],
"//conditions:default": [
":executorch_source_package",
":include_executorch",
Expand Down
28 changes: 20 additions & 8 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "rules_python", version = "1.3.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_foreign_cc", version = "0.15.1")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
Expand All @@ -25,16 +26,27 @@ git_override(

new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")

local_torch = use_repo_rule("//toolchains:local_torch.bzl", "local_torch")
new_git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")

local_executorch = use_repo_rule("//toolchains:local_executorch.bzl", "local_executorch")
local_torch = use_repo_rule("//toolchains:local_torch.bzl", "local_torch")

# Detect ExecuTorch from the active Python environment (VIRTUAL_ENV / CONDA_PREFIX / PATH).
# Supports both pip-installed wheel layout and source-tree layout.
# Optional overrides:
# EXECUTORCH_ROOT=/path/to/executorch
# EXECUTORCH_SOURCE_DIR=/path/to/executorch
local_executorch(name = "executorch")
# Pinned to the ExecuTorch release/1.3 branch head.
new_git_repository(
name = "executorch",
build_file = "@//third_party/executorch:BUILD",
# latest commit in release/1.3 branch
commit = "6118688a095fd9697224f5cad72ce42db641c9cd",
recursive_init_submodules = True,
patch_cmds = [
"find . -mindepth 2 \\( -name BUILD -o -name BUILD.bazel \\) -delete",
"mkdir executorch && find . -mindepth 1 -maxdepth 1 ! -name executorch ! -name BUILD ! -name BUILD.bazel ! -name REPO.bazel -exec ln -s ../{} executorch/ \\;",
],
patch_cmds_win = [
"Get-ChildItem -Recurse -Include BUILD,BUILD.bazel | Where-Object { $_.DirectoryName -ne (Get-Location).Path } | Remove-Item -Force",
"New-Item -ItemType Directory executorch | Out-Null; Get-ChildItem -Force | Where-Object { $_.Name -notin @('executorch','BUILD','BUILD.bazel','REPO.bazel') } | Copy-Item -Destination executorch -Recurse -Force",
],
remote = "https://github.com/pytorch/executorch.git",
)

torch_nccl_detect = use_repo_rule("//toolchains/torch_nccl:defs.bzl", "torch_nccl_detect")

Expand Down
20 changes: 20 additions & 0 deletions docker/MODULE.bazel.ngc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_python", version = "0.34.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_foreign_cc", version = "0.15.1")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
Expand All @@ -26,6 +27,7 @@ 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")
new_git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")

torch_nccl_detect = use_repo_rule("//toolchains/torch_nccl:defs.bzl", "torch_nccl_detect")

Expand Down Expand Up @@ -62,6 +64,24 @@ new_local_repository(
build_file = "third_party/libtorch/BUILD"
)

# Pinned to the ExecuTorch release/1.3 branch head.
new_git_repository(
name = "executorch",
build_file = "@//third_party/executorch:BUILD",
# latest commit in release/1.3 branch
commit = "6118688a095fd9697224f5cad72ce42db641c9cd",
recursive_init_submodules = True,
patch_cmds = [
"find . -mindepth 2 \\( -name BUILD -o -name BUILD.bazel \\) -delete",
"mkdir executorch && find . -mindepth 1 -maxdepth 1 ! -name executorch ! -name BUILD ! -name BUILD.bazel ! -name REPO.bazel -exec ln -s ../{} executorch/ \\;",
],
patch_cmds_win = [
"Get-ChildItem -Recurse -Include BUILD,BUILD.bazel | Where-Object { $_.DirectoryName -ne (Get-Location).Path } | Remove-Item -Force",
"New-Item -ItemType Directory executorch | Out-Null; Get-ChildItem -Force | Where-Object { $_.Name -notin @('executorch','BUILD','BUILD.bazel','REPO.bazel') } | Copy-Item -Destination executorch -Recurse -Force",
],
remote = "https://github.com/pytorch/executorch.git",
)


# This is a workaround (WAR), not a functional Bazel repository.
# It directly references a system-installed PyTorch package, which breaks hermeticity
Expand Down
1 change: 0 additions & 1 deletion packaging/pre_build_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.26.0/bazelis
&& mv bazelisk-linux-${BAZEL_PLATFORM} /usr/bin/bazel \
&& chmod +x /usr/bin/bazel

source .github/scripts/setup-executorch-ci.sh || exit 1

pip uninstall -y torch torchvision

Expand Down
Loading
Loading