Skip to content

Preview branch that addresses a number of reported bugs#4138

Open
narendasan wants to merge 11 commits intomainfrom
push-xrxwyywvtqkz
Open

Preview branch that addresses a number of reported bugs#4138
narendasan wants to merge 11 commits intomainfrom
push-xrxwyywvtqkz

Conversation

@narendasan
Copy link
Collaborator

Description

Previews complex tensor support, rms norm support, and latest main + porting the profiler from the legacy profiler.

Fixes #4137 #4135

Type of change

Please delete options that are not relevant and/or add your own.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project (You can use the linters)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas and hacks
  • I have made corresponding changes to the documentation
  • I have added tests to verify my fix or my feature
  • New and existing unit tests pass locally with my changes
  • I have added the relevant labels to my PR in so that relevant reviewers are notified

cehongwang and others added 11 commits February 23, 2026 22:33
…mplex numerics, including complex tensor I/O

Introduce a new infrastructure in the replace complex pass to handle a number of cases where simply just unpacking complex tensors is not sufficent for supporting the numerics correctly.

This pass also now captures meta data about the original call signature so that during graph construction, the original calling convention is preserved and the runtimes do not need any specialization on supporting complex types.
@meta-cla meta-cla bot added the cla signed label Mar 19, 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: runtime component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Mar 19, 2026
@github-actions github-actions bot requested a review from zewenli98 March 19, 2026 00:28
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

There are some changes that do not conform to Python style guidelines:

--- /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/conversion/test_index_bool_split_aten.py	2026-03-19 00:28:21.633730+00:00
+++ /home/runner/work/TensorRT/TensorRT/tests/py/dynamo/conversion/test_index_bool_split_aten.py	2026-03-19 00:28:42.141701+00:00
@@ -4,10 +4,11 @@
1. `index_has_bool_indices` validator correctly distinguishes bool vs int indices.
2. Integer-indexed `aten.index.Tensor` routes to the converter WITHOUT output allocator.
3. Boolean-indexed `aten.index.Tensor` routes to the converter WITH output allocator.
4. Both paths produce correct results.
"""
+
import unittest
from unittest.mock import MagicMock

import torch
import torch.nn as nn
@@ -58,13 +59,11 @@
        node = _make_index_node([None, torch.tensor([True, False])])
        self.assertTrue(index_has_bool_indices(node))

    def test_mixed_int_and_bool_returns_true(self):
        """If any index is bool, the function should return True."""
-        node = _make_index_node(
-            [torch.tensor([0, 1]), torch.tensor([True, False])]
-        )
+        node = _make_index_node([torch.tensor([0, 1]), torch.tensor([True, False])])
        self.assertTrue(index_has_bool_indices(node))

    def test_all_none_returns_false(self):
        node = _make_index_node([None, None])
        self.assertFalse(index_has_bool_indices(node))

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

There are some changes that do not conform to C++ style guidelines:

diff --git a/home/runner/work/TensorRT/TensorRT/core/runtime/execute_engine.cpp b/tmp/changes.txt
index 94264f0..fdc06a1 100644
--- a/home/runner/work/TensorRT/TensorRT/core/runtime/execute_engine.cpp
+++ b/tmp/changes.txt
@@ -412,24 +412,24 @@ std::vector<at::Tensor> execute_engine(std::vector<at::Tensor> inputs, c10::intr
    { // Output Collection
      RECORD_USER_SCOPE("torch_tensorrt_execute_engine::OutputCollection");
      for (size_t i = 0; i < compiled_engine->out_binding_names.size(); i++) {
-      auto name = compiled_engine->out_binding_names[i];
-      auto dims = compiled_engine->output_allocator->getShapes().at(name);
-      auto dtype =
-          util::TRTDataTypeToScalarType(compiled_engine->exec_ctx->getEngine().getTensorDataType(name.c_str()));
-      at::Tensor output = compiled_engine->output_allocator->getBuffers().at(name).clone().detach();
-      int64_t prod = 1;
-      for (int i = 0; i < dims.nbDims; ++i) {
-        prod *= dims.d[i];
-      }
-      std::vector<int64_t> shape(dims.nbDims);
-      for (int i = 0; i < dims.nbDims; ++i) {
-        shape[i] = dims.d[i];
+        auto name = compiled_engine->out_binding_names[i];
+        auto dims = compiled_engine->output_allocator->getShapes().at(name);
+        auto dtype =
+            util::TRTDataTypeToScalarType(compiled_engine->exec_ctx->getEngine().getTensorDataType(name.c_str()));
+        at::Tensor output = compiled_engine->output_allocator->getBuffers().at(name).clone().detach();
+        int64_t prod = 1;
+        for (int i = 0; i < dims.nbDims; ++i) {
+          prod *= dims.d[i];
+        }
+        std::vector<int64_t> shape(dims.nbDims);
+        for (int i = 0; i < dims.nbDims; ++i) {
+          shape[i] = dims.d[i];
+        }
+        // When using the OutputAllocator, the allocated buffer might be larger than the size of the output,
+        // so we need to reshape the buffer to the output shape
+        output = output.reshape(-1).view(dtype).slice(0, 0, prod).reshape(shape);
+        outputs.push_back(output);
      }
-      // When using the OutputAllocator, the allocated buffer might be larger than the size of the output,
-      // so we need to reshape the buffer to the output shape
-      output = output.reshape(-1).view(dtype).slice(0, 0, prod).reshape(shape);
-      outputs.push_back(output);
-    }
    } // End Output Collection

    if (compiled_engine->profile_execution) {
ERROR: Some files do not conform to style guidelines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed 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: lowering Issues re: The lowering / preprocessing passes 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.

🐛 [Bug] Encountered bug when using Torch-TensorRT

3 participants