Preview branch that addresses a number of reported bugs#4138
Open
narendasan wants to merge 11 commits intomainfrom
Open
Preview branch that addresses a number of reported bugs#4138narendasan wants to merge 11 commits intomainfrom
narendasan wants to merge 11 commits intomainfrom
Conversation
…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.
…ment that marks nodes that are complex
… pytorch rather than fail to build
There was a problem hiding this comment.
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))There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Checklist: