ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
Find a file
Chi Lo 46dd0d3f52
[TensorRT EP] Load precompiled TRT engine file directly (#18217)
When the TRT engine cache (precompiled engine) is present, it doesn't
make sense to go over the processes of model verification, model
optimization, TRT EP's GetCapability(), TRT EP's model proto
reconstruction, calling TRT parser and engine compilation.
This PR makes TRT EP skip those processes and directly load the engine
to perform inference.

The feature request:
https://github.com/microsoft/onnxruntime/issues/18072

Features:

- Replace original model with TRT engine wrapped ONNX model. It can save
a lot of time as mentioned above.

- How to get TRT engine wrapped ONNX model?
1. Set `trt_dump_ep_context_model` provider option to "true" and run the
inference. You will find the "xxx_wrapper.onnx" at the engine cache
path. (The same logic of generating engine cache)
    2. Use gen_trt_engine_wrapper_onnx_model.py

- Three provider options are added, 
`trt_dump_ep_context_model`: Enable dump wrapped onnx model by TRT EP
`trt_ep_context_embed_mode`: Add embed_mode as attribute. 0 means engine
cache path, 1 means engine binary data.
`trt_ep_context_compute_capability_enable`: Add hardware_arch as
attribute. When running the model, TRT EP will check consistency between
model's hardware_arch and GPU's compute capability.

- When the engine cache path is given in the wrapped model, TRT EP will
first search for the engine file using the path (relative to model
path), if it can't find it, it will change to use the path as it is
(depends on user, could be relative to working dir or absolute path)

Note: 

1. This PR includes the change of
https://github.com/microsoft/onnxruntime/pull/17751


Constraints:

1. The whole model should be fully supported by TRT. 
4. Users need to make sure the engine is built with min/max/opt
optimization profiles that large enough to cover the range of all
inputs. TRT EP will simply fail and won't rebuild the engine if the
input shape is out of range during runtime.
2024-01-11 22:20:54 -08:00
.config
.devcontainer
.gdn
.github Disable rust pipeline for now (#19067) 2024-01-09 17:09:31 -08:00
.pipelines Remove Windows ARM32 from nuget packaging pipelines (#19049) 2024-01-09 07:45:03 -08:00
.vscode update .vscode/settings.json (#19084) 2024-01-10 19:26:01 -08:00
cgmanifests Update absl and googletest (#18827) 2023-12-14 16:15:07 -08:00
cmake [ROCm] Fix hipify error: fast_divmod.h: No such file or directory (#19060) 2024-01-10 14:49:19 +08:00
csharp Update c# dependencies (#18995) 2024-01-04 10:41:28 -08:00
dockerfiles Update dockerfiles/Dockerfile.source to avoid installing onnx (#17975) 2023-10-20 09:24:21 -07:00
docs [TensorRT EP] Load precompiled TRT engine file directly (#18217) 2024-01-11 22:20:54 -08:00
include/onnxruntime/core [TensorRT EP] Load precompiled TRT engine file directly (#18217) 2024-01-11 22:20:54 -08:00
java [java] Make the backing byte buffer in an OrtValue accessible (#16578) 2023-10-17 10:03:49 -07:00
js [js/webgpu] fix bcast in where (#19009) 2024-01-11 12:13:24 -08:00
objectivec Objective-C API updates (#18738) 2023-12-07 16:47:46 -08:00
onnxruntime [TensorRT EP] Load precompiled TRT engine file directly (#18217) 2024-01-11 22:20:54 -08:00
orttraining Offline tooling for training to use reduction with keepdims=False (#19027) 2024-01-11 10:51:23 -08:00
rust Fix rust compile issues and add GH action to run build validations and tests (#18346) 2023-11-09 04:26:02 -08:00
samples Removed all the deprecated python training code and related tests and utils (#18333) 2023-11-17 18:19:21 -08:00
tools Fix Nuget CUDA Packaging pipeline (#19054) 2024-01-11 11:59:21 -08:00
winml Update winml to use #cores - #soc cores by Default as the number of intraopthreads (#18384) 2023-11-28 09:26:48 -08:00
.clang-format
.clang-tidy
.dockerignore
.gitattributes
.gitignore Build onnxruntime.dll as arm64x (#18633) 2023-12-06 16:49:00 -08:00
.gitmodules
.lintrunner.toml FP16 optimizer automatically detect DeepSpeed compatibility (#18084) 2023-10-25 15:11:02 +08:00
build.bat
build.sh
build_arm64x.bat Build onnxruntime.dll as arm64x (#18633) 2023-12-06 16:49:00 -08:00
CITATION.cff
CODEOWNERS
CONTRIBUTING.md
lgtm.yml
LICENSE
NuGet.config
ort.wprp ORT ETW dynamic logging that improves ORT diagnosability & performance (#18882) 2024-01-11 12:43:27 -08:00
ORT_icon_for_light_bg.png
packages.config Update DML version to 1.13.0 (#18978) 2024-01-03 16:09:55 -08:00
pyproject.toml [ORTModule] ATen Efficient Attention and Triton Flash Attention (#17959) 2023-10-27 10:29:27 +08:00
README.md Update README.md (#18963) 2024-01-03 17:26:25 -08:00
requirements-dev.txt
requirements-doc.txt
requirements-lintrunner.txt Bump linter versions (#18341) 2023-11-08 13:04:40 -08:00
requirements-training.txt
requirements.txt.in
SECURITY.md
setup.py Adding python3.12 support to ORT (#18814) 2024-01-11 08:34:28 -08:00
ThirdPartyNotices.txt
VERSION_NUMBER

ONNX Runtime is a cross-platform inference and training machine-learning accelerator.

ONNX Runtime inference can enable faster customer experiences and lower costs, supporting models from deep learning frameworks such as PyTorch and TensorFlow/Keras as well as classical machine learning libraries such as scikit-learn, LightGBM, XGBoost, etc. ONNX Runtime is compatible with different hardware, drivers, and operating systems, and provides optimal performance by leveraging hardware accelerators where applicable alongside graph optimizations and transforms. Learn more →

ONNX Runtime training can accelerate the model training time on multi-node NVIDIA GPUs for transformer models with a one-line addition for existing PyTorch training scripts. Learn more →

Get Started & Resources

Builtin Pipeline Status

System Inference Training
Windows Build Status
Build Status
Build Status
Linux Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Build Status
Mac Build Status
Android Build Status
iOS Build Status
Web Build Status
Other Build Status

Third-party Pipeline Status

System Inference Training
Linux Build Status

Data/Telemetry

Windows distributions of this project may collect usage data and send it to Microsoft to help improve our products and services. See the privacy statement for more details.

Contributions and Feedback

We welcome contributions! Please see the contribution guidelines.

For feature requests or bug reports, please file a GitHub Issue.

For general discussion or questions, please use GitHub Discussions.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

License

This project is licensed under the MIT License.