Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[HETERO] Document framed blob layout in blob serialization header (#37075)

guozhong wang7b0b33523094
diff --git a/src/plugins/hetero/src/blob_serialization.hpp b/src/plugins/hetero/src/blob_serialization.hpp
index f8f0ba28d30..d70ce0d59bb 100644
--- a/src/plugins/hetero/src/blob_serialization.hpp
+++ b/src/plugins/hetero/src/blob_serialization.hpp
@@ -23,6 +23,39 @@ class Model;
namespace ov::hetero {
+// HETERO compiled blob layout (blob_format_version = 2, framed format):
+//
+// [blob header XML]
+// One UTF-8 XML line written by pugi::xml_document::save(..., format_raw)
+// and terminated by '\n'.
+// This XML stores the HETERO metadata (model name, format version,
+// I/O mapping, hetero config, and compiled_submodel entries).
+//
+// | blob header XML | submodel payload frame #0 | submodel payload frame #1 | ... | submodel payload frame #N-1 |
+// The XML header comes first and lists the compiled_submodel entries.
+// After that, one payload frame is written for each entry, in the same order.
+//
+// Submodel payload frame (repeated once per compiled_submodel in the XML header order):
+//
+// +--------------------+--------------------------+----------------------+
+// | type (1 byte char) | payload size (uint64_t) | payload raw data |
+// +--------------------+--------------------------+----------------------+
+//
+// Payload type values:
+// 'B' (COMPILED_BLOB_PAYLOAD): payload raw data is the backend-specific
+// compiled blob for one submodel.
+// 'I' (IR_PAYLOAD): payload raw data contains a serialized IR fallback payload.
+// Its internal layout is:
+//
+// +----------------------+------------------+-------------------------+--------------------+
+// | IR XML size (u64) | IR XML raw data | IR weights size (u64) | IR weights raw data|
+// +----------------------+------------------+-------------------------+--------------------+
+//
+// Notes:
+// - uint64_t values are written/read as raw host-endian bytes.
+// - blob_format_version = 1 is a legacy unframed format handled by the reader
+// for backward compatibility.
+
constexpr std::uint32_t HETERO_BLOB_FORMAT_VERSION = 2;
constexpr const char* HETERO_BLOB_FORMAT_VERSION_ATTR = "blob_format_version";
constexpr char COMPILED_BLOB_PAYLOAD = 'B';