This commit is contained in:
Egor Duplenskii 2024-06-12 03:27:12 +02:00 committed by GitHub
commit e9ee5accb0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 7 deletions

View File

@ -375,15 +375,23 @@ void Input::cloneBlobIfRequired() {
auto weightCache = context->getWeightsCache();
if (weightCache) {
MemoryPtr ptr = *weightCache->findOrCreate(blobKey(), cloneBlob);
memoryPtr = std::const_pointer_cast<const IMemory>(ptr);
// IRs already have all subnormals flushed to zero, but in
// read_model scenario with directly loaded original model still can have subnormals
} else if (prec != element::string && isBlobAligned() && (!needFlushDenormalsToZero || !hasSubnormals()) && !isWA()) {
// if (weightCache) {
// MemoryPtr ptr = *weightCache->findOrCreate(blobKey(), cloneBlob);
// memoryPtr = std::const_pointer_cast<const IMemory>(ptr);
// // IRs already have all subnormals flushed to zero, but in
// // read_model scenario with directly loaded original model still can have subnormals
// } else
if (prec != element::string && isBlobAligned() && (!needFlushDenormalsToZero || !hasSubnormals()) && !isWA()) {
memoryPtr = std::make_shared<Memory>(getEngine(), memDesc, constOp->get_data_ptr());
} else {
memoryPtr = std::const_pointer_cast<const IMemory>(cloneBlob());
if (weightCache) {
MemoryPtr ptr = *weightCache->findOrCreate(blobKey(), cloneBlob);
memoryPtr = std::const_pointer_cast<const IMemory>(ptr);
// IRs already have all subnormals flushed to zero, but in
// read_model scenario with directly loaded original model still can have subnormals
} else {
memoryPtr = std::const_pointer_cast<const IMemory>(cloneBlob());
}
}
}