Skip to content
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

chore: Upgrade TensorRT version to TRT 10 EA #2699

Merged
merged 80 commits into from
Apr 23, 2024
Merged

chore: Upgrade TensorRT version to TRT 10 EA #2699

merged 80 commits into from
Apr 23, 2024

Conversation

peri044
Copy link
Collaborator

@peri044 peri044 commented Mar 19, 2024

Description

Upgrade TensorRT version to TRT 10 EA

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

@github-actions github-actions bot added component: conversion Issues re: Conversion stage component: core Issues re: The core compiler component: converters Issues re: Specific op converters component: api [Python] Issues re: Python API component: api [C++] Issues re: C++ API component: runtime component: dynamo Issues relating to the `torch.compile` or `torch._dynamo.export` paths labels Mar 19, 2024
@github-actions github-actions bot requested a review from gs-olive March 19, 2024 23:47
@github-actions github-actions bot added the component: build system Issues re: Build system label Mar 25, 2024
@peri044 peri044 force-pushed the save branch 3 times, most recently from ff95381 to 8980b7a Compare March 25, 2024 21:58
author Dheeraj Peri <[email protected]> 1711393059 -0700
committer Dheeraj Peri <[email protected]> 1711393072 -0700

chore: minor updates

chore: Fix save failures

chore: minor fixes

chore: remove duplicate bert test case

chore: remove comments

chore: add load api

chore: minor updates

chore: minor updates

chore: minor updates

chore: more updates
Comment on lines 76 to 82
# self.hidden_output_names: Sequence[str] = []
# for i in range(
# self.engine.num_bindings // self.engine.num_optimization_profiles
# ):
# if i not in primary_input_outputs:
# self.hidden_output_binding_indices_in_order.append(i)
# self.hidden_output_names.append(self.engine.get_binding_name(i))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

review needed

len(self.input_names)
+ len(self.output_names)
+ len(self.hidden_output_names)
# + len(self.hidden_output_names) #TODO: Verify if this is required
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

review needed

Comment on lines 108 to 115
# TODO: Verify what this is for ?
# self.hidden_output_dtypes = [
# unified_dtype_converter(
# self.engine.get_binding_dtype(idx), Frameworks.TORCH
# )
# for idx in self.hidden_output_binding_indices_in_order
# ]

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

review needed

Comment on lines 261 to 263
# TODO: Check what is this for ?
# for i, idx in enumerate(self.hidden_output_binding_indices_in_order):
# shape = tuple(self.context.get_binding_shape(idx))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

review needed

@github-actions github-actions bot removed the component: api [C++] Issues re: C++ API label Apr 20, 2024
@github-actions github-actions bot added the component: api [C++] Issues re: C++ API label Apr 20, 2024
@@ -107,7 +107,7 @@ def _from(
return dtype.f16
elif t == trt.float32:
return dtype.f32
elif trt.__version__ >= "7.0" and t == trt.bool:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you removing the version check?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This version check actually fails. If trt.__version == 10.0.0b6, then trt.__version__ >= "7.0" is False (which should actually be true) and hence the trt.bool type wouldn't be returned which results in type errors.
We also don't need these version checks because we only support strict TRT versions.

Copy link
Collaborator

@gs-olive gs-olive left a comment

Choose a reason for hiding this comment

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

Overall looks great - added a comment in the TRTEngine and wanted to note that the Docker build + Docker build jobs will likely fail since the TRT installation will need upgrading for the build, but that can be a separate PR.

core/runtime/TRTEngine.cpp Show resolved Hide resolved
core/runtime/TRTEngine.cpp Show resolved Hide resolved
@peri044
Copy link
Collaborator Author

peri044 commented Apr 22, 2024

Docker build + Docker build jobs will likely fail since the TRT installation will need upgrading for the build,

Yes, I'm working on docker updates in fp8_trt branch. So that will likely get merged with this PR #2763

@peri044 peri044 merged commit 32a6e67 into release/2.3 Apr 23, 2024
23 checks passed
peri044 added a commit that referenced this pull request Apr 23, 2024
peri044 added a commit that referenced this pull request Apr 25, 2024
zewenli98 added a commit that referenced this pull request Apr 26, 2024
Copy link
Collaborator

@zewenli98 zewenli98 left a comment

Choose a reason for hiding this comment

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

Need some patches as comments.

@@ -312,7 +313,7 @@ def run(
)
timing_cache = self._create_timing_cache(builder_config, existing_cache)

engine = self.builder.build_engine(self.ctx.net, builder_config)
engine = self.builder.build_serialized_network(self.ctx.net, builder_config)
Copy link
Collaborator

Choose a reason for hiding this comment

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

build_serialized_network returns a plan instead of engine, which is different from previous TRT. In TRT-10, we can do two steps to get an engine:

plan = builder.build_serialized_network(network, config)
engine = runtime.deserialize_cuda_engine(plan)

If it is on purpose to get plan, maybe we can change the name to make it easy understand.

Comment on lines +63 to +65
assert (
self.engine.num_io_tensors // self.engine.num_optimization_profiles
) == (len(self.input_names) + len(self.output_names))
Copy link
Collaborator

Choose a reason for hiding this comment

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

The assertion should be:

assert self.engine.num_io_tensors == (len(self.input_names) + len(self.output_names))

A bug was reported here: #2811

laikhtewari pushed a commit that referenced this pull request May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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: runtime component: tests Issues re: Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants