-
Notifications
You must be signed in to change notification settings - Fork 369
add capture and replay feature in tensorrt #3849
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
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
aef5c35
add capture and replay feature
lanluo-nvidia 30b9707
test
lanluo-nvidia 96d7816
add doc
lanluo-nvidia 3cb680c
modify doc
lanluo-nvidia 9c80778
resolve comments
lanluo-nvidia e77b493
resolve comments
lanluo-nvidia 9391b62
resolve comments
lanluo-nvidia 6104bc0
resolve comments
lanluo-nvidia ba3259f
resolve comments
lanluo-nvidia 6d8c1ec
resolve comments
lanluo-nvidia 86a3cf2
change doc to rst format
lanluo-nvidia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Introduction | ||
============ | ||
|
||
This toolchain captures TensorRT network creation and build parameters at runtime via a shim, then deterministically replays them to reproduce an engine build. Use it to debug or reproduce builds independent of the originating framework. | ||
|
||
Prerequisites | ||
------------- | ||
|
||
- TensorRT installed (ensure you know the absolute path to its ``lib`` and ``bin`` directories) | ||
- ``libtensorrt_shim.so`` available in your TensorRT ``lib`` directory | ||
- ``tensorrt_player`` available in your TensorRT ``bin`` directory | ||
|
||
Quick start: Capture | ||
-------------------- | ||
|
||
.. code-block:: bash | ||
|
||
TORCHTRT_ENABLE_TENSORRT_API_CAPTURE=1 python test.py | ||
|
||
You should see ``shim.json`` and ``shim.bin`` generated in ``/tmp/torch_tensorrt_{current_user}/shim``. | ||
|
||
Replay: Build the engine from the capture | ||
----------------------------------------- | ||
|
||
Use ``tensorrt_player`` to replay the captured build without the original framework: | ||
|
||
.. code-block:: bash | ||
|
||
tensorrt_player -j /absolute/path/to/shim.json -o /absolute/path/to/output_engine | ||
|
||
This produces a serialized TensorRT engine at ``output_engine``. | ||
|
||
Validate the engine | ||
------------------- | ||
|
||
Run the engine with ``trtexec``: | ||
|
||
.. code-block:: bash | ||
|
||
trtexec --loadEngine=/absolute/path/to/output_engine | ||
|
||
Notes | ||
----- | ||
|
||
- Ensure the ``libnvinfer.so`` used by the shim matches the TensorRT version in your environment. | ||
- If multiple TensorRT versions are installed, prefer absolute paths as shown above. | ||
- Currently, it is not supported to capture multiple engines, in case of graph break, only the first engine will be captured. | ||
|
||
|
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.