Skip to content

Remove TorchScript frontend while preserving native runtime APIs - #5071

Merged
lanluo-nvidia merged 3 commits into
release/ngc/26.12from
lluo/remove_ts
Nov 20, 2026
Merged

lanluo-nvidia merged 3 commits into
release/ngc/26.12from
lluo/remove_ts

Conversation

@lanluo-nvidia

@lanluo-nvidia lanluo-nvidia commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Remove the TorchScript compiler frontend, Python torch_tensorrt.ts APIs, torchtrtc CLI, and the associated compiler-only code, tests, and documentation. Preserve the native TensorRT runtime operators and TorchBind registrations used by Dynamo/export deployment.

Preserve public C++ APIs relevant to native runtime applications:

  • Keep torch_tensorrt/macros.h, logging.h, and torch_tensorrt.h, including build information, CUDA device selection, and logging controls backed by the native runtime logger.
  • Move the surviving general API implementation from cpp/src/torch_tensorrt.cpp into core/runtime/torch_tensorrt.cpp; retain the logging wrapper in cpp/src/logging.cpp.
  • Keep execution controls and engine settings under torch_tensorrt/core/runtime/, with their supporting util headers. Export the APIs from both libtorchtrt and libtorchtrt_runtime and ship the public headers in the C++ packages.
  • Fix installed CMake include paths, CUDA dependency discovery, and object-library exports so downstream find_package(torchtrt) consumers build. Propagate C++20 and update the AOTI example accordingly.

Simplify setup.py now that the TorchScript frontend is gone: remove --no-ts and unused runtime-only/multilinux build branches, consolidate the preparation shared by install/develop/wheel commands, and fail on artifact extraction errors. Python-only and platform-specific builds remain supported.

The retained controls apply to the Torch-TensorRT native runtime. Self-contained AOTInductor packages using generated execution paths have their own runtime controls.

Validation for the runtime API review changes:

  • CMake builds both shared libraries and their native API tests; CTest passes for both targets.
  • A separate consumer using only the installed headers and CMake package builds with AOTI loader headers and links against either shared library.
  • All four API checks pass with CUDA device access: shared logger behavior, build information, execution controls, and device selection. The Bazel-packaged runtime also passes these checks through the installed consumer.
  • Bazel //tests/cpp:test_runtime_api passes. Runtime tarball builds, and both header archives contain the expected public/runtime/util headers.
  • All applicable commit hooks pass.
  • End-to-end .pt2 inference and Windows execution were not run for this revision.

Setup cleanup validation: an isolated Python-only wheel builds with version metadata and Dynamo packages; 13 selected packaging tests pass. Linux/RTX/CI/Windows ARM64 command selection and Windows/Linux artifact copying were checked, including extraction failure propagation. All applicable commit hooks, including the lockfile check, pass.

@meta-cla meta-cla Bot added the cla signed label Nov 18, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation component: tests Issues re: Tests component: lowering Issues re: The lowering / preprocessing passes component: conversion Issues re: Conversion stage component: core Issues re: The core compiler component: converters Issues re: Specific op converters component: build system Issues re: Build system component: api [Python] Issues re: Python API component: api [C++] Issues re: C++ API component: evaluators Issues re: Specific op evaluators component: runtime component: partitioning component: fx component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Nov 18, 2026
@github-actions
github-actions Bot requested a review from bowang007 November 18, 2026 19:15
@narendasan

Copy link
Copy Markdown
Collaborator

Since the libtorch C++ would now be based on AOTI, we need to make sure that the user facing C++ APIs for the runtime still work using that deployment workflow. So items under include/torch_tensorrrt/core/runtime continue to give users control of execution.

@narendasan

Copy link
Copy Markdown
Collaborator

Things like the user facing logger and macro apis can stay as well. Things that lifted core/util into include/torch_tensorrt

@narendasan narendasan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep any userfacing apis that would be relevant for AOTI users going forward

Comment thread cpp/include/torch_tensorrt/macros.h Resolved
Comment thread cpp/include/torch_tensorrt/logging.h Resolved
Comment thread cpp/src/logging.cpp Resolved
Comment thread cpp/src/torch_tensorrt.cpp Resolved
import torch.fx.passes.operator_support as op_support
import torch.fx.passes.shape_prop as shape_prop
import torch_tensorrt.fx.tracer.acc_tracer.acc_ops as acc_ops
from torch.fx.passes import splitter_base
from torch.testing._internal.common_utils import run_tests, TestCase

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also remove the fx tree?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed as suggested.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since i have tight timeline to get this in, i will do fx removal in a seperate PR.

Comment thread py/README.md
@@ -1,170 +1,20 @@
# torch_tensorrt
# Torch-TensorRT Python frontend

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets do a full overhaul of this doc

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed as suggested.

@lanluo-nvidia lanluo-nvidia changed the title torchscript api removal since torch has dropped Remove TorchScript frontend while preserving native runtime APIs Nov 20, 2026
@lanluo-nvidia
lanluo-nvidia removed this pull request from stack #5073 November 20, 2026 20:46
@lanluo-nvidia
lanluo-nvidia changed the base branch from main to release/ngc/26.12 November 20, 2026 20:47
@lanluo-nvidia
lanluo-nvidia merged commit 01d0e4f into release/ngc/26.12 Nov 20, 2026
351 of 406 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: full cla signed component: api [C++] Issues re: C++ API component: api [Python] Issues re: Python API component: build system Issues re: Build system component: conversion Issues re: Conversion stage component: converters Issues re: Specific op converters component: core Issues re: The core compiler component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths component: evaluators Issues re: Specific op evaluators component: fx component: lowering Issues re: The lowering / preprocessing passes component: partitioning component: runtime component: tests Issues re: Tests documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants