Skip to content

Conversation

@EgorDuplensky
Copy link
Contributor

by using a template function with a functor template argument
to reduce Infer overhead

Tickets:

  • ticket-id

@EgorDuplensky EgorDuplensky requested review from a team as code owners July 5, 2024 13:31
@github-actions github-actions bot added the category: CPU OpenVINO CPU plugin label Jul 5, 2024
by using a template function with a functor template argument
to reduce Infer overhead
@EgorDuplensky
Copy link
Contributor Author

@maxnick Could you please take a look

Comment on lines +1449 to +1462
DEBUG_LOG("Infer graph: ", GetName(), ". Status: ", static_cast<int>(status));

switch (status) {
case Status::ReadyDynamic:
InferDynamic(request, UpdateNodes(m_executableGraphNodes));
break;
case Status::ReadyDynamicSeq:
InferDynamic(request, UpdateNodesSeq(m_executableGraphNodes));
break;
case Status::ReadyStatic:
InferStatic(request);
} else {
OPENVINO_THROW("Unknown ov::intel_cpu::Graph state: " , static_cast<size_t>(status));
break;
default:
OPENVINO_ASSERT(IsReady(), "Wrong state of the ov::intel_cpu::Graph. Topology is not ready: ", static_cast<int>(status));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can even drop this branch simply assigning a corresponding function pointer at the compilation stage, it will allow us keep the status enumeration simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is the option I have also considered
As well as using an interface with multiple implementations.
But I think switch case is even more clean, explicit, lightweight and straightforward here and do not require strict alignment of infer strategies semantics.
If the list of the infer strategies grows big, we can try to replace it with a function pointer.

@dmitry-gorokhov dmitry-gorokhov added this to the 2024.4 milestone Jul 11, 2024
@maxnick maxnick added this pull request to the merge queue Jul 12, 2024
Merged via the queue into openvinotoolkit:master with commit a317947 Jul 12, 2024
@maxnick maxnick deleted the infer_update_strategy branch July 12, 2024 09:33
spran180 pushed a commit to spran180/openvino that referenced this pull request Jul 27, 2024
by using a template function with a functor template argument
to reduce Infer overhead

### Tickets:
 - *ticket-id*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: CPU OpenVINO CPU plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants