Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
283 commits
Select commit Hold shift + click to select a range
067bcbd
Table of offsets API in the BlobReader
razvanapetroaie Jan 21, 2026
3385082
Moving the CRE near the end of the blob
razvanapetroaie Jan 21, 2026
216e97a
Cleaned up the CRE & OffsetsTable APIs
razvanapetroaie Jan 21, 2026
943bb90
BlobReader: added bound checking for all operations
razvanapetroaie Jan 21, 2026
43d3bc7
Implemented BlobReader::ger_npu_region_size properly
razvanapetroaie Jan 21, 2026
3d64946
Bound checking while evaluating the CRE
razvanapetroaie Jan 21, 2026
398d373
Merge remote-tracking branch 'upstream/master' into CVS-178780-update…
razvanapetroaie Jan 28, 2026
0edbbcc
solved conflicts
razvanapetroaie Jan 28, 2026
6f26728
Adding capability classes that allow to check for features support in…
razvanapetroaie Jan 29, 2026
1706221
Removed the section headers, added the section length to the offsets …
razvanapetroaie Jan 29, 2026
8717b71
moved the location of the offsets table size
razvanapetroaie Feb 10, 2026
1367d90
bug fixing. WS tests passing again
razvanapetroaie Feb 10, 2026
047771c
Refactored the SectionID: it is now a split between section type ID &…
razvanapetroaie Feb 12, 2026
93e961c
correcting the StaticCapability class
razvanapetroaie Feb 17, 2026
9a3642d
TODOs updated
razvanapetroaie Feb 19, 2026
f01b6ca
Code docs for BlobWriter
razvanapetroaie Feb 19, 2026
9e5fdab
Code docs for BlobReader & others
razvanapetroaie Feb 19, 2026
0d72d2f
More docs
razvanapetroaie Feb 19, 2026
2df338e
CRE check_compatibility unit tests
alexandruenache1111 Mar 17, 2026
e434bad
CRE invalid expr + append unit tests
alexandruenache1111 Mar 17, 2026
0456943
CRE unit tests cleanup
alexandruenache1111 Mar 18, 2026
357f7c9
Add NOT tests
alexandruenache1111 Mar 18, 2026
d5d278e
Add NOT operator support in CRE
alexandruenache1111 Mar 18, 2026
2ce455a
Add BatchSize and IOLayouts unit tests - IOLayoutsSectionRead.LessLay…
alexandruenache1111 Mar 19, 2026
6a0586c
Add reader and writer unit tests
alexandruenache1111 Mar 24, 2026
d6eb030
Add missing reader_writer.cpp
alexandruenache1111 Mar 24, 2026
9987f74
Add some fixes and comments:
alexandruenache1111 Mar 24, 2026
59a0462
Add more reader writer unit tests
alexandruenache1111 Mar 24, 2026
91ab925
Add elf schedules 'unit' functional tests
alexandruenache1111 Mar 25, 2026
4ff6c9e
Nitpicks
alexandruenache1111 Mar 25, 2026
b23e559
Move expression vectors from expressions.hp to cre.cpp
alexandruenache1111 Mar 25, 2026
3141800
Add custom mock sections unit tests
alexandruenache1111 Mar 27, 2026
ec2ba75
Refactor blob compatibility tests logic and add CiP PTL test
alexandruenache1111 Apr 1, 2026
1e658e6
Add lazy_check unit tests with mock sections
alexandruenache1111 Apr 2, 2026
3e6d42b
Create mock capabilities and update lazy_check tests
alexandruenache1111 Apr 3, 2026
167601c
Add import-export tests
alexandruenache1111 Apr 14, 2026
57c5631
Add get_roi_tensor tests
alexandruenache1111 Apr 15, 2026
99d6dad
comments
razvanapetroaie May 12, 2026
55d6c30
correcting the use of offsets table. The table is now local to the Bl…
razvanapetroaie May 12, 2026
c732e32
refactored the CRE evaluation function
razvanapetroaie May 13, 2026
5e2135c
small CRE tweaks
razvanapetroaie May 14, 2026
06d6a62
a few more CRE tests
razvanapetroaie May 14, 2026
110dd63
small tweaks
razvanapetroaie May 15, 2026
2246184
Merge pull request #3 from alexandruenache1111/blob_format
razvanapetroaie May 15, 2026
e25d9dc
Merge remote-tracking branch 'upstream/master' into CVS-178780-update…
razvanapetroaie May 19, 2026
f44eeec
solving merge conflicts, but features have been left behind
razvanapetroaie May 19, 2026
b357013
refactored the BlobWriter section API
razvanapetroaie May 21, 2026
ac95785
adjusting the rest of the classes to use the new writer interface
razvanapetroaie May 21, 2026
ae7e2fc
refactored the BlobReader by adding a new interface class
razvanapetroaie May 22, 2026
10d4f0a
adjusted the rest of the code to the BlobReaderInterface addition. Co…
razvanapetroaie May 25, 2026
54afe57
bug in BlobWriter::write
razvanapetroaie May 25, 2026
f55fa28
minor bug fix
razvanapetroaie May 25, 2026
4ea3664
removed redundant padding value from the ELF sections
razvanapetroaie May 25, 2026
689bc88
iolayouts section - moved from ctor to compilation path to avoid dupl…
razvanapetroaie May 25, 2026
ec7766a
made the combined write & read idempotent, the test is now passing
razvanapetroaie May 25, 2026
4ce14db
removed the possibility to register sections and CRE tokens through t…
razvanapetroaie May 26, 2026
1da96fb
expose the plugin capabilities through the reader interface
razvanapetroaie May 26, 2026
fade4a8
additional check: all entries within the table of offsets have been e…
razvanapetroaie May 26, 2026
bc70512
the CRE is now being built right before writing the CRE section
razvanapetroaie May 28, 2026
6ead4c5
adding ITT traces
razvanapetroaie Jun 2, 2026
42f2523
added more assertion messages
razvanapetroaie Jun 2, 2026
68bef14
Adding log messages
razvanapetroaie Jun 2, 2026
ccaccec
making the CRE section optional within the blob reader
razvanapetroaie Jun 3, 2026
10552c7
handling the logger verbosity level properly
razvanapetroaie Jun 3, 2026
c566c61
fixing the CRE tests
razvanapetroaie Jun 4, 2026
698df15
Converting the CRE operators from n-ary prefix to binary infix
razvanapetroaie Jun 4, 2026
ca8e698
adding more CRE tests
razvanapetroaie Jun 4, 2026
5dfd048
The CRE is now able to detect and avoid duplicates at depth level 0
razvanapetroaie Jun 4, 2026
71efd39
added proper to string and from string methods for SectionID
razvanapetroaie Jun 4, 2026
b97be9f
Optimization: useless operands are not evaluated within the CRE
razvanapetroaie Jun 4, 2026
bc735f2
adding tests for the operand evaluation optimization
razvanapetroaie Jun 4, 2026
8f7dcef
split the CRE and CRESection into different files
razvanapetroaie Jun 5, 2026
41f3ada
Adding methods in ISection for evaluating the type instance support
razvanapetroaie Jun 5, 2026
9fdc2dc
Renamed capabilities to sectiontypeevaluators to better reflect the u…
razvanapetroaie Jun 5, 2026
d6bf9ea
each section now provides a subexpression to the CRE
razvanapetroaie Jun 5, 2026
1c603e0
adding the new files that have been omitted
razvanapetroaie Jun 9, 2026
171d4c1
some more renamings to go in line with the latest changes
razvanapetroaie Jun 9, 2026
3ff8bca
fixing some tests
razvanapetroaie Jun 9, 2026
bde63b3
working on CRE evaluation of section type instances
razvanapetroaie Jun 9, 2026
82c0c70
Implemented the section type instance evaluator and integrated it int…
razvanapetroaie Jun 9, 2026
b7a02b7
clearing some TODOs
razvanapetroaie Jun 9, 2026
eea9057
one more layout test
razvanapetroaie Jun 9, 2026
b6694ed
added representative sections within the blob reader for each type
razvanapetroaie Jun 9, 2026
86ae0eb
Tracking within the BlobReader which sections are mandatory or not an…
razvanapetroaie Jun 10, 2026
14fa150
Removing the from the blobwriter
razvanapetroaie Jun 29, 2026
0e5f3f0
some renamings
razvanapetroaie Jun 29, 2026
1ae9b70
removed the CRE token from the CRE, it was redundant
razvanapetroaie Jun 29, 2026
34b0ad5
made the evaluation function of the type evaluator private
razvanapetroaie Jun 29, 2026
c29f882
removed the type evaluators from the reader interface
razvanapetroaie Jun 29, 2026
55d3627
just some renamings
razvanapetroaie Jun 30, 2026
ecc1dd7
compiler schedules: using a union for their state
razvanapetroaie Jun 30, 2026
451f8c2
adding more guards
razvanapetroaie Jun 30, 2026
821522c
Merge remote-tracking branch 'upstream/master' into CVS-178780-update…
razvanapetroaie Jul 2, 2026
63668ef
Merge remote-tracking branch 'upstream/master' into CVS-178780-update…
razvanapetroaie Aug 24, 2026
8765a4a
solved conflicts
razvanapetroaie Aug 24, 2026
7996642
filled the importer factory
razvanapetroaie Aug 24, 2026
3709939
sketching the importer v2 changes
razvanapetroaie Aug 24, 2026
1f03339
used blobsource within the blobreader
razvanapetroaie Aug 25, 2026
b42ffbe
ELF schedules handling padding properly
razvanapetroaie Aug 25, 2026
fb311ed
blobreader: more assertions
razvanapetroaie Aug 25, 2026
3dcab4b
multiple fixes within the compiler schedules sections
razvanapetroaie Aug 25, 2026
9f49f55
new section that stores the encryption flag
razvanapetroaie Aug 25, 2026
afb6384
working on encrypting the blob
razvanapetroaie Aug 25, 2026
12e77fa
encryption probably done; decryption still left
razvanapetroaie Aug 25, 2026
1881124
probably done exporting the raw blob too
razvanapetroaie Aug 25, 2026
b9ca77e
throw if requested to export a raw blob but the compiled model has mu…
razvanapetroaie Aug 26, 2026
5b65558
encryption amends
razvanapetroaie Aug 26, 2026
dc553c7
probably done decryption as well
razvanapetroaie Aug 26, 2026
4a5a3f9
implemented a basic DynamicScheduleSection as a ELFMainSchedule wrapper
razvanapetroaie Aug 26, 2026
0bb6471
added the config to the blob reader and used it to support encryption…
razvanapetroaie Aug 26, 2026
82153b2
implemented extract_blob_type
razvanapetroaie Aug 26, 2026
cd86cb0
more blobreader utilities
razvanapetroaie Aug 26, 2026
a3f75ba
used the new blobreader utilities to check the content of the blob
razvanapetroaie Aug 26, 2026
414ac10
working on create_blob_writer
razvanapetroaie Aug 27, 2026
984543a
new section: compiler version
razvanapetroaie Aug 27, 2026
8878814
wired the compiler version, new format
razvanapetroaie Aug 27, 2026
4f0e700
almost done creating the blob writer
razvanapetroaie Aug 27, 2026
276319d
renaming to runtime reqs sections
razvanapetroaie Aug 27, 2026
7b762c4
working on RuntimeRequirementsSection
razvanapetroaie Aug 27, 2026
cf3339d
offsets table -> manifest
razvanapetroaie Aug 27, 2026
11c771d
working on removeing type instance ID
razvanapetroaie Aug 27, 2026
29ac48f
modified the string-section ntype/id converters
razvanapetroaie Aug 31, 2026
10618d7
adjusted the blobreader to use the new section ID convention
razvanapetroaie Aug 31, 2026
62b637a
adjusted the blobwriter to use the new section ID conventionush
razvanapetroaie Aug 31, 2026
699830a
manifest fixes
razvanapetroaie Aug 31, 2026
6ecee4e
implemented ISectionInstanceEvaluator
razvanapetroaie Aug 31, 2026
0f7d4b7
updated the sectionInstanceEvaluator
razvanapetroaie Aug 31, 2026
86d67cd
working on runtime requirements
razvanapetroaie Aug 31, 2026
8cac58e
working on RuntimeRequirements and evaluators
razvanapetroaie Sep 1, 2026
b411027
wired the runtime requirements, blobwriter and blobreader
razvanapetroaie Sep 1, 2026
2076e6e
adding a class for the blob format version
razvanapetroaie Sep 1, 2026
abc2ec5
added runtime requirements version
razvanapetroaie Sep 2, 2026
f6d38e9
RuntimeRequirementsSection::read
razvanapetroaie Sep 2, 2026
acec29c
filled RuntimeRequirementsSection::write
razvanapetroaie Sep 2, 2026
9610d8d
first version of cre_to_string
razvanapetroaie Sep 2, 2026
cfc5302
implemented cre_from_string
razvanapetroaie Sep 2, 2026
bf181d9
filled get_inidividual_compatibility_requirements for compiler schedules
razvanapetroaie Sep 2, 2026
3051df7
implemented the compiler scheduel instance evaluator and wired it to …
razvanapetroaie Sep 2, 2026
a6531d7
working on validating the compatibility descriptor
razvanapetroaie Sep 3, 2026
95b4208
starting a minor CRE refactoring, to include ov::CompatibilityCheck::…
razvanapetroaie Sep 3, 2026
1143a70
adjusted the CRE to support ov::CompatibilityCheck as operands
razvanapetroaie Sep 7, 2026
1ef4dec
probably done the runtime requirements check
razvanapetroaie Sep 7, 2026
784e8b6
removed section type from the type evaluators
razvanapetroaie Sep 7, 2026
1057e7f
PredefinedSectionType->KnownSectionType
razvanapetroaie Sep 7, 2026
be1e6ba
made sectiontype and sectionid individual classes
razvanapetroaie Sep 7, 2026
ce8e0b4
working on refactoring the CRE using the new classes
razvanapetroaie Sep 7, 2026
3aeef3c
updated the CRE
razvanapetroaie Sep 8, 2026
973ca19
minor fixes
razvanapetroaie Sep 9, 2026
90ba3bc
got rid of the hardcoded section ids
razvanapetroaie Sep 9, 2026
10b85c4
cleared some todos
razvanapetroaie Sep 9, 2026
16d4da1
moved blob source
razvanapetroaie Sep 9, 2026
8381e37
fixed some compilation errors
razvanapetroaie Sep 9, 2026
d74fc40
implemented the runtime requirements compiled model query
razvanapetroaie Sep 9, 2026
bcfefbe
the dev code is compiling again
razvanapetroaie Sep 9, 2026
6c9543b
bug fixing
razvanapetroaie Sep 11, 2026
25b9b35
more bug fixes
razvanapetroaie Sep 11, 2026
845e3f1
minor log fix
razvanapetroaie Sep 14, 2026
c0feac0
bug fixes and missing code. we are now able to run a basic model
razvanapetroaie Sep 14, 2026
902ae59
moved the string converters around
razvanapetroaie Sep 14, 2026
a44fe01
cleared some TODOs
razvanapetroaie Sep 14, 2026
22222c7
cleared some more todos and created runtime_requirements_validation
razvanapetroaie Sep 14, 2026
95e61e6
allocate_aligned_tensor as utility
razvanapetroaie Sep 15, 2026
5f88bd5
cleared more todos
razvanapetroaie Sep 15, 2026
36780d8
minor tweaks
razvanapetroaie Sep 16, 2026
ff106c7
comments and minor Graph::write_blob_to_stream refactoring
razvanapetroaie Sep 16, 2026
bac47db
comments
razvanapetroaie Sep 16, 2026
8767d3d
comments
razvanapetroaie Sep 16, 2026
928e523
added a missing dynamic schedule registration
razvanapetroaie Sep 16, 2026
d971fd0
compatibility string validation minor fix
razvanapetroaie Sep 16, 2026
26f703c
singleton supported section type
razvanapetroaie Sep 16, 2026
2706c90
CompilerScheduleInstanceEvaluator singleton
razvanapetroaie Sep 16, 2026
e4e2232
comments
razvanapetroaie Sep 17, 2026
ba940c7
comments
razvanapetroaie Sep 17, 2026
23b4f60
security fixes, code quality, misc
razvanapetroaie Sep 17, 2026
80257d0
assert
razvanapetroaie Sep 17, 2026
b905296
misc
razvanapetroaie Sep 23, 2026
b13295b
minor encryption refactor
razvanapetroaie Sep 23, 2026
e5737be
security fixes, code quality, misc
razvanapetroaie Sep 23, 2026
f1cadf7
commented some tests to make them compile
razvanapetroaie Sep 24, 2026
3e1d1e9
parse_dotted_version assert
razvanapetroaie Sep 24, 2026
d084013
done the batch size section tests
razvanapetroaie Sep 24, 2026
af0f805
encryption flag tests
razvanapetroaie Sep 24, 2026
f073876
compiler version section tests
razvanapetroaie Sep 24, 2026
228453a
working on layouts tests
razvanapetroaie Sep 24, 2026
31ac0a2
done iolayouts tests
razvanapetroaie Sep 29, 2026
b2a7997
done the section type tests
razvanapetroaie Sep 29, 2026
a172e3e
done the section id tests
razvanapetroaie Sep 29, 2026
3845305
done the CRE special token tests
razvanapetroaie Sep 29, 2026
f8afd39
done the section type/ID string conversion tests
razvanapetroaie Sep 30, 2026
d882aaa
supported_section_type_evaluator test
razvanapetroaie Sep 30, 2026
02bb63c
single_section_instance_evaluator tests
razvanapetroaie Sep 30, 2026
26181f0
eld main schedule section tests
razvanapetroaie Oct 1, 2026
bfc950b
elfmainschedulesection::read tests
razvanapetroaie Oct 1, 2026
b1cba06
done the dynamic schedule section tests
razvanapetroaie Oct 1, 2026
84b9752
done the elfinitschedules tests
razvanapetroaie Oct 2, 2026
00094c0
done the unit tests for all schedule types
razvanapetroaie Oct 2, 2026
5d580e8
init schedules tests amends
razvanapetroaie Oct 6, 2026
89a1e90
starting the CRE tests
razvanapetroaie Oct 6, 2026
38e0757
almost restored the CRE evaluation tests
razvanapetroaie Oct 6, 2026
875e342
to_string virtual method
razvanapetroaie Oct 6, 2026
862c16b
working on debuggin CRE tests
razvanapetroaie Oct 6, 2026
035dd0d
more CRE tests
razvanapetroaie Oct 7, 2026
559a660
even more CRE tests
razvanapetroaie Oct 8, 2026
d8ce304
more CRE::from_string tests
razvanapetroaie Oct 8, 2026
346f4b0
more CRE evaluation tests
razvanapetroaie Oct 8, 2026
dac7b18
more CRE evaluation tests
razvanapetroaie Oct 8, 2026
10c2147
more CRE evaluation tests
razvanapetroaie Oct 9, 2026
8dd5a39
probably done writing new CRE tests
razvanapetroaie Oct 9, 2026
52270a9
fixed some CRE tests
razvanapetroaie Oct 9, 2026
0be671f
fixed some CRE tests
razvanapetroaie Oct 9, 2026
e734cb5
fixed all remaining CRE tests
razvanapetroaie Oct 9, 2026
36242ab
Merge remote-tracking branch 'upstream/master' into CVS-178780-update…
razvanapetroaie Oct 19, 2026
035f6c7
removed the LLVM blob type
razvanapetroaie Oct 21, 2026
0247ba5
Merge remote-tracking branch 'upstream/master' into CVS-178780-update…
razvanapetroaie Oct 21, 2026
aace9c8
ctor params reorder
razvanapetroaie Oct 21, 2026
b87a146
section writers -> encoders
razvanapetroaie Oct 21, 2026
ef499f1
implemented the decoders
razvanapetroaie Oct 21, 2026
0e02bca
created the BlobSectionsRegistry
razvanapetroaie Oct 22, 2026
5c96bea
replaced the blob writer occurrences with blobSectionsRegistry
razvanapetroaie Oct 22, 2026
16766fe
implemented the NPU HSM writer; added alignmen and inline flag to ISe…
razvanapetroaie Oct 22, 2026
4b2206c
decoders return nullopt instead of throwing
razvanapetroaie Oct 22, 2026
747e9cb
working on the reader
razvanapetroaie Oct 22, 2026
c73f52d
removed the manifest section type
razvanapetroaie Oct 23, 2026
b70ea41
changes the section type type to uint32_t
razvanapetroaie Oct 23, 2026
362c6cc
reader and writer tweaks
razvanapetroaie Oct 23, 2026
9416e41
tag == section type asserts while decoding
razvanapetroaie Oct 23, 2026
f9a5979
working on the reader
razvanapetroaie Oct 23, 2026
843452f
probably done the reader
razvanapetroaie Oct 23, 2026
4f0a013
updated validateCompatibilityDescriptorFormatV2
razvanapetroaie Oct 25, 2026
2be6cfb
passing references instead of ptrs for the sections registry
razvanapetroaie Oct 25, 2026
8d9f3de
converter the reader and writer to functions
razvanapetroaie Oct 25, 2026
ed142fb
obsolete includes
razvanapetroaie Oct 25, 2026
0924bf6
cleared some TODOs
razvanapetroaie Oct 25, 2026
2cbfe45
deleted the blob reader/writer since they are not needed anymore
razvanapetroaie Oct 25, 2026
49bb863
a bit of refactoring
razvanapetroaie Oct 26, 2026
7503ea7
write -> encode in unit tests
razvanapetroaie Oct 26, 2026
fe63df3
updated several unit tests
razvanapetroaie Oct 26, 2026
2ef6e6d
more tests and inline checks
razvanapetroaie Oct 26, 2026
b413bf4
fixed some io layouts tests
razvanapetroaie Oct 26, 2026
762af0c
updated the remaining unit tests
razvanapetroaie Oct 26, 2026
336d92f
Merge remote-tracking branch 'upstream/master' into CVS-191970-integr…
razvanapetroaie Oct 26, 2026
fff3457
solved all compilation errors
razvanapetroaie Oct 26, 2026
4ae8850
fixed the init schedules tests
razvanapetroaie Oct 27, 2026
e8467dc
fixed the main schedule tests
razvanapetroaie Oct 27, 2026
bf9208e
fixed the dynamic schedule tests
razvanapetroaie Oct 27, 2026
31f706a
fixed more tests; all unit tests passing
razvanapetroaie Oct 27, 2026
2f654a3
implemeted tests for MajorMinorVersion
razvanapetroaie Oct 27, 2026
9c55399
restored the blob format importers tests
razvanapetroaie Oct 27, 2026
c271ca7
one more importer test
razvanapetroaie Oct 27, 2026
87640a1
removed some outdated tests
razvanapetroaie Oct 27, 2026
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
19 changes: 2 additions & 17 deletions src/plugins/intel_npu/src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,8 @@

set(TARGET_NAME "openvino_npu_common")

set(SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/include/intel_npu/common/compiler_adapter_factory.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/intel_npu/common/option_support_cache.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/intel_npu/common/device_helpers.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/intel_npu/common/icompiled_model.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/intel_npu/common/icompiler_adapter.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/intel_npu/common/igraph.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/intel_npu/common/iparser.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/intel_npu/common/itt.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/intel_npu/common/network_metadata.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/intel_npu/common/npu.hpp
${CMAKE_CURRENT_SOURCE_DIR}/include/intel_npu/common/parser_factory.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/device_helpers.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/igraph.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/network_metadata.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/npu.cpp
)
file(GLOB SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/include/intel_npu/common/*.hpp
${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SOURCES})

add_library(${TARGET_NAME} STATIC ${SOURCES})
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// Copyright (C) 2018-2026 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#pragma once

#include <cinttypes>
#include <memory>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#include "intel_npu/common/isection.hpp"
#include "intel_npu/common/runtime_requirements.hpp"
#include "intel_npu/utils/logger/logger.hpp"

namespace intel_npu {

class BlobSectionsRegistry final {
public:
BlobSectionsRegistry();

/**
* @brief Add a new blob section to the writing queue.
*
* @param section The section to be added in the writing queue.
* @param id TODO
* @return The instance ID of the section. This number corresponds to the order within the writing queue and it is
* used to distringuish between sections of the same type. This number is unique only among sections of the same
* type.
*/
SectionID register_section(const std::shared_ptr<ISection>& section,
const std::optional<SectionID>& parsed_id = std::nullopt);

/**
* @brief Retrieve a parsed section.
* @note This should be called only after "read" was invoked.
* @return The requested section if found, else "nullptr"
*/
std::shared_ptr<ISection> retrieve_section(const SectionID& id) const;

/**
* @brief Retrieve the first parsed section of the given type.
* @note This should be called only after "read" was invoked.
* @note This function exists only for convenience. Most section types will typically have a single instance inside
* a compiled model.
* @return The first parsed section of the given type if any, else "nullptr"
*/
std::shared_ptr<ISection> retrieve_any_section(const SectionType section_type) const;

/**
* @brief Retrieves all parsed sections of the given type.
* @note This should be called only after "read" was invoked.
* @return All parsed sections of the given type if any, else "std::nullopt"
*/
std::vector<std::shared_ptr<ISection>> retrieve_sections(const SectionType type) const;

std::queue<std::shared_ptr<ISection>> get_write_queue() const;

/**
* @return true if at least one section of the given type has been parsed
* @return false otherwise
*/
bool has_section_of_type(const SectionType section_type) const;

/**
* @return The number of parsed sections of the given type
*/
size_t count_sections_of_type(const SectionType section_type) const;

/**
* @return A summary of the blob content, represented as a map between section types and their number of occurrences
* in the blob
*/
std::unordered_map<SectionType, size_t> get_content_summary() const;

// TODO update
/**
* @brief Builds the runtime requirements (CRE + individual "compatibility substrings") based on the sections
* registered so far.
* @note The requirements are built on demand and not stored in order to make sure the requirements are aligned with
* the content of the blob.
*/
std::shared_ptr<ISection> build_runtime_requirements_section() const;

private:
/**
* @brief Tracks the next available instance ID for each section type. This should assure that the generated section
* IDs (type + instance) are unique per compiled model.
*/
uint16_t m_next_section_id;
/**
* @brief Queue that holds all sections to be written at export time.
*/
std::queue<std::shared_ptr<ISection>> m_write_queue;
std::unordered_map<SectionID, std::shared_ptr<ISection>> m_ids_to_sections;
std::unordered_map<SectionType, std::vector<std::shared_ptr<ISection>>> m_types_to_sections;

Logger m_logger;
};

} // namespace intel_npu
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ class BlobSource {
*/
bool is_contiguous() const;

std::variant<std::reference_wrapper<std::istream>, std::pair<std::reference_wrapper<const ov::Tensor>, size_t>>
get_source() const;

private:
/**
* @brief A union that captures all possible data types of the blob. The tensor type also has a separate data cursor
Expand Down
198 changes: 198 additions & 0 deletions src/plugins/intel_npu/src/common/include/intel_npu/common/cre.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
// Copyright (C) 2018-2026 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#pragma once

#include <unordered_set>

#include "intel_npu/common/cre_token.hpp"
#include "intel_npu/common/isection.hpp"
#include "intel_npu/common/isection_type_evaluator.hpp"
#include "intel_npu/common/section_id.hpp"
#include "intel_npu/common/section_type.hpp"
#include "intel_npu/common/single_section_instance_evaluator.hpp"
#include "intel_npu/utils/logger/logger.hpp"
#include "openvino/core/except.hpp"

namespace intel_npu {

/**
* @brief Exception used to indicate an invalid expression. Logic errors or other type of failures should not be
* represented by this.
*/
class InvalidCRE final : public ov::AssertFailure {
public:
[[noreturn]] static void create(const char* file,
int line,
const char* check_string,
const std::string& context_info,
const std::string& explanation);

protected:
explicit InvalidCRE(const std::string& what_arg) : ov::AssertFailure(what_arg) {}
};

enum class CRESpecialTokenCode { AND, OR, NOT, OPEN, CLOSE };

/**
* @brief All tokens that are not operands. This set is made by operators and parrenthesis.
*/
class CRESpecialToken final : public CREToken {
public:
CRESpecialToken(const CRESpecialTokenCode code);

CRESpecialTokenCode get_code() const;

bool operator==(const CRESpecialToken& other) const;

bool operator!=(const CRESpecialToken& other) const;

/**
* @warning Do not modify the string values. These values are stored as part of the CRE within the blob's runtime
* requirements. Changing these may break compatibility.
*/
std::string to_string() const override;

private:
CRESpecialTokenCode m_code;
};

bool is_cre_special_token(const std::shared_ptr<CREToken>& candidate);

/**
* @brief Handles the construction, validation, evaluation and serialization of the Compatibility Requirements
* Expression.
* @details The CRE is used to evaluate the high-level compatibility requirements *between* sections types and/or
* instances using a logical expression. This evaluation happens during model import or when a compatibility descriptor
* is validated using the "Plugin::get_property" API call.
*/
class CRE final {
public:
CRE(const ov::log::Level log_level = ov::log::Level::WARNING);

CRE(const std::vector<std::shared_ptr<CREToken>>& subexpression,
const ov::log::Level log_level = ov::log::Level::WARNING);

/**
* @brief Append a new token to the CRE, at depth-level 1. All tokens found at this depth-level are bound by a
* logical "AND" operator.
*/
void append_to_expression(const std::shared_ptr<CREToken> requirement_token);

/**
* @brief Append a new CRE subexpression to the CRE, at depth-level 1. All tokens found at this depth-level are
* bound by a logical "AND" operator.
*/
void append_to_expression(const std::vector<std::shared_ptr<CREToken>>& subexpression);

size_t get_expression_length() const;

std::vector<std::shared_ptr<CREToken>> get_expression() const;

bool empty() const;

/**
* @brief Evaluates the expression using the given evaluators for section types and instances.
* @details The support for both section types and instances is evaluated in a lazy manner: the check support
* function is called only upon encountering the corresponding CRE token.
*
* @param section_type_evaluators A mapping between section types and their (lazy) evaluators.
* @param section_instance_evaluators A mapping between section IDs and their (lazy) evaluators.
*/
ov::CompatibilityCheck check_compatibility(
const std::unordered_map<SectionType, std::shared_ptr<ISectionTypeEvaluator>>& section_type_evaluators,
const std::unordered_map<SectionID, SingleSectionInstanceEvaluator>& section_instance_evaluators) const;

/**
* @brief Serializes the CRE.
* @note This "human-readable" form is meant to be used:
* 1. Inside the runtime requirements section, as part of a compiled model and
* 2. As part of the compatibility descriptor returned to the user via the "Plugin::get_property" API call.
*/
std::string to_string() const;

/**
* @brief Deserializes the CRE string into internal token codes.
*/
static CRE from_string(const std::string_view cre, const ov::log::Level log_level = ov::log::Level::WARNING);

bool operator==(const CRE& other) const;

bool operator!=(const CRE& other) const;

// TODO reconsider these
// Some "globals" for convenience
static inline const auto AND_PTR = std::make_shared<CRESpecialToken>(CRESpecialTokenCode::AND);
static inline const auto OR_PTR = std::make_shared<CRESpecialToken>(CRESpecialTokenCode::OR);
static inline const auto NOT_PTR = std::make_shared<CRESpecialToken>(CRESpecialTokenCode::NOT);
static inline const auto OPEN_PTR = std::make_shared<CRESpecialToken>(CRESpecialTokenCode::OPEN);
static inline const auto CLOSE_PTR = std::make_shared<CRESpecialToken>(CRESpecialTokenCode::CLOSE);

static inline const CRESpecialToken AND = *AND_PTR;
static inline const CRESpecialToken OR = *OR_PTR;
static inline const CRESpecialToken NOT = *NOT_PTR;
static inline const CRESpecialToken OPEN = *OPEN_PTR;
static inline const CRESpecialToken CLOSE = *CLOSE_PTR;

private:
enum class Delimiter { PARRENTHESIS, SIZE };

/**
* @brief Checks if the given expression forms a valid CRE.
* @details The easiest way to verify this is to check if the expression can be evaluated successfully, regardless
* of result. This is what this function does.
*/
bool is_expression_valid(const std::vector<std::shared_ptr<CREToken>>& expression) const;

bool subexpression_already_registered(const std::vector<std::shared_ptr<CREToken>>& subexpression) const;

void advance_iterator(std::vector<std::shared_ptr<CREToken>>::const_iterator& expression_iterator,
const std::vector<std::shared_ptr<CREToken>>::const_iterator& expression_end) const;

bool end_condition(const std::vector<std::shared_ptr<CREToken>>::const_iterator& expression_iterator,
const std::vector<std::shared_ptr<CREToken>>::const_iterator& expression_end,
const Delimiter end_delimiter) const;

/**
* @brief Evaluates a subexpression from left to right.
* @details The evaluation starts from the position where the iterator was left at. The end of the subexpression is
* determined based on the given type of delimiter.
*
* The parent of the current subexpression might have determined that all evaluations within this subexpression have
* no impact on the final result. If that is the case, then "skip_all_evaluations" should be set to true, and
* operand evaluation will be skipped to save some resources (unless "force_all_evaluations" was also set to true).
*
* All operands can take one of two forms: a SectionType alone, or a SectionType followed by a SectionID. The given
* section type evaluators are used as part of the evaluation process of all operands. The instance evaluators are
* the second layer of operand evalution, used only when a SectionID is present and the type evaluation succeeded.
* @param expression_iterator The cursor corresponding to the expression that is being evaluated. The initial value
* indicates the start of the subexpression.
* @param expression_end Points towards the end of the whole expression.
* @param section_type_evaluators Entities used to evaluate whether or not the current software supports the
* corresponding SectionType.
* @param section_instance_evaluators Used to evaluate the operands that contain a SectionID.
* @param end_delimiter The type of delimiter that is used for judging the end of the subexpression.
* @param skip_all_evaluations If set to "true", all operand evaluations wihtin this subexpressions will be skipped
* (unless "force_all_evaluations" was also set to true). However, some validity checks will still be performed.
* @param force_all_evaluations Forces all evaluations to be performed. This flag has a higher priority than
* "skip_all_evaluations". This is meant to be used when validating the whole CRE is desired.
*/
ov::CompatibilityCheck evaluate(
std::vector<std::shared_ptr<CREToken>>::const_iterator& expression_iterator,
const std::vector<std::shared_ptr<CREToken>>::const_iterator& expression_end,
const std::unordered_map<SectionType, std::shared_ptr<ISectionTypeEvaluator>>& section_type_evaluators,
const std::unordered_map<SectionID, SingleSectionInstanceEvaluator>& section_instance_evaluators,
const Delimiter end_delimiter,
const bool skip_all_evaluations = false,
const bool force_all_evaluations = false) const;

/**
* @note Stitched together using "AND"s, these subexpression form the whole expression.
*/
std::vector<std::vector<std::shared_ptr<CREToken>>> m_subexpressions;

Logger m_logger;
};

} // namespace intel_npu
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (C) 2018-2026 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#pragma once

#include <string>

namespace intel_npu {

/**
* @brief Basic unit that composes the compatibility requirements expression
*/
class CREToken {
public:
virtual ~CREToken() = default;

virtual std::string to_string() const = 0;

protected:
CREToken() = default;
};

} // namespace intel_npu
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright (C) 2018-2026 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#pragma once

#include <functional>

#include "intel_npu/common/isection.hpp"

namespace intel_npu {

/**
* @brief Section containing a flag that indicates whether or not the compiler schedules within the compiled models have
* been encrypted.
*/
class EncryptedSchedulesFlagSection final : public ISection {
public:
EncryptedSchedulesFlagSection(const bool applied_encryption);

std::vector<std::shared_ptr<CREToken>> get_compatibility_requirements_subexpression(
const std::unordered_map<SectionID, std::shared_ptr<ISection>>& all_registered_sections) const override;

void encode(const ov::runtime::hsm::SectionSink& sink) const override;

bool get_flag() const;

static ov::runtime::hsm::SectionDecoder<std::shared_ptr<ISection>> decode;

private:
bool m_flag;

Logger m_logger;
};

} // namespace intel_npu
Loading
Loading