OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[CPU] Remove dnnl desc copy from the memory size routine (#26757)
Maksim Kutakovc864266644da
diff --git a/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp b/src/plugins/intel_cpu/src/dnnl_extension_utils.cppindex d60ede1decf..3d9b2f69bd8 100644--- a/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp+++ b/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp@@ -171,30 +171,14 @@ DnnlMemoryDescPtr DnnlExtensionUtils::makeDescriptor(const_dnnl_memory_desc_t de}}-static size_t sub_byte_data_type_multiplier(dnnl::memory::data_type dataType) {- switch (dataType) {- case dnnl::memory::data_type::nf4:- case dnnl::memory::data_type::s4:- case dnnl::memory::data_type::u4:- case dnnl::memory::data_type::f4_e2m1:- return 2;- default:- return 1;- }-}-size_t DnnlExtensionUtils::getMemSizeForDnnlDesc(const dnnl::memory::desc& desc) {- auto tmpDesc = desc;-- const auto offset0 = tmpDesc.get()->offset0;- tmpDesc.get()->offset0 = 0;+ OPENVINO_ASSERT(IMPLICATION(desc.get_format_kind() == dnnl::memory::format_kind::blocked, desc.get()->offset0 == 0),+ "Unexpected non zero offset for a dnnl blocked memory desc");- size_t size = tmpDesc.get_size();+ size_t size = desc.get_size();if (size == DNNL_RUNTIME_SIZE_VAL)return MemoryDesc::UNDEFINED_SIZE;- size += div_up(offset0 * sizeOfDataType(tmpDesc.get_data_type()),- sub_byte_data_type_multiplier(tmpDesc.get_data_type()));return size;}