Skip to content

Commit b3ac797

Browse files
committed
put code under namespace trt_ep
1 parent 6b180a4 commit b3ac797

12 files changed

+45
-11
lines changed

plugin_execution_providers/tensorrt/cuda_allocator.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#include <cuda_runtime_api.h>
66
#include "cuda_allocator.h"
77

8+
namespace trt_ep {
9+
810
void CUDA_RETURN_IF_ERROR(cudaError_t res);
911

1012
void CUDAAllocator::CheckDevice(bool throw_when_fail) const {
@@ -74,3 +76,5 @@ void CUDAPinnedAllocator::Free(void* p) {
7476
const OrtMemoryInfo* CUDAPinnedAllocator::Info() const {
7577
return mem_info_;
7678
}
79+
80+
} // namespace trt_ep

plugin_execution_providers/tensorrt/cuda_allocator.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
using DeviceId = int16_t;
99

10+
namespace trt_ep {
11+
1012
struct CUDAAllocator : OrtAllocator {
1113
CUDAAllocator(const OrtMemoryInfo* mem_info, DeviceId device_id) : mem_info_(mem_info), device_id_(device_id) {
1214
OrtAllocator::version = ORT_API_VERSION;
@@ -62,3 +64,5 @@ struct CUDAPinnedAllocator : OrtAllocator {
6264
DeviceId device_id_ = 0;
6365
const OrtMemoryInfo* mem_info_ = nullptr;
6466
};
67+
68+
} // namespace trt_ep

plugin_execution_providers/tensorrt/onnx_ctx_model_helper.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "onnx_ctx_model_helper.h"
1010
#include "onnx/onnx_pb.h"
1111

12+
namespace trt_ep {
1213
extern TensorrtLogger& GetTensorrtLogger(bool verbose_log, const OrtLogger& ort_default_logger,
1314
const OrtApi* ort_api);
1415

@@ -272,4 +273,5 @@ std::string GetWeightRefittedEnginePath(std::string stripped_engine_cache) {
272273
std::filesystem::path stripped_engine_cache_path(stripped_engine_cache);
273274
std::string refitted_engine_cache_path = stripped_engine_cache_path.stem().stem().string() + ".engine";
274275
return refitted_engine_cache_path;
275-
}
276+
}
277+
} // namespace trt_ep

plugin_execution_providers/tensorrt/onnx_ctx_model_helper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <memory>
1313
#include <gsl/span>
1414

15+
namespace trt_ep {
1516
class EPContextNodeHelper : public ApiPtrs {
1617
public:
1718
EPContextNodeHelper(TensorrtExecutionProvider& ep,
@@ -79,3 +80,4 @@ class EPContextNodeReader : public ApiPtrs {
7980
size_t onnx_external_data_bytestream_size_;
8081
bool detailed_build_log_;
8182
}; // TRTCacheModelHandler
83+
} // namespace trt_ep

plugin_execution_providers/tensorrt/tensorrt_execution_provider.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ const OrtApi* g_ort_api = nullptr;
3535
const OrtEpApi* g_ep_api = nullptr;
3636
const OrtModelEditorApi* g_model_editor_api = nullptr;
3737

38+
namespace trt_ep {
39+
3840
void CUDA_RETURN_IF_ERROR(cudaError_t res) {
3941
if (res != cudaSuccess) abort();
4042
}
@@ -3597,3 +3599,4 @@ void TRTEpEpContextNodeComputeInfo::ReleaseStateImpl(OrtNodeComputeInfo* this_pt
35973599
(void)trt_ep_compute_state;
35983600
// Do nothing for here.
35993601
}
3602+
}

plugin_execution_providers/tensorrt/tensorrt_execution_provider.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
#define EXPORT_API
1818
#endif
1919

20+
using HashValue = uint64_t;
21+
using AllocateFunc = void* (*)(void*, size_t, size_t);
22+
using DestroyFunc = void (*)(void*, void*);
23+
24+
namespace trt_ep {
2025
namespace tensorrt_env_vars {
2126
static const std::string kMaxPartitionIterations = "ORT_TENSORRT_MAX_PARTITION_ITERATIONS";
2227
static const std::string kMinSubgraphSize = "ORT_TENSORRT_MIN_SUBGRAPH_SIZE";
@@ -60,10 +65,6 @@ static const std::string kEngineCachePrefix = "ORT_TENSORRT_CACHE_PREFIX";
6065
static const std::string kEngineCachePath = "ORT_TENSORRT_ENGINE_CACHE_PATH";
6166
} // namespace tensorrt_env_vars
6267

63-
using HashValue = uint64_t;
64-
using AllocateFunc = void* (*)(void*, size_t, size_t);
65-
using DestroyFunc = void (*)(void*, void*);
66-
6768
class TensorrtLogger : public nvinfer1::ILogger {
6869
nvinfer1::ILogger::Severity verbosity_;
6970
const OrtLogger& ort_default_logger_;
@@ -94,8 +95,7 @@ class TensorrtLogger : public nvinfer1::ILogger {
9495
OrtLoggingLevel ort_severity;
9596
if (severity <= Severity::kERROR) {
9697
ort_severity = ORT_LOGGING_LEVEL_ERROR;
97-
}
98-
else {
98+
} else {
9999
ort_severity = ORT_LOGGING_LEVEL_WARNING;
100100
}
101101

@@ -472,3 +472,4 @@ struct TRTEpEpContextNodeComputeInfo : OrtNodeComputeInfo {
472472

473473
TensorrtExecutionProvider& ep;
474474
};
475+
} // namespace trt_ep

plugin_execution_providers/tensorrt/tensorrt_execution_provider_data_transfer.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include <cassert>
88
#include <gsl/span>
99

10+
namespace trt_ep {
11+
1012
void CUDA_RETURN_IF_ERROR(cudaError_t res);
1113

1214
/*static*/
@@ -107,3 +109,4 @@ void ORT_API_CALL TRTEpDataTransfer::ReleaseImpl(OrtDataTransferImpl* this_ptr)
107109
// delete static_cast<TRTEpDataTransfer*>(this_ptr);
108110
;
109111
}
112+
} // namespace trt_ep

plugin_execution_providers/tensorrt/tensorrt_execution_provider_data_transfer.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "ep_utils.h"
77
#include "onnxruntime_c_api.h"
88

9+
namespace trt_ep {
10+
911
struct TRTEpDataTransfer : OrtDataTransferImpl, ApiPtrs {
1012
TRTEpDataTransfer(ApiPtrs api_ptrs, std::vector<const OrtMemoryDevice*>& device_mem_infos,
1113
std::vector<const OrtMemoryDevice*>& shared_mem_infos)
@@ -28,4 +30,5 @@ struct TRTEpDataTransfer : OrtDataTransferImpl, ApiPtrs {
2830
private:
2931
std::vector<const OrtMemoryDevice*>& cuda_gpu_mem_devices_;
3032
std::vector<const OrtMemoryDevice*>& cuda_pinned_mem_devices_;
31-
};
33+
};
34+
} // namespace trt_ep

plugin_execution_providers/tensorrt/tensorrt_execution_provider_stream_support.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include "cuda/cuda_common.h"
99
#include "cuda/cuda_call.h"
1010

11+
namespace trt_ep {
12+
1113
//
1214
// TrtSyncStreamImpl implementation
1315
//
@@ -117,3 +119,4 @@ OrtStatus* ORT_API_CALL TrtSyncNotificationImpl::WaitOnHostImpl(_In_ OrtSyncNoti
117119
void ORT_API_CALL TrtSyncNotificationImpl::ReleaseImpl(_In_ OrtSyncNotificationImpl* this_ptr) noexcept {
118120
delete static_cast<TrtSyncNotificationImpl*>(this_ptr);
119121
}
122+
} // namespace trt_ep

plugin_execution_providers/tensorrt/tensorrt_execution_provider_stream_support.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <cuda_runtime_api.h>
1111

12+
namespace trt_ep {
1213
//
1314
// Class implementing Stream support for synchronization.
1415
//
@@ -60,3 +61,4 @@ struct TrtSyncNotificationImpl : public OrtSyncNotificationImpl, public ApiPtrs
6061
cudaStream_t& stream_;
6162
cudaEvent_t event_;
6263
};
64+
} // namespace trt_ep

0 commit comments

Comments
 (0)