Skip to content

cherrypick: #2804 to branch fp8_trt10 #2867

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

Closed
wants to merge 150 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
150 commits
Select commit Hold shift + click to select a range
9ad87ac
chore: Upgrade to TRT 10.0
peri044 Mar 12, 2024
a655c9a
chore: updates to trt api
peri044 Mar 12, 2024
cd86660
feat: Add save API for torch-trt compiled models
peri044 Mar 14, 2024
31285e5
feat: Add FP8 support including dtype and converters
peri044 Mar 5, 2024
7c9c646
chore: minor fixes
peri044 Mar 15, 2024
4eabeb0
Merge branch 'main' into trt_10
peri044 Mar 15, 2024
a320e56
Merge branch 'trt_10' into fp8_trt10
peri044 Mar 15, 2024
3ece71b
chore: resolve merge conflicts
peri044 Mar 15, 2024
eab0dba
chore: Fix save failures
peri044 Mar 18, 2024
b191d62
chore: update to 2.3 rc build
peri044 Mar 18, 2024
ce606fe
chore: rebase with release/2.3 branch
peri044 Mar 19, 2024
8674a3c
chore: minor fixes
peri044 Mar 19, 2024
f4e8fe9
chore: remove duplicate bert test case
peri044 Mar 20, 2024
4ae6ab9
chore: remove comments
peri044 Mar 20, 2024
fff1b80
chore: Upgrade to TRT 10.0
peri044 Mar 12, 2024
39ca77d
chore: more fixes
peri044 Mar 21, 2024
5431ee3
chore: update trt version
peri044 Mar 25, 2024
0c03de5
chore: more updates
peri044 Mar 26, 2024
982dbd2
parent f39e89e3964bc3d6ea3a6989b1e4099e1bb3e6dd
peri044 Mar 25, 2024
1ae46e9
chore: more updates
peri044 Mar 27, 2024
ae87fba
chore: rebase with save
peri044 Mar 27, 2024
beb5920
chore: Update versions
peri044 Mar 27, 2024
f0068c6
chore: update tensorrt version in CI
peri044 Mar 27, 2024
39261b9
chore: more updates
peri044 Mar 27, 2024
3753150
chore: more fixes
peri044 Apr 2, 2024
16a191c
Merge branch 'release/2.3' into trt_10
peri044 Apr 2, 2024
c355766
chore: remove NvUtils.h
peri044 Apr 2, 2024
2d237dc
chore: more updates
peri044 Apr 2, 2024
e4b4429
chore: change lib64 to lib in rhel BUILD file
peri044 Apr 2, 2024
fa4fb9c
chore: more updates
peri044 Apr 2, 2024
e11eb60
chore: fix TRT version
peri044 Apr 2, 2024
092feb2
chore: more updates
peri044 Apr 2, 2024
09ecf26
fix shape bug in bitwise ops
zewenli98 Apr 3, 2024
85e04c5
chore: update to rhel9
peri044 Apr 3, 2024
6a3664e
Merge branch 'trt_10' of github.com:pytorch/TensorRT into trt_10
peri044 Apr 3, 2024
41229d6
chore: change trt version
peri044 Apr 3, 2024
9d7a656
fix test bug and add more tests
zewenli98 Apr 3, 2024
5e911a9
chore: delete mirror of rules_pkg
peri044 Apr 3, 2024
dae0eb2
chore: fix conv test
peri044 Apr 3, 2024
2a32b13
Merge branch 'trt_10' of github.com:pytorch/TensorRT into trt_10
peri044 Apr 3, 2024
4676cd2
chore: fix trt version range
peri044 Apr 4, 2024
88efe8e
chore: fix trt rangfe
peri044 Apr 4, 2024
f9b40e6
chore: minor fix
peri044 Apr 4, 2024
b86aec2
chore: update rules_pkg
peri044 Apr 4, 2024
6630281
chore: minor fixes
peri044 Apr 4, 2024
fca55fe
chore: expt
peri044 Apr 4, 2024
1ca01e7
chore: update WORKSPACE tmpl
peri044 Apr 5, 2024
cdf5d07
chore: rebase with 2.3
peri044 Apr 5, 2024
6ffb85e
chore: fix
peri044 Apr 5, 2024
76af510
chore: remove cudnn dep
peri044 Apr 6, 2024
f9cf75a
chore: fix
peri044 Apr 6, 2024
33ba8b2
chore: updates
peri044 Apr 8, 2024
923377c
chore: update post-build script
peri044 Apr 9, 2024
89f04db
chore: remove trt dep
peri044 Apr 9, 2024
7620acc
chore: updates
peri044 Apr 9, 2024
62332fb
chore: set ld_library path in post script
peri044 Apr 9, 2024
96a8bf6
chore: updates
peri044 Apr 9, 2024
041f6a3
chore: updates
peri044 Apr 9, 2024
83e9a0b
chore: disable smoke test
peri044 Apr 9, 2024
e8529b0
chore: updates
peri044 Apr 9, 2024
1357112
chore: updates
peri044 Apr 9, 2024
608a6d2
chore: updates
peri044 Apr 10, 2024
1b34b32
chore: updates
peri044 Apr 10, 2024
89cb55a
chore: updates
peri044 Apr 10, 2024
4323e36
chore: updates
peri044 Apr 10, 2024
60b3e51
chore: update hw_compat
peri044 Apr 10, 2024
05627cd
chore: updates
peri044 Apr 12, 2024
d16585f
chore: update streams
peri044 Apr 12, 2024
16088e6
chore: updates
peri044 Apr 12, 2024
3d149ef
chore: updates
peri044 Apr 13, 2024
3addcae
chore: updates
peri044 Apr 13, 2024
b0e92d8
chore: update hw_compat.ts
peri044 Apr 15, 2024
d285d27
fix dynamic shape bugs for test_binary_ops_aten
zewenli98 Apr 15, 2024
d78a846
chore: revert layer_norm test
peri044 Apr 16, 2024
ba8a424
chore: rebase
peri044 Apr 16, 2024
097d887
Merge branch 'trt_10' of github.com:pytorch/TensorRT into trt_10
zewenli98 Apr 16, 2024
faaa0fa
chore: rebase with trt_10
peri044 Apr 17, 2024
68aab70
chore: updates
peri044 Apr 17, 2024
ffe7a52
chore: rebase with release/2.3
peri044 Apr 18, 2024
bac409a
chore: rebase
peri044 Apr 18, 2024
38642bb
chore: updates
peri044 Apr 18, 2024
c70c6dc
Merge branch 'trt_10' into fp8_trt10
peri044 Apr 18, 2024
ba286bd
chore: add fp8 test
peri044 Apr 18, 2024
d15dd72
chore: updates
peri044 Apr 19, 2024
dda88ee
Merge branch 'trt_10' into fp8_trt10
peri044 Apr 19, 2024
dee9aa0
chore: updates
peri044 Apr 19, 2024
fc6078b
Merge branch 'trt_10' into fp8_trt10
peri044 Apr 19, 2024
c05d675
chore: update stream in python runtime
peri044 Apr 19, 2024
2329657
chore: update hw_compat.ts
peri044 Apr 19, 2024
b8a8709
chore: updates
peri044 Apr 20, 2024
44778e1
chore: updates
peri044 Apr 20, 2024
0dbbcd7
chore: updates
peri044 Apr 20, 2024
55e4a1b
Merge branch 'trt_10' into fp8_trt10
peri044 Apr 22, 2024
89c3d76
chore: updates
peri044 Apr 22, 2024
bd70ef8
Merge branch 'trt_10' into fp8_trt10
peri044 Apr 22, 2024
3956749
chore: updates
peri044 Apr 23, 2024
0a2337b
chore: updates
peri044 Apr 23, 2024
358255d
chore: updates
peri044 Apr 23, 2024
dad5399
chore: rebase
peri044 Apr 23, 2024
e3e1d85
chore: rebase
peri044 May 7, 2024
7e717d6
chore: updates
peri044 May 14, 2024
c6d2f2a
chore: update to modelopt
peri044 May 14, 2024
ceec39d
chore: updates
peri044 May 14, 2024
a7e566b
chore: updates
peri044 May 14, 2024
707b10a
chore: updates
peri044 May 15, 2024
22066c5
chore: minor fix
peri044 May 15, 2024
6eed383
chore: fixes
peri044 May 15, 2024
ff231b5
chore: fixes
peri044 May 16, 2024
2f167c6
chore: updates
peri044 May 16, 2024
367eaf0
chore: updates
peri044 May 16, 2024
8cb6b91
chore: updates
peri044 May 16, 2024
4d38368
chore: updates
peri044 May 16, 2024
ee54da6
chore: updates
peri044 May 17, 2024
f4ccd62
chore: updates
peri044 May 17, 2024
681a6d1
chore: fixes
peri044 May 17, 2024
44071aa
chore: updates
peri044 May 17, 2024
3f6999d
chore: updates
peri044 May 17, 2024
5de9325
chore: updates
peri044 May 17, 2024
c677ef9
refactor vgg16 with fp8 and ptq example
zewenli98 May 21, 2024
f0b8d47
fix bugs
zewenli98 May 22, 2024
3ce9bed
chore: rebase
peri044 May 22, 2024
beb888d
chore: updates
peri044 May 23, 2024
e7989a0
chore: address review comments
peri044 May 23, 2024
96fd462
chore: updates
peri044 May 23, 2024
4030344
chore: updates
peri044 May 24, 2024
ad9d825
chore: updates
peri044 May 24, 2024
0059c1c
Update build-test-windows.yml
narendasan May 24, 2024
f98abd6
Update build-test-linux.yml
narendasan May 24, 2024
0d2021d
chore: updates
peri044 May 24, 2024
1940267
chore: updates
peri044 May 27, 2024
5814402
chore: disable all lower_linear tests
peri044 May 27, 2024
338a92b
chore: updates
peri044 May 27, 2024
59d0bd0
chore: fixes
peri044 May 27, 2024
020fe63
chore: updates
peri044 May 27, 2024
3f8297e
chore: updates
peri044 May 27, 2024
5ce0ee1
chore: updates
peri044 May 27, 2024
65c5c3e
chore: updates
peri044 May 28, 2024
d99989d
chore: updates
peri044 May 28, 2024
99dfbdc
chore: updates
peri044 May 28, 2024
ad996a5
chore: updates
peri044 May 28, 2024
6ada351
chore: updates
peri044 May 28, 2024
88fd7ee
chore: fixes
peri044 May 28, 2024
2511095
chore: updates
peri044 May 28, 2024
5346a45
chore: updates
peri044 May 29, 2024
d284b8f
chore: updates
peri044 May 29, 2024
c71c017
chore: updates
peri044 May 29, 2024
a983064
chore: updates
peri044 May 29, 2024
a319516
cherrypick of #2804
zewenli98 May 29, 2024
4b079e0
Merge branch 'release/2.3' into cherrypick_of_2804_for_branch_fp8_trt10
peri044 May 30, 2024
825aa17
chore: rebase
peri044 May 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/docker_builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,16 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Automatically detect TensorRT and cuDNN default versions for Torch-TRT build
# Automatically detect TensorRT default versions for Torch-TRT build
- name: Build Docker image
env:
DOCKER_TAG: ${{ env.DOCKER_REGISTRY }}/${{ steps.fix_slashes.outputs.container_name }}
run: |
python3 -m pip install pyyaml
TRT_VERSION=$(python3 -c "import versions; versions.tensorrt_version()")
echo "TRT VERSION = ${TRT_VERSION}"
CUDNN_VERSION=$(python3 -c "import versions; versions.cudnn_version()")
echo "CUDNN VERSION = ${CUDNN_VERSION}"

DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=$TRT_VERSION --build-arg CUDNN_VERSION=$CUDNN_VERSION -f docker/Dockerfile --tag $DOCKER_TAG .
DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=$TRT_VERSION -f docker/Dockerfile --tag $DOCKER_TAG .

- name: Push Docker image
env:
Expand Down
26 changes: 5 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Torch-TensorRT is distributed in the ready-to-run NVIDIA [NGC PyTorch Container]

## Building a docker container for Torch-TensorRT

We provide a `Dockerfile` in `docker/` directory. It expects a PyTorch NGC container as a base but can easily be modified to build on top of any container that provides, PyTorch, CUDA, cuDNN and TensorRT. The dependency libraries in the container can be found in the <a href="https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/index.html">release notes</a>.
We provide a `Dockerfile` in `docker/` directory. It expects a PyTorch NGC container as a base but can easily be modified to build on top of any container that provides, PyTorch, CUDA, and TensorRT. The dependency libraries in the container can be found in the <a href="https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/index.html">release notes</a>.

Please follow this instruction to build a Docker container.

Expand Down Expand Up @@ -152,14 +152,13 @@ bash ./compile.sh
You need to start by having CUDA installed on the system, LibTorch will automatically be pulled for you by bazel,
then you have two options.

#### 1. Building using cuDNN & TensorRT tarball distributions
#### 1. Building using TensorRT tarball distributions

> This is recommended so as to build Torch-TensorRT hermetically and insures any bugs are not caused by version issues

> Make sure when running Torch-TensorRT that these versions of the libraries are prioritized in your `$LD_LIBRARY_PATH`

1. You need to download the tarball distributions of TensorRT and cuDNN from the NVIDIA website.
- https://developer.nvidia.com/cudnn
1. You need to download the tarball distributions of TensorRT from the NVIDIA website.
- https://developer.nvidia.com/tensorrt
2. Place these files in a directory (the directories `third_party/dist_dir/[x86_64-linux-gnu | aarch64-linux-gnu]` exist for this purpose)
3. Compile using:
Expand All @@ -168,25 +167,16 @@ then you have two options.
bazel build //:libtorchtrt --compilation_mode opt --distdir third_party/dist_dir/[x86_64-linux-gnu | aarch64-linux-gnu]
```

#### 2. Building using locally installed cuDNN & TensorRT
#### 2. Building using locally installed TensorRT

> If you find bugs and you compiled using this method please disclose you used this method in the issue
> (an `ldd` dump would be nice too)

1. Install TensorRT, CUDA and cuDNN on the system before starting to compile.
1. Install TensorRT and CUDA on the system before starting to compile.
2. In `WORKSPACE` comment out

```py
# Downloaded distributions to use with --distdir
http_archive(
name = "cudnn",
urls = ["<URL>",],

build_file = "@//third_party/cudnn/archive:BUILD",
sha256 = "<TAR SHA256>",
strip_prefix = "cuda"
)

http_archive(
name = "tensorrt",
urls = ["<URL>",],
Expand All @@ -201,12 +191,6 @@ and uncomment

```py
# Locally installed dependencies
new_local_repository(
name = "cudnn",
path = "/usr/",
build_file = "@//third_party/cudnn/local:BUILD"
)

new_local_repository(
name = "tensorrt",
path = "/usr/",
Expand Down
243 changes: 0 additions & 243 deletions cmake/Modules/FindcuDNN.cmake

This file was deleted.

2 changes: 0 additions & 2 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ endif()

# If the custom finders are needed at this point, there are good chances that they will be needed when consuming the library as well
install(FILES "${CMAKE_SOURCE_DIR}/cmake/Modules/FindTensorRT.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/torchtrt/Modules")
install(FILES "${CMAKE_SOURCE_DIR}/cmake/Modules/FindcuDNN.cmake" DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/torchtrt/Modules")

# CUDA
find_package(CUDAToolkit REQUIRED)
find_package(cuDNN REQUIRED) # Headers are needed somewhere

# libtorch
find_package(Torch REQUIRED)
Expand Down
1 change: 0 additions & 1 deletion core/plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ target_link_libraries(${lib_name}
TensorRT::nvinfer_plugin
torch
core_util
cuDNN::cuDNN
PRIVATE
Threads::Threads
)
Expand Down
2 changes: 1 addition & 1 deletion dev_dep_versions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__: "2.3.0"
__cuda_version__: "12.1"
__cudnn_version__: "8.9"
__tensorrt_version__: "10.0.1"
__tensorrt_version__: "10.0.1"
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Use `Dockerfile` to build a container which provides the exact development environment that our master branch is usually tested against.

* The `Dockerfile` currently uses <a href="https://github.com/bazelbuild/bazelisk">Bazelisk</a> to select the Bazel version, and uses the exact library versions of Torch and CUDA listed in <a href="https://github.com/pytorch/TensorRT#dependencies">dependencies</a>.
* The desired versions of TensorRT must be specified as build-args, with major and minor versions as in: `--build-arg TENSORRT_VERSION=a.b`
* The desired version of TensorRT must be specified as build-args, with major and minor versions as in: `--build-arg TENSORRT_VERSION=a.b`
* [**Optional**] The desired base image be changed by explicitly setting a base image, as in `--build-arg BASE_IMG=nvidia/cuda:11.8.0-devel-ubuntu22.04`, though this is optional
* [**Optional**] Additionally, the desired Python version can be changed by explicitly setting a version, as in `--build-arg PYTHON_VERSION=3.10`, though this is optional as well.

Expand Down
6 changes: 0 additions & 6 deletions docker/WORKSPACE.docker
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,6 @@ new_local_repository(
# Locally installed dependencies (use in cases of custom dependencies or aarch64)
####################################################################################

new_local_repository(
name = "cudnn",
path = "/usr/",
build_file = "@//third_party/cudnn/local:BUILD"
)

new_local_repository(
name = "tensorrt",
path = "/usr/",
Expand Down
6 changes: 0 additions & 6 deletions docker/WORKSPACE.ngc
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ new_local_repository(
build_file = "third_party/libtorch/BUILD"
)

new_local_repository(
name = "cudnn",
path = "/usr/",
build_file = "@//third_party/cudnn/local:BUILD"
)

new_local_repository(
name = "tensorrt",
path = "/usr/",
Expand Down
Loading
Loading