Skip to content

Commit

Permalink
Optimize CIP path
Browse files Browse the repository at this point in the history
  • Loading branch information
MirceaDan99 committed Jan 17, 2025
1 parent a47ea59 commit 2f7ec86
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class BlobContainer {

virtual bool release_from_memory() = 0;

virtual std::vector<uint8_t> get_ownership_blob() = 0;

virtual ~BlobContainer() = default;
};

Expand All @@ -40,6 +42,10 @@ class BlobContainerVector : public BlobContainer {
return true;
}

std::vector<uint8_t> get_ownership_blob() override {
return _ownershipBlob;
}

private:
std::vector<uint8_t> _ownershipBlob;
};
Expand All @@ -65,6 +71,12 @@ class BlobContainerAlignedBuffer : public BlobContainer {
return false;
}

std::vector<uint8_t> get_ownership_blob() override {
std::vector<uint8_t> blob(_blobSize);
blob.assign(reinterpret_cast<const uint8_t*>(this->get_ptr()), reinterpret_cast<const uint8_t*>(this->get_ptr()) + this->size());
return blob;
}

private:
uint64_t _blobSize;
size_t _ovHeaderOffset;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,8 @@ std::shared_ptr<IGraph> PluginCompilerAdapter::parse(std::unique_ptr<BlobContain
OV_ITT_TASK_CHAIN(PARSE_BLOB, itt::domains::NPUPlugin, "PluginCompilerAdapter", "parse");

_logger.debug("parse start");
std::vector<uint8_t> network(blobPtr->size());
network.assign(reinterpret_cast<const uint8_t*>(blobPtr->get_ptr()),
reinterpret_cast<const uint8_t*>(blobPtr->get_ptr()) + blobPtr->size());
auto networkMeta = _compiler->parse(network, config);
network.clear();
network.shrink_to_fit();
const auto& blob = blobPtr->get_ownership_blob();
auto networkMeta = _compiler->parse(blob, config);
_logger.debug("parse end");

ze_graph_handle_t graphHandle = nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ size_t PluginGraph::export_blob(std::ostream& stream) const {

std::vector<ov::ProfilingInfo> PluginGraph::process_profiling_output(const std::vector<uint8_t>& profData,
const Config& config) const {
std::vector<uint8_t> blob(_blobPtr->size());
blob.assign(reinterpret_cast<const uint8_t*>(_blobPtr->get_ptr()),
reinterpret_cast<const uint8_t*>(_blobPtr->get_ptr()) + _blobPtr->size());
const auto& blob = _blobPtr->get_ownership_blob();
return _compiler->process_profiling_output(profData, blob, config);
}

Expand Down

0 comments on commit 2f7ec86

Please sign in to comment.