Skip to content

Upgrade stack in release/1.3 branch #1485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 54 commits into from
Nov 30, 2022
Merged

Conversation

peri044
Copy link
Collaborator

@peri044 peri044 commented Nov 28, 2022

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

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)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 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

Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
Signed-off-by: Dheeraj Peri <[email protected]>
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.

Code conforms to C++ style guidelines

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.

Code conforms to Python style guidelines

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.

Code conforms to C++ style guidelines

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:

--- py/torch_tensorrt/fx/test/passes/test_fuse_permute_linear_trt.py	2022-11-29 06:52:42.337276 +0000
+++ py/torch_tensorrt/fx/test/passes/test_fuse_permute_linear_trt.py	2022-11-29 06:53:06.464407 +0000
@@ -49,10 +49,11 @@
            TestModule(10, 30),
            inputs,
            {acc_ops.permute, trt_transposed_linear},
            apply_passes=[fuse_permute_linear],
        )
+
    # TODO: The following test has been disabled due to a bug in TRT 8.5.1.7
    # with self.linear2. Issue : https://github.com/pytorch/TensorRT/issues/1444
    # def test_multi_fuse_permute_linear(self):
    #     """
    #     Fusion when permute output is shared by multiple linears

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.

Code conforms to C++ style guidelines

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:

--- py/torch_tensorrt/fx/test/passes/test_fuse_permute_linear_trt.py	2022-11-29 08:13:26.901017 +0000
+++ py/torch_tensorrt/fx/test/passes/test_fuse_permute_linear_trt.py	2022-11-29 08:13:50.867941 +0000
@@ -49,10 +49,11 @@
            TestModule(10, 30),
            inputs,
            {acc_ops.permute, trt_transposed_linear},
            apply_passes=[fuse_permute_linear],
        )
+
    # TODO: The following test has been disabled due to a bug in TRT 8.5.1.7
    # with self.linear2. Issue : https://github.com/pytorch/TensorRT/issues/1444
    # def test_multi_fuse_permute_linear(self):
    #     """
    #     Fusion when permute output is shared by multiple linears

Signed-off-by: Dheeraj Peri <[email protected]>
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.

Code conforms to Python style guidelines

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.

Code conforms to C++ style guidelines

@@ -164,7 +164,7 @@ void TRTEngine::disable_profiling() {
}

void TRTEngine::dump_engine_layer_info_to_file(const std::string& path) {
auto inspector = cuda_engine->createEngineInspector();
auto inspector = make_trt(cuda_engine->createEngineInspector());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a note for later, should we be keeping this object around?

for (size_t i = 0; i < inputs.size(); i++) {
uint64_t pyt_idx = compiled_engine->in_binding_map[i];
std::string name = compiled_engine->exec_ctx->getEngine().getIOTensorName(i);
Copy link
Collaborator

Choose a reason for hiding this comment

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

@peri044 why arent we using input_binding_names here. TensorRT does not guarantee binding order. This would be potentially unsafe.

I would expect that the workflow here would be to iterate not through inputs.size() but through the names in input_binding_names

Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be std::string name = compiled_engine->input_binding_names[i]

@@ -163,26 +157,27 @@ std::vector<at::Tensor> execute_engine(std::vector<at::Tensor> inputs, c10::intr

for (size_t o = inputs.size(); o < (compiled_engine->num_io.first + compiled_engine->num_io.second); o++) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same thing here, use output_binding_names to pull out the TensorRT binding index / address

@@ -2,6 +2,7 @@
import numpy as np
import tensorrt as trt
import torch
import warnings
Copy link
Collaborator

Choose a reason for hiding this comment

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

Other parts of the codebase have been using logging for this sort of role.

"""
Fusion when permute output is shared by multiple linears
"""
# TODO: The following test has been disabled due to a bug in TRT 8.5.1.7
Copy link

Choose a reason for hiding this comment

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

Can we just use unittest skip?

Copy link

@yinghai yinghai left a comment

Choose a reason for hiding this comment

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

Please address the warning and unittest skip comment. Otherwise LGTM.

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.

Code conforms to Python style guidelines

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.

Code conforms to C++ style guidelines

Signed-off-by: Dheeraj Peri <[email protected]>
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 b799201..7fd4b8e 100644
--- a/home/runner/work/TensorRT/TensorRT/core/runtime/execute_engine.cpp
+++ b/tmp/changes.txt
@@ -128,8 +128,7 @@ std::vector<at::Tensor> execute_engine(std::vector<at::Tensor> inputs, c10::intr
          std::make_unique<torch::autograd::profiler::RecordProfile>(compiled_engine->input_profile_path);
    }
    for (size_t i = 0; i < inputs.size(); i++) {
-      std::string name =
-          compiled_engine->in_binding_names[i];
+      std::string name = compiled_engine->in_binding_names[i];
      TORCHTRT_CHECK(
          inputs[i].is_cuda(), "Expected input tensors to have device cuda, found device " << inputs[i].device());
      auto expected_type =
@@ -158,8 +157,7 @@ std::vector<at::Tensor> execute_engine(std::vector<at::Tensor> inputs, c10::intr

    for (size_t o = inputs.size(); o < (compiled_engine->num_io.first + compiled_engine->num_io.second); o++) {
      uint64_t pyt_idx = compiled_engine->out_binding_map[o];
-      std::string name =
-          compiled_engine->out_binding_names[pyt_idx];
+      std::string name = compiled_engine->out_binding_names[pyt_idx];
      auto out_shape = compiled_engine->exec_ctx->getTensorShape(name.c_str());
      LOG_DEBUG("Output Name: " << name << " Shape: " << out_shape);
      auto dims = core::util::toVec(out_shape);
ERROR: Some files do not conform to style guidelines

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.

Code conforms to Python style guidelines

Signed-off-by: Dheeraj Peri <[email protected]>
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.

Code conforms to C++ style guidelines

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.

Code conforms to Python style guidelines

Copy link

@yinghai yinghai left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Collaborator

@narendasan narendasan left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks for this

@narendasan narendasan merged commit fe37a86 into release/1.3 Nov 30, 2022
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: fx component: runtime component: tests Issues re: Tests fx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants