Skip to content

Commit 6ab3bf4

Browse files
authored
[NVIDIA] Enable clang format (opencv#716)
* [NVIDIA] Enable clang format * [NVIDIA] Format code
1 parent 2046995 commit 6ab3bf4

File tree

111 files changed

+1101
-1036
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1101
-1036
lines changed

modules/nvidia_plugin/src/CMakeLists.txt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@ set(HEADER_MASKS *.hpp *.cuh)
1010

1111
file(GLOB_RECURSE
1212
SOURCES
13-
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
1413
CONFIGURE_DEPENDS
1514
${SOURCE_MASKS}
1615
)
17-
list(REMOVE_ITEM SOURCES cuda_create_plugin.cpp cuda_create_extensions.cpp)
18-
list(FILTER SOURCES EXCLUDE REGEX "^ops/examples/.*$")
16+
list(FILTER SOURCES EXCLUDE REGEX ".*cuda_create_plugin\\.cpp$")
17+
list(FILTER SOURCES EXCLUDE REGEX ".*cuda_create_extensions\\.cpp$")
18+
list(FILTER SOURCES EXCLUDE REGEX ".*ops/examples/.*$")
1919
file(GLOB_RECURSE
2020
HEADERS
21-
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
2221
${HEADER_MASKS}
2322
)
2423

@@ -32,14 +31,15 @@ if(ENABLE_PROXY)
3231
endif()
3332

3433
# Adds a shared library with plugin
35-
ie_add_plugin(NAME ${TARGET_NAME}
34+
ov_add_plugin(NAME ${TARGET_NAME}
3635
DEVICE_NAME "NVIDIA"
3736
SOURCES ${HEADERS} cuda_create_plugin.cpp cuda_create_extensions.cpp
3837
DEFAULT_CONFIG ${PLUGIN_DEFAULT_CONFIG}
39-
VERSION_DEFINES_FOR cuda_create_plugin.cpp)
38+
VERSION_DEFINES_FOR cuda_create_plugin.cpp
39+
ADD_CLANG_FORMAT)
4040

4141
# Enable support of CC for the plugin
42-
ie_mark_target_as_cc(${TARGET_NAME})
42+
ov_mark_target_as_cc(${TARGET_NAME})
4343

4444
set_property(TARGET ${OBJ_NAME} PROPERTY CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES})
4545

@@ -77,6 +77,6 @@ target_link_libraries(${OBJ_NAME}
7777

7878
# ATTENTION: uncomment to register a plugin in the plugins.xml file
7979
if(ENABLE_NVIDIA)
80-
ie_register_plugins(MAIN_TARGET ${TARGET_NAME}
80+
ov_register_plugins(MAIN_TARGET ${TARGET_NAME}
8181
POSSIBLE_PLUGINS ${TARGET_NAME})
8282
endif()

modules/nvidia_plugin/src/cuda/graph.hpp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44

55
#pragma once
66

7-
#include "runtime.hpp"
87
#include <optional>
98

9+
#include "runtime.hpp"
10+
1011
namespace CUDA {
1112

1213
class GraphCapture;
1314
class CaptureInfo;
1415

15-
class Graph: public Handle<cudaGraph_t> {
16+
class Graph : public Handle<cudaGraph_t> {
1617
public:
1718
Graph(unsigned int flags);
1819

@@ -23,14 +24,14 @@ class Graph: public Handle<cudaGraph_t> {
2324
private:
2425
Graph(cudaGraph_t graph);
2526

26-
static cudaError_t createFromNative(cudaGraph_t *pGraph, cudaGraph_t anotherGraph);
27+
static cudaError_t createFromNative(cudaGraph_t* pGraph, cudaGraph_t anotherGraph);
2728

2829
static cudaGraph_t createNativeWithFlags(unsigned int flags);
2930
};
3031

3132
bool operator==(const Graph& rhs, const Graph& lhs);
3233

33-
class GraphExec: public Handle<cudaGraphExec_t> {
34+
class GraphExec : public Handle<cudaGraphExec_t> {
3435
public:
3536
GraphExec(const Graph& g);
3637

@@ -73,16 +74,18 @@ class GraphCapture {
7374

7475
private:
7576
Stream stream_;
76-
cudaGraph_t cudaGraph_ {};
77-
cudaError_t capturedError_ {cudaSuccess};
78-
std::optional<Graph> graph_ {};
77+
cudaGraph_t cudaGraph_{};
78+
cudaError_t capturedError_{cudaSuccess};
79+
std::optional<Graph> graph_{};
7980
};
8081

8182
class UploadNode {
8283
friend CaptureInfo;
84+
8385
public:
8486
void update_src(const GraphExec& exec, const void* src);
8587
bool operator==(const UploadNode& rhs) const;
88+
8689
private:
8790
UploadNode(cudaGraphNode_t node, CUDA::DevicePointer<void*> dst, const void* src, std::size_t size);
8891
cudaGraphNode_t node_;
@@ -93,9 +96,11 @@ class UploadNode {
9396

9497
class DownloadNode {
9598
friend CaptureInfo;
99+
96100
public:
97101
void update_dst(const GraphExec& exec, void* dst);
98102
bool operator==(const DownloadNode& rhs) const;
103+
99104
private:
100105
DownloadNode(cudaGraphNode_t node, void* dst, CUDA::DevicePointer<const void*> src, std::size_t size);
101106
cudaGraphNode_t node_;
@@ -118,4 +123,4 @@ class CaptureInfo {
118123
size_t depCount_;
119124
};
120125

121-
}// namespace CUDA
126+
} // namespace CUDA

modules/nvidia_plugin/src/cuda_async_infer_request.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44

55
#pragma once
66

7+
#include "cuda_infer_request.hpp"
78
#include "openvino/runtime/iasync_infer_request.hpp"
89
#include "openvino/runtime/iinfer_request.hpp"
910

10-
#include "cuda_infer_request.hpp"
11-
1211
namespace ov {
1312
namespace nvidia_gpu {
1413

modules/nvidia_plugin/src/cuda_eager_topology_runner.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#pragma once
66

77
#include <ops/subgraph.hpp>
8+
89
#include "cuda_itopology_runner.hpp"
910

1011
namespace ov {
@@ -16,7 +17,7 @@ class EagerTopologyRunner final : public SubGraph, public ITopologyRunner {
1617
~EagerTopologyRunner() override = default;
1718

1819
void Run(const InferenceRequestContext& context, const DeviceMemBlock& memoryBlock) const override;
19-
void UpdateContext(InferenceRequestContext& context, const DeviceMemBlock& memoryBlock) const override {};
20+
void UpdateContext(InferenceRequestContext& context, const DeviceMemBlock& memoryBlock) const override{};
2021
const SubGraph& GetSubGraph() const override;
2122
};
2223

modules/nvidia_plugin/src/cuda_graph_context.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#pragma once
66

77
#include <cuda/graph.hpp>
8+
89
#include "cuda_tensor_mapping_context.hpp"
910

1011
namespace ov {

modules/nvidia_plugin/src/cuda_infer_request.hpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,15 @@
1313
#include <unordered_map>
1414
#include <vector>
1515

16-
17-
#include "openvino/runtime/tensor.hpp"
18-
#include "openvino/runtime/isync_infer_request.hpp"
19-
#include "openvino/itt.hpp"
20-
21-
2216
#include "cancellation_token.hpp"
2317
#include "cuda_config.hpp"
24-
#include "cuda_operation_base.hpp"
2518
#include "cuda_iexecution_delegator.hpp"
19+
#include "cuda_operation_base.hpp"
2620
#include "memory_manager/cuda_memory_manager.hpp"
2721
#include "memory_manager/cuda_memory_pool.hpp"
22+
#include "openvino/itt.hpp"
23+
#include "openvino/runtime/isync_infer_request.hpp"
24+
#include "openvino/runtime/tensor.hpp"
2825
#include "utils/perf_timing.hpp"
2926

3027
namespace ov {
@@ -33,7 +30,7 @@ namespace nvidia_gpu {
3330
class CompiledModel;
3431

3532
// ! [infer_request:header]
36-
class CudaInferRequest : public ov::ISyncInferRequest {
33+
class CudaInferRequest : public ov::ISyncInferRequest {
3734
public:
3835
using Ptr = std::shared_ptr<CudaInferRequest>;
3936

@@ -52,7 +49,8 @@ class CudaInferRequest : public ov::ISyncInferRequest {
5249
void infer_postprocess();
5350
void cancel();
5451

55-
void set_tensors_impl(const ov::Output<const ov::Node> port, const std::vector<ov::SoPtr<ov::ITensor>>& tensors) override;
52+
void set_tensors_impl(const ov::Output<const ov::Node> port,
53+
const std::vector<ov::SoPtr<ov::ITensor>>& tensors) override;
5654

5755
private:
5856
std::shared_ptr<const CompiledModel> get_nvidia_model();

modules/nvidia_plugin/src/cuda_inference_request_context.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
#include <memory_manager/cuda_device_mem_block.hpp>
88

99
#include "cancellation_token.hpp"
10+
#include "cuda_graph_context.hpp"
1011
#include "cuda_tensor_mapping_context.hpp"
1112
#include "cuda_thread_context.hpp"
12-
#include "cuda_graph_context.hpp"
1313

1414
namespace ov {
1515
namespace nvidia_gpu {

modules/nvidia_plugin/src/cuda_op_buffers_extractor.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include <unordered_map>
1515
#include <vector>
1616

17-
#include "openvino/core/node.hpp"
1817
#include "memory_manager/cuda_workbuffers.hpp"
18+
#include "openvino/core/node.hpp"
1919

2020
namespace ov {
2121
namespace nvidia_gpu {

modules/nvidia_plugin/src/cuda_operation_registry.hpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,14 @@ class OperationRegistry::Register<OperationBase> {
129129
* where NodeOp is a type's inner alias for a concrete OpenVINO Node class
130130
* @param name - a textual operator's name
131131
*/
132-
#define OPERATION_REGISTER(type, name) \
133-
extern "C" { \
134-
[[maybe_unused]] const ::ov::nvidia_gpu::OperationRegistry::Register<type> openvino_cuda_op_register_##name{#name}; \
132+
#define OPERATION_REGISTER(type, name) \
133+
extern "C" { \
134+
[[maybe_unused]] const ::ov::nvidia_gpu::OperationRegistry::Register<type> openvino_cuda_op_register_##name{ \
135+
#name}; \
135136
}
136137

137-
#define OPERATION_REGISTER_FACTORY(factory, name) \
138-
extern "C" { \
139-
[[maybe_unused]] const ::ov::nvidia_gpu::OperationRegistry::Register<OperationBase> openvino_cuda_op_register_##name{ \
140-
#name, factory}; \
138+
#define OPERATION_REGISTER_FACTORY(factory, name) \
139+
extern "C" { \
140+
[[maybe_unused]] const ::ov::nvidia_gpu::OperationRegistry::Register<OperationBase> \
141+
openvino_cuda_op_register_##name{#name, factory}; \
141142
}

modules/nvidia_plugin/src/cuda_plugin.hpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44

55
#pragma once
66

7+
#include "cuda_compiled_model.hpp"
8+
#include "cuda_config.hpp"
9+
#include "cuda_thread_pool.hpp"
710
#include "openvino/runtime/icompiled_model.hpp"
811
#include "openvino/runtime/iplugin.hpp"
912
#include "openvino/runtime/threading/itask_executor.hpp"
10-
11-
#include "cuda_config.hpp"
12-
#include "cuda_compiled_model.hpp"
13-
#include "cuda_thread_pool.hpp"
1413
#include "transformer/cuda_graph_transformer.hpp"
1514

1615
namespace ov {

0 commit comments

Comments
 (0)