-
Notifications
You must be signed in to change notification settings - Fork 3k
[DRAFT][NPUW] A test transformer model generator #34023
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
base: master
Are you sure you want to change the base?
Conversation
8148d41 to
121cad2
Compare
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.
Pull request overview
This PR replaces the legacy ModelGenerator with a new, more capable ModelBuilder for constructing transformer/LLM-like test models used by NPUW unit tests.
Changes:
- Introduced
ModelBuilder(withLLMConfig) for assembling transformer blocks, KV-cache, RoPE, and mask logic. - Updated existing NPUW unit tests to use
ModelBuilderinstead ofModelGenerator. - Added dedicated unit tests validating key
ModelBuilderbehaviors and updated CMake include paths.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/plugins/intel_npu/tests/unit/npuw/set_tensor.cpp | Switches test model construction to ModelBuilder. |
| src/plugins/intel_npu/tests/unit/npuw/serialization.cpp | Switches repeated-block models to ModelBuilder. |
| src/plugins/intel_npu/tests/unit/npuw/online_partitioning.cpp | Switches partitioning tests to ModelBuilder. |
| src/plugins/intel_npu/tests/unit/npuw/model_generator/model_generator.hpp | Removes legacy ModelGenerator interface. |
| src/plugins/intel_npu/tests/unit/npuw/model_generator/model_generator.cpp | Removes legacy ModelGenerator implementation. |
| src/plugins/intel_npu/tests/unit/npuw/model_builder_tests.cpp | Adds unit tests for ModelBuilder LLM graph construction and key transformations. |
| src/plugins/intel_npu/tests/unit/npuw/model_builder/model_builder.hpp | Adds ModelBuilder public API and LLMConfig. |
| src/plugins/intel_npu/tests/unit/npuw/model_builder/model_builder.cpp | Implements ModelBuilder including KV-cache, RoPE, attention mask, and weight-format helpers. |
| src/plugins/intel_npu/tests/unit/CMakeLists.txt | Updates include path to use npuw/model_builder. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/plugins/intel_npu/tests/unit/npuw/model_builder/model_builder.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_npu/tests/unit/npuw/model_builder/model_builder.hpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_npu/tests/unit/npuw/model_builder/model_builder.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_npu/tests/unit/npuw/model_builder/model_builder.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_npu/tests/unit/npuw/model_builder/model_builder.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_npu/tests/unit/npuw/model_builder/model_builder.cpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_npu/tests/unit/npuw/model_builder/model_builder.cpp
Outdated
Show resolved
Hide resolved
…tests Avoid file-scope `using namespace ov::test::npuw` to prevent potential name collisions and improve clarity in stack traces. Only ModelBuilder is needed from that namespace, so use a targeted using-declaration.
The {0,2,1,3} permutation is its own inverse, so both branches of the
ternary produced the same order. Remove the misleading bool parameter
and note the self-inverse property in the doc comment.
Avoid calling get_partial_shape()[3].get_length() which throws on dynamic dimensions. Since head_dim is already known at the call site, pass it as a parameter to make the static-shape requirement explicit.
Details:
Tickets: