For groups, we need to add it into the serialized ideep desc. For example, a 4D FWK weight with groups > 1 will become a 5D oneDNN md, while FWK still needs it to be a 4D tensor. ideep desc will wrap the 5D oneDNN md back to a 4D ideep desc when interacting with the FWK, thus we insert this groups information into the end of the blob during the serialization. During the deserialization, we exclude these groups bytes when constructing the oneDNN md and save the groups into the constructed ideep desc.
These two new APIs will be used in AOTInductor to save and load the prepacked oneDNN weights that're in opaque format.
Limitation
We have the below two assumptions
The sizeof(int) (groups is of int type) is the same on the machine during the serialization and the deserialization.
The machine of the serialization and the deserialization are little endian.
Pitch
Add a wrapper layer for the memory desc serialization and deserialization APIs in oneDNN v3.4.1 into ideep. Update the
IDEEP_VERSION_REVISION
to 2.Description
Starting from oneDNN v3.4.1, the oneDNN memory descriptor serialization API has been introduced (9b848c859).
We added two new APIs in ideep accordingly:
For the serialization:
std::vector<uint8_t> get_blob()
is added for get_blob() of oneDNN md.For the deserialization, &blob) of oneDNN md .
desc(const std::vector<uint8_t> &blob)
is added for desc(const std::vectorFor
groups
, we need to add it into the serialized ideep desc. For example, a 4D FWK weight with groups > 1 will become a 5D oneDNN md, while FWK still needs it to be a 4D tensor. ideep desc will wrap the 5D oneDNN md back to a 4D ideep desc when interacting with the FWK, thus we insert thisgroups
information into the end of the blob during the serialization. During the deserialization, we exclude thesegroups
bytes when constructing the oneDNN md and save thegroups
into the constructed ideep desc.These two new APIs will be used in AOTInductor to save and load the prepacked oneDNN weights that're in opaque format.
Limitation
We have the below two assumptions
sizeof(int)
(groups
is ofint
type) is the same on the machine during the serialization and the deserialization.