Skip to content

Commit 929a4ba

Browse files
committed
refactor: Address some issues with enums and overhaul documentation
Signed-off-by: Naren Dasan <naren@narendasan.com> Signed-off-by: Naren Dasan <narens@nvidia.com> ci: Adding typos pre-commit Signed-off-by: Naren Dasan <naren@narendasan.com> Signed-off-by: Naren Dasan <narens@nvidia.com>
1 parent 9f46d39 commit 929a4ba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+1739
-310
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ repos:
5151
hooks:
5252
- id: black
5353
exclude: ^examples/custom_converters/elu_converter/setup.py|^docs
54+
- repo: https://github.com/crate-ci/typos
55+
rev: v1.22.9
56+
hooks:
57+
- id: typos
5458
- repo: local
5559
hooks:
5660
- id: dont-commit-upstream

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Do try to fill an issue with your feature or bug before filling a PR (op support
66

77
#### Development enviornment
88

9-
Our build system relies on `bazel` (https://bazel.build/). Though there are many ways to install `bazel`, the prefered method is to use `bazelisk` (https://github.com/bazelbuild/bazelisk) which makes it simple to set up the correct version of bazel on the fly. Additional developement dependencies can be installed via the `requirements-dev.txt` file.
9+
Our build system relies on `bazel` (https://bazel.build/). Though there are many ways to install `bazel`, the preferred method is to use `bazelisk` (https://github.com/bazelbuild/bazelisk) which makes it simple to set up the correct version of bazel on the fly. Additional developement dependencies can be installed via the `requirements-dev.txt` file.
1010

1111
#### Communication
1212

cmake/paths.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set(ARCHIVE_OUTPUT_DIRECTORY "lib")
66
set(RUNTIME_OUTPUT_DIRECTORY "bin")
77
set(HEADERS_OUTPUT_DIRECTORY "include")
88

9-
#Set target ouput directory in the build directory
9+
#Set target output directory in the build directory
1010
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${ARCHIVE_OUTPUT_DIRECTORY}")
1111
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${LIBRARY_OUTPUT_DIRECTORY}")
1212
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${RUNTIME_OUTPUT_DIRECTORY}")

dev_dep_versions.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
__version__: "2.5.0.dev0"
21
__cuda_version__: "12.4"
32
__tensorrt_version__: "10.0.1"

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ RUN TENSORRT_MAJOR_VERSION=`echo ${TENSORRT_VERSION} | cut -d '.' -f 1` && \
5050
RUN wget -q https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-linux-amd64 -O /usr/bin/bazel &&\
5151
chmod a+x /usr/bin/bazel
5252

53-
# Build Torch-TensorRT in an auxillary container
53+
# Build Torch-TensorRT in an auxiliary container
5454
FROM base as torch-tensorrt-builder-base
5555

5656
ARG ARCH="x86_64"

docker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ nvidia-docker run --gpus all -it --shm-size=8gb --env="DISPLAY" --volume="/tmp/.
3535
Test:
3636

3737

38-
You can run any converter test to verify if Torch-TRT built sucessfully inside the container. Once you launch the container, you can run
38+
You can run any converter test to verify if Torch-TRT built successfully inside the container. Once you launch the container, you can run
3939
```
4040
bazel test //tests/core/conversion/converters:test_activation --compilation_mode=opt --test_output=summary --config use_precompiled_torchtrt --config pre_cxx11_abi
4141
```

docsrc/conf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# -- Project information -----------------------------------------------------
2626

2727
project = "Torch-TensorRT"
28-
copyright = "2022, NVIDIA Corporation"
28+
copyright = "2024, NVIDIA Corporation"
2929
author = "NVIDIA Corporation"
3030

3131
version = f"v{torch_tensorrt.__version__}"
@@ -151,6 +151,9 @@
151151
"master_doc": True,
152152
"version_info": {
153153
"main": "https://pytorch.org/TensorRT/",
154+
"v2.3.0": "https://pytorch.org/TensorRT/v2.3.0",
155+
"v2.2.0": "https://pytorch.org/TensorRT/v2.2.0",
156+
"v2.1.0": "https://pytorch.org/TensorRT/v2.1.0",
154157
"v1.4.0": "https://pytorch.org/TensorRT/v1.4.0",
155158
"v1.3.0": "https://pytorch.org/TensorRT/v1.3.0",
156159
"v1.2.0": "https://pytorch.org/TensorRT/v1.2.0",
@@ -186,6 +189,8 @@
186189

187190
nbsphinx_execute = "never"
188191

192+
autodoc_member_order = "groupwise"
193+
189194
# -- A patch that prevents Sphinx from cross-referencing ivar tags -------
190195
# See http://stackoverflow.com/a/41184353/3343043
191196

docsrc/contributors/dynamo_converters.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ The decorator takes a number of arguments:
3636
All that is required for a converter is the key.
3737

3838
The function body is responsible for taking the current state of the network and adding the next subgraph to perform the op specified in the decorator with TensorRT operations.
39-
The function is provided arguments as the native PyTorch op would be provided with the added case of numpy arrays for frozen Tensor attributes or TensorRT ITensors which are ouput Tensors of previous nodes, correspoding to edges/output Tensors of intermediate operations in the graph.
39+
The function is provided arguments as the native PyTorch op would be provided with the added case of numpy arrays for frozen Tensor attributes or TensorRT ITensors which are output Tensors of previous nodes, correspoding to edges/output Tensors of intermediate operations in the graph.
4040
To determine the types expected as well as the return type of the converter, look at the definition of the op being converted. In the case of ``aten`` operations, this file will be the source of truth: https://github.com/pytorch/pytorch/blob/main/aten/src/ATen/native/native_functions.yaml
4141
Since many converters a developer may write are a composition of lower level operators, instead of needing to implement the converter in raw TensorRT, the ``torch_tensorrt.dynamo.conversion.impl`` subpackage contains many implementations of operations that can be chained to create a TensorRT subgraph.
4242

@@ -53,7 +53,7 @@ Capability Validation
5353

5454
There are some converters which have special cases to be accounted for. In those cases, one should use ``capability_validators`` to register the converter using ``@dynamo_tensorrt_converter``
5555
We illustrate this through ``torch.ops.aten.embedding.default``. It has parameters - ``scale_grad_by_freq`` and ``sparse`` which are not currently supported by the implementation.
56-
In such cases we can write validator ``embedding_param_validator`` which implements that given those paramters the converter is not supported and register the converter by
56+
In such cases we can write validator ``embedding_param_validator`` which implements that given those parameters the converter is not supported and register the converter by
5757

5858

5959
Type Contract
@@ -105,7 +105,7 @@ Some operations do not produce TensorRT subgraphs as a side-effect. These are te
105105
Operator Decomposition
106106
-----------------------
107107

108-
There are some converters which can be decomposed into suboperations in PyTorch and need not have seperate converter registration.
108+
There are some converters which can be decomposed into suboperations in PyTorch and need not have separate converter registration.
109109
Such converters can be implemented via a decomposition
110110

111111
Example: ``addmm``

docsrc/contributors/lowering.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Eliminate Exeception Or Pass Pattern
3535

3636
`Torch-TensorRT/core/lowering/passes/exception_elimination.cpp <https://github.com/pytorch/TensorRT/blob/master/core/lowering/passes/exception_elimination.cpp>`_
3737

38-
A common pattern in scripted modules are dimension gaurds which will throw execptions if
38+
A common pattern in scripted modules are dimension guards which will throw execptions if
3939
the input dimension is not what was expected.
4040

4141
.. code-block:: none
@@ -50,7 +50,7 @@ the input dimension is not what was expected.
5050
5151
Since we are resolving all of this at compile time and there are no execptions in the TensorRT graph, we just remove it.
5252

53-
Eliminate Redundant Gaurds
53+
Eliminate Redundant Guards
5454
***************************************
5555

5656
`torch/csrc/jit/passes/guard_elimination.h <https://github.com/pytorch/pytorch/blob/master/torch/csrc/jit/passes/guard_elimination.h>`_
@@ -63,7 +63,7 @@ Freeze Module
6363

6464
`torch/csrc/jit/passes/freeze_module.h <https://github.com/pytorch/pytorch/blob/master/torch/csrc/jit/passes/freeze_module.h>`_
6565

66-
Freeze attributes and inline constants and modules. Propogates constants in the graph.
66+
Freeze attributes and inline constants and modules. Propagates constants in the graph.
6767

6868
Fuse AddMM Branches
6969
***************************************
@@ -103,7 +103,7 @@ Fuse Flatten Linear
103103

104104
`Torch-TensorRT/core/lowering/passes/fuse_flatten_linear.cpp <https://github.com/pytorch/TensorRT/blob/master/core/lowering/passes/fuse_flatten_linear.cpp>`_
105105

106-
TensorRT implicity flattens input layers into fully connected layers when they are higher than 1D. So when there is a
106+
TensorRT implicitly flattens input layers into fully connected layers when they are higher than 1D. So when there is a
107107
``aten::flatten`` -> ``aten::linear`` pattern we remove the ``aten::flatten``.
108108

109109
Lower Graph
@@ -147,7 +147,7 @@ Places delimiting nodes around module calls pre freezing to signify where in the
147147

148148
Looks for delimiters then marks all nodes between the delimiters to tell partitioning to run them in PyTorch
149149

150-
Peephole Optimze
150+
Peephole Optimize
151151
***************************************
152152

153153
`torch/csrc/jit/passes/peephole_optimze.h <https://github.com/pytorch/pytorch/blob/master/torch/csrc/jit/passes/ppeephole_optimze.h>`_
@@ -204,7 +204,7 @@ Unroll Loops
204204

205205
`torch/csrc/jit/passes/loop_unrolling.h <https://github.com/pytorch/pytorch/blob/master/torch/csrc/jit/passes/loop_unrolling.h>`_
206206

207-
Unrolls the operations of compatable loops (e.g. sufficently short) so that you only have to go through the loop once.
207+
Unrolls the operations of compatible loops (e.g. sufficently short) so that you only have to go through the loop once.
208208

209209
Replace Tile with Repeat
210210
***************************************

docsrc/contributors/runtime.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Runtime Phase
66
The Runtime phase is responsible for constructing self standing TorchScript graphs with embedded TensorRT engines and serving as the runtime
77
when these engines are called. The main interface accepts a serialized TensorRT engine. The execution phase
88
will deserialize and wrap this engine in a class which maintains a execution context for each engine
9-
and some metadata about its inputs and outputs and is compatable with the TorchScript interpreter so that
9+
and some metadata about its inputs and outputs and is compatible with the TorchScript interpreter so that
1010
it can be moved around and used like other TorchScript IValues. The engine is run by providing it and inputs
1111
to the ``tensorrt::execute_engine`` operator which will take the engine and its inputs and return the results of engine exeuction.
1212

0 commit comments

Comments
 (0)