Skip to content

Commit ced3359

Browse files
committed
fix test, clean header and clang-format
1 parent 73f04f4 commit ced3359

10 files changed

Lines changed: 29 additions & 41 deletions

File tree

src/plugins/intel_npu/src/backend/include/zero_dynamic_pipeline.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#pragma once
66

7-
#include "intel_npu/common/graph_arguments.hpp"
7+
#include "intel_npu/common/dynamic_graph_arguments.hpp"
88
#include "intel_npu/common/network_metadata.hpp"
99
#include "zero_pipeline.hpp"
1010

src/plugins/intel_npu/src/backend/include/zero_pipeline.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#pragma once
66

7-
#include "intel_npu/common/graph_arguments.hpp"
87
#include "intel_npu/common/igraph.hpp"
98
#include "intel_npu/utils/zero/zero_tensor.hpp"
109
#include "intel_npu/utils/zero/zero_wrappers.hpp"

src/plugins/intel_npu/src/backend/src/zero_dynamic_infer_request.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,7 @@ void ZeroDynamicInferRequest::predict_shapes(std::vector<MemRefType>& outputProp
283283
}
284284
}
285285

286-
void ZeroDynamicInferRequest::check_tensor_and_predicted_shapes(
287-
const std::vector<MemRefType>& outputProps) {
286+
void ZeroDynamicInferRequest::check_tensor_and_predicted_shapes(const std::vector<MemRefType>& outputProps) {
288287
if (outputProps.empty()) {
289288
_logger.debug("check_tensor_and_predicted_shapes - no output props to check, skip check");
290289
return;

src/plugins/intel_npu/src/backend/src/zero_dynamic_pipeline.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include <sstream>
1111

12-
#include "intel_npu/common/dynamic_graph_vm_impl.hpp"
12+
#include "intel_npu/common/dynamic_graph_arguments_impl.hpp"
1313
#include "intel_npu/common/itt.hpp"
1414
#include "intel_npu/config/options.hpp"
1515
#include "intel_npu/prefix.hpp"
@@ -201,7 +201,7 @@ void DynamicPipeline::execute_vm_runtime(npu_vm_runtime_handle_t vmRuntime,
201201
ze_command_queue_handle_t commandQueue,
202202
ze_fence_handle_t fence,
203203
ze_event_handle_t event) {
204-
_logger.debug("execute_vm_runtime - started");
204+
_logger.debug("Start to execute graph with runtime engine");
205205

206206
const bool firstExecution = (args._impl == nullptr);
207207
std::shared_ptr<DynamicGraphArgumentsImpl> argsImpl =
@@ -239,7 +239,7 @@ void DynamicPipeline::execute_vm_runtime(npu_vm_runtime_handle_t vmRuntime,
239239
}
240240

241241
if (!firstExecution && noTensorChange) {
242-
_logger.debug("execute_vm_runtime - reuse command list (no tensor change)");
242+
_logger.debug("Reuse command list without update since no tensor change detected");
243243
auto result = zeCommandQueueExecuteCommandLists(commandQueue,
244244
static_cast<uint32_t>(commandLists.size()),
245245
commandLists.data(),
@@ -250,16 +250,16 @@ void DynamicPipeline::execute_vm_runtime(npu_vm_runtime_handle_t vmRuntime,
250250
return;
251251
}
252252

253-
_logger.debug("execute_vm_runtime - reset command lists");
254-
// Reset commandLists since there are tensors with new shapes (or first execution); can not reuse via update.
253+
_logger.debug("Reset command list to run with runtime");
254+
// Reset commandLists since there are tensor with new shapes or it is the first execution, can not reuse command
255+
// list with update
255256
for (auto& cmdList : commandLists) {
256257
zeCommandListReset(cmdList);
257258
}
258259

259260
// Lazily create the VM execution context (owned by argsImpl, destroyed with it).
260261
if (params->executionContext == nullptr) {
261-
if (npuVMRuntimeCreateExecutionContext(vmRuntime, &params->executionContext) !=
262-
NPU_VM_RUNTIME_RESULT_SUCCESS) {
262+
if (npuVMRuntimeCreateExecutionContext(vmRuntime, &params->executionContext) != NPU_VM_RUNTIME_RESULT_SUCCESS) {
263263
OPENVINO_THROW("Failed to create a VM execution context");
264264
}
265265
_logger.debug("execute_vm_runtime - execution context created");
@@ -278,6 +278,7 @@ void DynamicPipeline::execute_vm_runtime(npu_vm_runtime_handle_t vmRuntime,
278278
params->inferenceFence = fence;
279279
params->event = event;
280280

281+
_logger.debug("Execute graph with runtime engine");
281282
if (npuVMRuntimeExecute(vmRuntime, params) != NPU_VM_RUNTIME_RESULT_SUCCESS) {
282283
OPENVINO_THROW("Failed to execute VM runtime engine");
283284
}
@@ -286,7 +287,7 @@ void DynamicPipeline::execute_vm_runtime(npu_vm_runtime_handle_t vmRuntime,
286287
args._impl = argsImpl;
287288
}
288289

289-
_logger.debug("execute_vm_runtime - completed");
290+
_logger.debug("Completed to execute graph with runtime engine");
290291
}
291292

292293
void DynamicPipeline::predict_output_shape(const IGraph& graph,
@@ -301,8 +302,7 @@ void DynamicPipeline::predict_output_shape(const IGraph& graph,
301302
std::vector<npu_vm_runtime_mem_ref_handle_t> inputs;
302303
inputs.reserve(inputDescriptors.size());
303304
for (auto& in : inputDescriptors) {
304-
std::shared_ptr<DynamicGraphMemRefImpl> inImpl =
305-
std::static_pointer_cast<DynamicGraphMemRefImpl>(in._impl);
305+
std::shared_ptr<DynamicGraphMemRefImpl> inImpl = std::static_pointer_cast<DynamicGraphMemRefImpl>(in._impl);
306306
if (inImpl == nullptr) {
307307
inImpl = std::make_shared<DynamicGraphMemRefImpl>();
308308
in._impl = inImpl;
@@ -314,8 +314,7 @@ void DynamicPipeline::predict_output_shape(const IGraph& graph,
314314
std::vector<npu_vm_runtime_mem_ref_handle_t> outputs;
315315
outputs.reserve(outputDescriptors.size());
316316
for (auto& out : outputDescriptors) {
317-
std::shared_ptr<DynamicGraphMemRefImpl> outImpl =
318-
std::static_pointer_cast<DynamicGraphMemRefImpl>(out._impl);
317+
std::shared_ptr<DynamicGraphMemRefImpl> outImpl = std::static_pointer_cast<DynamicGraphMemRefImpl>(out._impl);
319318
if (outImpl == nullptr) {
320319
outImpl = std::make_shared<DynamicGraphMemRefImpl>();
321320
out._impl = outImpl;
@@ -335,8 +334,7 @@ void DynamicPipeline::predict_output_shape(const IGraph& graph,
335334
}
336335

337336
for (auto& out : outputDescriptors) {
338-
std::shared_ptr<DynamicGraphMemRefImpl> outImpl =
339-
std::static_pointer_cast<DynamicGraphMemRefImpl>(out._impl);
337+
std::shared_ptr<DynamicGraphMemRefImpl> outImpl = std::static_pointer_cast<DynamicGraphMemRefImpl>(out._impl);
340338
OPENVINO_ASSERT(outImpl != nullptr,
341339
"MemRefType implementation is broken, unknown error happens in shape prediction.");
342340
outImpl->alignWithHandle(out);

src/plugins/intel_npu/src/common/include/intel_npu/common/graph_arguments.hpp renamed to src/plugins/intel_npu/src/common/include/intel_npu/common/dynamic_graph_arguments.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@
44

55
#pragma once
66

7-
#include "intel_npu/common/igraph.hpp"
8-
#include "intel_npu/utils/zero/zero_init.hpp"
7+
#include <cstdint>
8+
#include <iosfwd>
9+
#include <memory>
10+
#include <string>
11+
#include <vector>
912

10-
namespace intel_npu {
13+
#include "openvino/core/except.hpp"
14+
#include "openvino/core/shape.hpp"
15+
#include "openvino/runtime/itensor.hpp"
1116

12-
/// Host-side description of a single VM-runtime MemRef. Used as the per-IO entry inside
13-
/// @ref GraphArguments. The opaque @c _impl pointer carries a @c DynamicGraphMemRefImpl
14-
/// (defined in dynamic_graph_vm_impl.hpp) which owns the underlying VM MemRef handle.
17+
namespace intel_npu {
1518
struct MemRefType {
1619
const void* _basePtr;
1720
const void* _data;
@@ -46,9 +49,6 @@ struct MemRefType {
4649
std::string toString();
4750
};
4851

49-
/// Runtime carrier for VM-pipeline inputs/outputs. Owned by @c PipelinedCommandLists.
50-
/// The opaque @c _impl holds a @c DynamicGraphArgumentsImpl (VM execution context + cached
51-
/// mem-ref vectors), created lazily on first VM execution.
5252
struct GraphArguments {
5353
std::vector<MemRefType> _inputs;
5454
std::vector<MemRefType> _outputs;

src/plugins/intel_npu/src/common/include/intel_npu/common/dynamic_graph_vm_impl.hpp renamed to src/plugins/intel_npu/src/common/include/intel_npu/common/dynamic_graph_arguments_impl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <memory>
88
#include <vector>
99

10-
#include "intel_npu/common/graph_arguments.hpp"
10+
#include "intel_npu/common/dynamic_graph_arguments.hpp"
1111
#include "intel_npu/utils/vm/npu_vm_runtime_api.hpp"
1212
#include "openvino/core/except.hpp"
1313

src/plugins/intel_npu/src/common/include/intel_npu/common/igraph.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
// to dereference / call into the VM runtime. Keeping it forward-declared here avoids
2222
// pulling the VM headers into every consumer of the IGraph interface.
2323
struct _npu_vm_runtime_handle_t;
24-
using npu_vm_runtime_handle_t = struct _npu_vm_runtime_handle_t*;
2524

2625
namespace intel_npu {
2726

@@ -42,6 +41,7 @@ class IGraph : public std::enable_shared_from_this<IGraph> {
4241
virtual std::vector<ov::ProfilingInfo> process_profiling_output(const std::vector<uint8_t>& profData) const;
4342

4443
virtual void set_argument_value(uint32_t id, const void* data) const;
44+
4545
virtual void set_argument_value_with_strides(uint32_t id,
4646
const void* data,
4747
const std::vector<size_t>& strides) const;
@@ -87,7 +87,7 @@ class IGraph : public std::enable_shared_from_this<IGraph> {
8787
/// Return the VM-runtime engine handle backing this graph, or nullptr if the graph does
8888
/// not use the VM-runtime (e.g. static driver-only graphs). Used by the dynamic pipeline
8989
/// to drive @c npuVMRuntimeExecute.
90-
virtual npu_vm_runtime_handle_t get_vm_runtime_handle() const;
90+
virtual _npu_vm_runtime_handle_t* get_vm_runtime_handle() const;
9191

9292
/// Return the number of subgraphs this graph contains. Defaults to 1 for static graphs.
9393
virtual uint64_t get_num_subgraphs() const;

src/plugins/intel_npu/src/common/src/graph_arguments.cpp renamed to src/plugins/intel_npu/src/common/src/dynamic_graph_arguments.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22
// SPDX-License-Identifier: Apache-2.0
33
//
44

5-
#include "intel_npu/common/graph_arguments.hpp"
6-
75
#include <sstream>
86

9-
#include "openvino/core/except.hpp"
7+
#include "intel_npu/common/dynamic_graph_arguments.hpp"
108

119
namespace intel_npu {
1210

src/plugins/intel_npu/src/common/src/igraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ std::optional<std::string_view> IGraph::get_compatibility_descriptor() const {
2828
OPENVINO_THROW("get_compatibility_descriptor not implemented");
2929
}
3030

31-
npu_vm_runtime_handle_t IGraph::get_vm_runtime_handle() const {
31+
_npu_vm_runtime_handle_t* IGraph::get_vm_runtime_handle() const {
3232
return nullptr;
3333
}
3434

src/plugins/intel_npu/src/compiler_adapter/include/dynamic_graph.hpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88

99
#include <mutex>
1010

11-
#include "intel_npu/common/dynamic_graph_vm_impl.hpp"
12-
#include "intel_npu/common/graph_arguments.hpp"
11+
#include "intel_npu/common/igraph.hpp"
1312
#include "intel_npu/common/network_metadata.hpp"
1413
#include "intel_npu/utils/vm/npu_vm_runtime_api.hpp"
1514
#include "intel_npu/utils/zero/zero_init.hpp"
@@ -18,12 +17,7 @@
1817
namespace intel_npu {
1918
class DynamicGraph final : public IGraph {
2019
public:
21-
using MemRefTypeImpl = DynamicGraphMemRefImpl;
22-
using GraphArgumentsImpl = DynamicGraphArgumentsImpl;
23-
2420
class Impl {
25-
using MemRefTypeImpl = DynamicGraph::MemRefTypeImpl;
26-
2721
public:
2822
virtual void initialize(std::optional<ov::Tensor>& blob, NetworkMetadata& metadata) = 0;
2923
virtual uint64_t getNumSubgraphs() = 0;

0 commit comments

Comments
 (0)