From a618f331ee1b49cdbf261e47fedcdb8ae6d528bc Mon Sep 17 00:00:00 2001 From: Umang Bhatt Date: Fri, 27 Feb 2026 11:10:26 +0530 Subject: [PATCH] Fix for Cuda graph in Pre-compiled path --- .../providers/nv_tensorrt_rtx/nv_execution_provider.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.cc b/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.cc index e40fc44b00a4b..8289575b60da2 100644 --- a/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.cc +++ b/onnxruntime/core/providers/nv_tensorrt_rtx/nv_execution_provider.cc @@ -3328,6 +3328,14 @@ Status NvExecutionProvider::CreateNodeComputeInfoFromPrecompiledEngine(const Gra auto trt_runtime_config = std::unique_ptr(trt_engine->createRuntimeConfig()); if (trt_runtime_config && cuda_graph_enable_) { trt_runtime_config->setDynamicShapesKernelSpecializationStrategy(nvinfer1::DynamicShapesKernelSpecializationStrategy::kEAGER); +#if TRT_MAJOR_RTX > 1 || (TRT_MAJOR_RTX == 1 && TRT_MINOR_RTX >= 3) + auto cuda_strategy_flag = trt_runtime_config->setCudaGraphStrategy(nvinfer1::CudaGraphStrategy::kWHOLE_GRAPH_CAPTURE); + LOGS_DEFAULT(INFO) << "[NvTensorRTRTX EP] CUDA graph strategy with RTX Graph capture enabled : " << cuda_strategy_flag; +#else + LOGS_DEFAULT(WARNING) << "[NvTensorRTRTX EP] CUDA graph is enabled but RTX Graph capture is not available. " + << "The current TRT RTX version does not support RTX Graph. " + << "Please upgrade to TRT RTX >= 1.3 to use RTX Graph capture feature for optimal CUDA graph performance."; +#endif } trt_runtime_config->setExecutionContextAllocationStrategy(nvinfer1::ExecutionContextAllocationStrategy::kUSER_MANAGED); std::string runtime_cache_file = "";