From 8d6ade9e08fcac5c9ff0a96cddcc0db3d4da6abd Mon Sep 17 00:00:00 2001 From: George Wu Date: Thu, 5 May 2022 09:25:54 -0700 Subject: [PATCH] [TensorRT EP] reduce CI pipelines test execution time (#11440) * add global builder placeholder to improve CI test time for TRT EP * fix build error * rename var, put in unnamed namespace * fix build error * fix --- .../providers/tensorrt/tensorrt_execution_provider.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc b/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc index f9145b925c..6710296f67 100644 --- a/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc +++ b/onnxruntime/core/providers/tensorrt/tensorrt_execution_provider.cc @@ -37,9 +37,19 @@ ? common::Status::OK() \ : ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "CUDA error executing ", #expr)) +namespace onnxruntime { +TensorrtLogger& GetTensorrtLogger(); +} + using namespace ONNX_NAMESPACE; using namespace ::onnxruntime::logging; namespace { +#ifdef ORT_RUN_EXTERNAL_ONNX_TESTS +// instantiate global unused builder object which keeps the TRT kernel library in memory +// so that subsequent builders avoid the expensive load / unload process. +auto const trt_builder_placeholder = + tensorrt_ptr::unique_pointer(nvinfer1::createInferBuilder(GetTensorrtLogger())); +#endif // Check if cycle exists in the graph after partitioning bool FindCycleHelper(size_t i, const std::list* adjacency_map, bool visited[], bool* st, std::vector& cycles) { if (!visited[i]) {