File tree Expand file tree Collapse file tree 8 files changed +159
-0
lines changed
src/plugins/intel_npu/src/plugin Expand file tree Collapse file tree 8 files changed +159
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright (C) 2018-2025 Intel Corporation
2+ // SPDX-License-Identifier: Apache-2.0
3+ //
4+
5+ #pragma once
6+
7+ #include < cinttypes>
8+ #include < unordered_map>
9+ #include < unordered_set>
10+ #include < vector>
11+
12+ #include " intel_npu/common/igraph.hpp"
13+ #include " isection.hpp"
14+
15+ namespace intel_npu {
16+
17+ class BlobReader {
18+ public:
19+ BlobReader ();
20+ };
21+
22+ } // namespace intel_npu
Original file line number Diff line number Diff line change 1+ // Copyright (C) 2018-2025 Intel Corporation
2+ // SPDX-License-Identifier: Apache-2.0
3+ //
4+
5+ #pragma once
6+
7+ #include < cinttypes>
8+ #include < unordered_map>
9+ #include < unordered_set>
10+ #include < vector>
11+
12+ #include " cre.hpp"
13+ #include " intel_npu/common/igraph.hpp"
14+ #include " isection.hpp"
15+
16+ namespace intel_npu {
17+
18+ class BlobWriter {
19+ public:
20+ BlobWriter ();
21+
22+ void register_section (const ISection& section);
23+
24+ void register_offset_in_table (const ISection::SectionID id, const uint64_t offset);
25+
26+ void write (std::ostream& stream, const std::shared_ptr<IGraph>& graph);
27+
28+ void append_compatibility_requirement (const CREToken requirement_token);
29+
30+ private:
31+ void register_cre ();
32+
33+ void write_persistent_format_region ();
34+
35+ std::unordered_set<ISection::SectionID> registered_sections_ids;
36+ std::vector<ISection> registered_sections;
37+ std::unordered_map<ISection::SectionID, uint64_t > offsets_table;
38+ CRESection cre;
39+ };
40+
41+ } // namespace intel_npu
Original file line number Diff line number Diff line change 1+ // Copyright (C) 2018-2025 Intel Corporation
2+ // SPDX-License-Identifier: Apache-2.0
3+ //
4+
5+ #pragma once
6+
7+ #include " isection.hpp"
8+
9+ namespace intel_npu {
10+
11+ using CREToken = uint16_t ;
12+
13+ class CRESection final : public ISection {
14+ public:
15+ static constexpr SectionID id = 100 ;
16+
17+ CRESection ();
18+
19+ void write (std::ostream& stream, BlobWriter* writer) override ;
20+
21+ // void read(BlobReader* reader) override;
22+
23+ void append_to_expression (const CREToken requirement_token);
24+
25+ private:
26+ std::vector<CREToken> expression;
27+ };
28+
29+ } // namespace intel_npu
Original file line number Diff line number Diff line change 1+ // Copyright (C) 2018-2025 Intel Corporation
2+ // SPDX-License-Identifier: Apache-2.0
3+ //
4+
5+ #pragma once
6+
7+ #include < cinttypes>
8+ #include < unordered_map>
9+ #include < unordered_set>
10+ #include < vector>
11+
12+ #include " blob_reader.hpp"
13+ #include " blob_writer.hpp"
14+
15+ namespace intel_npu {
16+
17+ class ISection {
18+ public:
19+ using SectionID = uint16_t ;
20+
21+ ISection (const SectionID section_id);
22+
23+ virtual void write (std::ostream& stream, BlobWriter* writer) = 0;
24+
25+ // virtual void read(BlobReader* reader) = 0;
26+
27+ SectionID get_section_id ();
28+
29+ private:
30+ SectionID section_id;
31+ };
32+
33+ } // namespace intel_npu
Original file line number Diff line number Diff line change 1+ // Copyright (C) 2018-2025 Intel Corporation
2+ // SPDX-License-Identifier: Apache-2.0
3+ //
4+
5+ #include " blob_reader.hpp"
6+
7+ namespace intel_npu {} // namespace intel_npu
Original file line number Diff line number Diff line change 1+ // Copyright (C) 2018-2025 Intel Corporation
2+ // SPDX-License-Identifier: Apache-2.0
3+ //
4+
5+ #include " blob_writer.hpp"
6+
7+ namespace intel_npu {
8+
9+ BlobWriter::BlobWriter () {
10+ register_cre ();
11+ }
12+
13+ } // namespace intel_npu
Original file line number Diff line number Diff line change 1+ // Copyright (C) 2018-2025 Intel Corporation
2+ // SPDX-License-Identifier: Apache-2.0
3+ //
4+
5+ #include " cre.hpp"
6+
7+ namespace intel_npu {} // namespace intel_npu
Original file line number Diff line number Diff line change 1+ // Copyright (C) 2018-2025 Intel Corporation
2+ // SPDX-License-Identifier: Apache-2.0
3+ //
4+
5+ #include " isection.hpp"
6+
7+ namespace intel_npu {} // namespace intel_npu
You can’t perform that action at this time.
0 commit comments