Skip to content
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

NPUW: Bring back unpack and partitioning unit tests for NPUW #26885

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ namespace ov {
namespace npuw {
namespace online {

class Group; // forward declaration

namespace detail {
// At partitioning level we exclude some "non-Ops" to not interfere with the passes.
// We include some of them back to properly link everything at plugin level
Expand All @@ -33,6 +31,8 @@ class Snapshot : public std::enable_shared_from_this<Snapshot> {
m_node_to_prod_cons(std::make_shared<detail::OVNodeMap>()),
m_node_to_gr(std::make_shared<detail::OVNodeToGroupMap>()) {}

friend class Group; // forward declaration

// Simple passes
void singleGroup();

Expand All @@ -49,27 +49,27 @@ class Snapshot : public std::enable_shared_from_this<Snapshot> {
void repeatedBlocks();
void earlyAvoids();
void earlyRegroup();
void markInternalCompute();
void resetExcludedRep();

// Utility
std::shared_ptr<own::ade::Graph> getGraph() const;
size_t graphSize() const;
const detail::OVNodeSet& getNodeProducers(const detail::OVNodePtr& node) const;
const detail::OVNodeSet& getNodeConsumers(const detail::OVNodePtr& node) const;
const detail::OVPortsMap& getPortsMap() const;
const detail::OVNodeToGroupMapPtr& getNodeToGroupMap() const;
const std::map<std::string, std::vector<std::set<std::string>>>& getMatches() const;
detail::GPtrSet getRepGroups(const std::shared_ptr<Group>& group) const;
void repeat(detail::Pass&& pass);
void setCtx(const PassContext& ctx);
size_t graphSize() const;

private:
detail::GPtrSet getRepGroups(const std::shared_ptr<Group>& group) const;
const detail::OVNodeSet& getNodeProducers(const detail::OVNodePtr& node) const;
const detail::OVNodeSet& getNodeConsumers(const detail::OVNodePtr& node) const;
void identifyUniques();
void mergeUniques();
void mergeTriangles();
void cleanUpUniques();
void afterUniques();
void markInternalCompute();
void resetExcludedRep();
bool cleanUpUniquesImpl(const detail::GPtrSet& gset);
std::shared_ptr<Repeated> tryGrowRepeatingGroups(const detail::GPtrSet& repeating_groups);
std::shared_ptr<Repeated> tryMergeTriangles(const detail::GPtrSet& repeating_groups);
Expand Down
1 change: 1 addition & 0 deletions src/plugins/intel_npu/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ if (MSVC)
ov_add_compiler_flags(/wd5105)
endif()
add_subdirectory(functional)
add_subdirectory(unit)
46 changes: 46 additions & 0 deletions src/plugins/intel_npu/tests/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#

set(TARGET_NAME "ov_npu_unit_tests")

set(MANDATORY_UNIT_TESTS_LIBS
"openvino::commonTestUtils"
"openvino::gmock"
"openvino::gtest"
"openvino::gtest_main"
"openvino::runtime"
"openvino::npu_al"
"openvino::npu_logger_utils"
)

ov_add_test_target(
NAME ${TARGET_NAME}
ROOT ${CMAKE_CURRENT_SOURCE_DIR}
ADDITIONAL_SOURCE_DIRS
${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/npuw/
DEPENDENCIES
openvino::runtime
INCLUDES
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/npuw
${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/npuw
${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/utils/include
${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/plugin/include
${OpenVINO_SOURCE_DIR}/src/plugins/intel_npu/src/al/include
LINK_LIBRARIES
${MANDATORY_UNIT_TESTS_LIBS}
LABELS
NPUW
)

if(ENABLE_AVX2)
ov_avx2_optimization_flags(avx2_flags)
target_compile_options(${TARGET_NAME} PRIVATE "${avx2_flags}")
endif()

install(TARGETS ${TARGET_NAME}
RUNTIME DESTINATION tests
COMPONENT tests
EXCLUDE_FROM_ALL
)
Loading
Loading