Skip to content

Commit 01deba9

Browse files
Creating some interfaces
1 parent 6642033 commit 01deba9

File tree

6 files changed

+118
-0
lines changed

6 files changed

+118
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
using CREToken = uint16_t;
18+
19+
class BlobWriter {
20+
public:
21+
BlobWriter();
22+
23+
void register_section(const ISection& section);
24+
25+
void register_offset_in_table(const ISection::SectionID id, const uint64_t offset);
26+
27+
void write(std::ostream& stream, const std::shared_ptr<IGraph>& graph);
28+
29+
void append_compatibility_requirement(const CREToken requirement_token);
30+
31+
private:
32+
void register_cre();
33+
34+
void write_persistent_format_region();
35+
36+
std::unordered_set<ISection::SectionID> registered_sections_ids;
37+
std::vector<ISection> registered_sections;
38+
std::unordered_map<ISection::SectionID, uint64_t> offsets_table;
39+
std::vector<CREToken> cre;
40+
};
41+
42+
} // namespace intel_npu
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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 {} // namespace intel_npu
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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

0 commit comments

Comments
 (0)