Skip to content

Commit

Permalink
Prepare BlobContainerAlignedBuffer for OV versioning metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
MirceaDan99 committed Dec 12, 2024
1 parent fadd8f1 commit 9859b15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,18 @@ class BlobContainerVector : public BlobContainer {

class BlobContainerAlignedBuffer : public BlobContainer {
public:
BlobContainerAlignedBuffer(const std::shared_ptr<ov::AlignedBuffer>& blobSO, size_t offset)
BlobContainerAlignedBuffer(const std::shared_ptr<ov::AlignedBuffer>& blobSO, size_t ovHeaderOffset, size_t metadataSize)
: _ownershipBlob(blobSO),
_offset(offset) {}
_ovHeaderOffset(ovHeaderOffset),
_metadataSize(metadataSize) {}

void* get_ptr() override {
return _ownershipBlob->get_ptr(_offset);
return _ownershipBlob->get_ptr(_ovHeaderOffset);
}

size_t size() const override {
return _ownershipBlob->size();
// remove OV header offset and metadata from blob size
return _ownershipBlob->size() - _ovHeaderOffset - _metadataSize;
}

bool release_from_memory() override {
Expand All @@ -64,7 +66,8 @@ class BlobContainerAlignedBuffer : public BlobContainer {

private:
std::shared_ptr<ov::AlignedBuffer> _ownershipBlob;
size_t _offset;
size_t _ovHeaderOffset;
size_t _metadataSize;
};

} // namespace intel_npu
2 changes: 1 addition & 1 deletion src/plugins/intel_npu/src/plugin/src/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ std::shared_ptr<ov::ICompiledModel> Plugin::import_model(std::istream& stream, c

blobPtr = std::make_unique<BlobContainerVector>(std::move(blob));
} else {
blobPtr = std::make_unique<BlobContainerAlignedBuffer>(modelBuffer, stream.tellg());
blobPtr = std::make_unique<BlobContainerAlignedBuffer>(modelBuffer, stream.tellg(), 0);
}

auto graph = compiler->parse(std::move(blobPtr), localConfig);
Expand Down

0 comments on commit 9859b15

Please sign in to comment.