|
5 | 5 | #include <iostream> |
6 | 6 | #include <cuda_runtime.h> |
7 | 7 |
|
| 8 | +#define ORT_API_MANUAL_INIT |
| 9 | +#include "onnxruntime_cxx_api.h" |
| 10 | +#undef ORT_API_MANUAL_INIT |
| 11 | + |
8 | 12 | #include "ep_abi_utils.h" |
9 | 13 | #include "tensorrt_execution_provider.h" |
10 | 14 | #include "tensorrt_execution_provider_utils.h" |
11 | 15 | #include "tensorrt_cuda_allocator.h" |
12 | | -//#include "onnx_ctx_model_helper.h" |
| 16 | +#include "onnx_ctx_model_helper.h" |
13 | 17 | #include "onnx/onnx_pb.h" |
14 | 18 | #include "cuda/unary_elementwise_ops_impl.h" |
15 | 19 |
|
@@ -1697,9 +1701,10 @@ static const char* ORT_API_CALL GetNameImpl(const OrtEp* this_ptr) { |
1697 | 1701 | /// Constructor of Plugin TensorRT EP |
1698 | 1702 | /// |
1699 | 1703 | /// </summary> |
1700 | | -struct TensorrtExecutionProvider : TensorrtExecutionProvider(ApiPtrs apis, const std::string& name, const OrtHardwareDevice& device, |
1701 | | - const OrtSessionOptions& session_options, const OrtLogger& logger) |
1702 | | - : ApiPtrs(apis), name_{name}, hardware_device_{device}, session_options_{session_options}, logger_{logger} { |
| 1704 | +TensorrtExecutionProvider::TensorrtExecutionProvider(ApiPtrs apis, const std::string& name, |
| 1705 | + const OrtHardwareDevice& device, |
| 1706 | + const OrtSessionOptions& session_options, const OrtLogger& logger) |
| 1707 | + : ApiPtrs(apis), name_{name}, hardware_device_{device}, session_options_{session_options}, logger_{logger} { |
1703 | 1708 | // Initialize the execution provider. |
1704 | 1709 | auto status = ort_api.Logger_LogMessage(&logger_, |
1705 | 1710 | OrtLoggingLevel::ORT_LOGGING_LEVEL_INFO, |
@@ -1731,9 +1736,9 @@ struct TensorrtExecutionProvider : TensorrtExecutionProvider(ApiPtrs apis, const |
1731 | 1736 |
|
1732 | 1737 | // Provider options to TensorrtExecutionProviderInfo |
1733 | 1738 | info_ = TensorrtExecutionProviderInfo::FromProviderOptions(provider_options); |
1734 | | - if (ep_info.size() > 0) info_.has_trt_options = true; |
| 1739 | + info_.has_trt_options = true; |
1735 | 1740 | device_id_ = info_.device_id; |
1736 | | - api_->CreateDevice(OrtMemoryInfoDeviceType::OrtMemoryInfoDeviceType_GPU, OrtMemoryType::OrtMemoryType_Default, device_id_, &default_device); |
| 1741 | + //api_->CreateDevice(OrtMemoryInfoDeviceType::OrtMemoryInfoDeviceType_GPU, OrtMemoryType::OrtMemoryType_Default, device_id_, &default_device); |
1737 | 1742 |
|
1738 | 1743 | std::string profile_min_shapes, profile_max_shapes, profile_opt_shapes; |
1739 | 1744 |
|
@@ -2167,15 +2172,6 @@ struct TensorrtExecutionProvider : TensorrtExecutionProvider(ApiPtrs apis, const |
2167 | 2172 | } |
2168 | 2173 | } |
2169 | 2174 |
|
2170 | | -TensorrtExecutionProviderFactory::TensorrtExecutionProviderFactory() { |
2171 | | - OrtExecutionProviderFactory::CreateExecutionProvider = [](OrtExecutionProviderFactory* this_, const char* const* ep_option_keys, const char* const* ep_option_values, size_t option_size) -> OrtExecutionProvider* { |
2172 | | - ProviderOptions options; |
2173 | | - for (size_t i = 0; i < option_size; i++) options[ep_option_keys[i]] = ep_option_values[i]; |
2174 | | - std::unique_ptr<TensorrtExecutionProvider> ret = std::make_unique<TensorrtExecutionProvider>(tensorrtEp.c_str(), std::move(options)); |
2175 | | - return ret.release(); |
2176 | | - }; |
2177 | | -} |
2178 | | - |
2179 | 2175 | nvinfer1::IBuilder* TensorrtExecutionProvider::GetBuilder(TensorrtLogger& trt_logger) const { |
2180 | 2176 | if (!builder_) { |
2181 | 2177 | { |
|
0 commit comments