openvino
9f3a15ec - Refactors the get_streams_info_table function and support LP ECORE only case (#35054)

Commit
2 days ago
Refactors the get_streams_info_table function and support LP ECORE only case (#35054) ### Details: This pull request refactors the `get_streams_info_table` function in `cpu_streams_calculation.cpp` to improve code organization, readability, and maintainability. The main logic is encapsulated into a new `StreamsInfoBuilder` struct, with the original function's code split into well-named member methods. This refactoring makes the stream calculation logic easier to follow and extend, without changing the underlying functionality. Key changes include: **Refactoring and Code Organization:** * Introduced a `StreamsInfoBuilder` struct to encapsulate all variables and helper functions previously in the `get_streams_info_table` function, turning lambda functions into member methods for better structure and clarity. * Split large blocks of logic into focused member methods (e.g., `handle_latency_mode`, `handle_throughput_mode`, `add_single_stream`, etc.), replacing inline lambdas and large conditional blocks with descriptive functions. [[1]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL340-L379) [[2]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL389-R407) [[3]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL411-R439) [[4]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL441-R451) [[5]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL461-R474) **Logic Clarification and Encapsulation:** * Encapsulated repeated logic for different performance modes (latency, throughput, tensor parallel, etc.) into dedicated methods, improving readability and reducing code duplication. [[1]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL486-R506) [[2]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL512-R542) [[3]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL540-R557) [[4]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL554-R606) [[5]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL581-L585) [[6]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaR646) [[7]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaR655) [[8]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL631-R671) [[9]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL643-R682) [[10]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL657-R726) **Naming and Readability Improvements:** * Renamed helper functions and variables to be more descriptive (e.g., `update_ids_method` → `set_ids`, `update_mix_stream_info` → `add_mixed_stream`, `create_one_stream` → `add_single_stream`, etc.). [[1]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL340-L379) [[2]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL389-R407) [[3]](diffhunk://#diff-758de41244e1d7ca46b1874eefc94124dc72dd15cebd386d839553ea49c1bceaL411-R439) * Added comments to clarify socket selection priority and the intent of various logic branches. Overall, these changes make the stream calculation logic more modular and maintainable, setting a foundation for future enhancements or bug fixes. ### Tickets: - *CVS-182849* --------- Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Author
Parents
Loading