mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-25 19:48:11 +00:00
[TensorRT EP] Fix to build ORT on legacy TRT8.5 (#23215)
### Description <!-- Describe your changes. --> For legacy jetson users who use jetpack 5.x, the latest TRT version is 8.5. Add version check to newer trt features to fix build on jetpack 5.x (cuda11.8+gcc11 are required) ### Motivation and Context <!-- - Why is this change required? What problem does it solve? - If it fixes an open issue, please link to the issue here. -->
This commit is contained in:
parent
a3833a5e79
commit
bc91f5c72e
1 changed files with 6 additions and 0 deletions
|
|
@ -3146,12 +3146,14 @@ Status TensorrtExecutionProvider::CreateNodeComputeInfoFromGraph(const GraphView
|
|||
}
|
||||
|
||||
std::string cache_hw_compat = "_sm" + compute_capability_;
|
||||
#if NV_TENSORRT_MAJOR == 8 && NV_TENSORRT_MINOR > 5 || NV_TENSORRT_MAJOR > 8
|
||||
// Enable hardware compatility mode if assigned
|
||||
if (engine_cache_enable_ && engine_hw_compatible_) {
|
||||
trt_config->setHardwareCompatibilityLevel(nvinfer1::HardwareCompatibilityLevel::kAMPERE_PLUS);
|
||||
cache_hw_compat = "_sm80+";
|
||||
LOGS_DEFAULT(VERBOSE) << "[TensorRT EP] Hardware compatibility is enabled when loading and capturing engine cache.";
|
||||
}
|
||||
#endif
|
||||
|
||||
// Name the engine cache based on GPU compute capacity and reduce the chance of loading an incompatible cache
|
||||
// Note: Engine cache generated on a GPU with large memory might not be loadable on a GPU with smaller memory, even if they share the same compute capacity
|
||||
|
|
@ -3530,10 +3532,12 @@ Status TensorrtExecutionProvider::CreateNodeComputeInfoFromGraph(const GraphView
|
|||
|
||||
// Enable hardware compatility mode if assigned
|
||||
std::string cache_hw_compat = "_sm" + compute_capability_;
|
||||
#if NV_TENSORRT_MAJOR == 8 && NV_TENSORRT_MINOR > 5 || NV_TENSORRT_MAJOR > 8
|
||||
if (engine_cache_enable_ && engine_hw_compatible_) {
|
||||
cache_hw_compat = "_sm80+";
|
||||
LOGS_DEFAULT(VERBOSE) << "[TensorRT EP] Hardware compatibility is enabled when loading and capturing engine cache.";
|
||||
}
|
||||
#endif
|
||||
|
||||
// Name the engine cache based on GPU compute capacity and reduce the chance of loading an incompatible cache
|
||||
// Note: Engine cache generated on a GPU with large memory might not be loadable on a GPU with smaller memory, even if they share the same compute capacity
|
||||
|
|
@ -3736,11 +3740,13 @@ Status TensorrtExecutionProvider::CreateNodeComputeInfoFromGraph(const GraphView
|
|||
}
|
||||
}
|
||||
|
||||
#if NV_TENSORRT_MAJOR == 8 && NV_TENSORRT_MINOR > 5 || NV_TENSORRT_MAJOR > 8
|
||||
// Enable hardware compatility mode if assigned
|
||||
if (trt_state->engine_hw_compatible) {
|
||||
trt_config->setHardwareCompatibilityLevel(nvinfer1::HardwareCompatibilityLevel::kAMPERE_PLUS);
|
||||
LOGS_DEFAULT(INFO) << "[TensorRT EP] Re-generate engine with hardware compatibility enabled.";
|
||||
}
|
||||
#endif
|
||||
|
||||
// Build engine
|
||||
std::unique_ptr<nvinfer1::IHostMemory> serialized_engine;
|
||||
|
|
|
|||
Loading…
Reference in a new issue