-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[CPU] Refactor Infer update strategy #25404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CPU] Refactor Infer update strategy #25404
Conversation
by using a template function with a functor template argument to reduce Infer overhead
a5ce151 to
631d956
Compare
|
@maxnick Could you please take a look |
| 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)); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
by using a template function with a functor template argument to reduce Infer overhead ### Tickets: - *ticket-id*
by using a template function with a functor template argument
to reduce Infer overhead
Tickets: