[CC] solve assert issue due to cannot create convolution_backward_data::primitive in CC selective build binaries (#20571)

Deconvolution::createDescriptor will call createDescriptorInternalDefault() to create fwd_conv_pd,
sometimes ref_convolution_fwd_t will be chosen to return its primitive_desc, but ref_convolution_fwd_t
primitive will not be created finally, then CC will not put this primitive into convolution_impl_list
in selective build stage, the final CC package will fail due to cannot create fwd_conv_pd of ref_convolution_fwd_t.
This commit is contained in:
River Li 2023-10-27 16:58:20 +08:00 committed by GitHub
parent fbcb58127a
commit 9e987a4341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -937,6 +937,10 @@ void Deconvolution::prepareParams() {
} else { } else {
std::tie(desc, fwd_conv_pd) = createDefaultMkldnnDeconvDesc(key.inp0->getDnnlDesc(), key.inp1->getDnnlDesc(), key.out->getDnnlDesc(), std::tie(desc, fwd_conv_pd) = createDefaultMkldnnDeconvDesc(key.inp0->getDnnlDesc(), key.inp1->getDnnlDesc(), key.out->getDnnlDesc(),
key.stride, key.dilation, key.paddingL, key.paddingR, key.attr, engine); key.stride, key.dilation, key.paddingL, key.paddingR, key.attr, engine);
#if defined(SELECTIVE_BUILD_ANALYZER)
// Create dummy primitive to WA CC issue.
OPENVINO_ASSERT(dnnl::primitive(fwd_conv_pd));
#endif
} }
primitive_desc_iterator itpd = desc; primitive_desc_iterator itpd = desc;
@ -989,6 +993,10 @@ void Deconvolution::prepareParams() {
} else { } else {
std::tie(anyDeconvDesc, fwdConvPd) = createDefaultMkldnnDeconvDesc(inDesc, wghDesc, outDesc, std::tie(anyDeconvDesc, fwdConvPd) = createDefaultMkldnnDeconvDesc(inDesc, wghDesc, outDesc,
key.stride, key.dilation, key.paddingL, key.paddingR, key.attr, engine); key.stride, key.dilation, key.paddingL, key.paddingR, key.attr, engine);
#if defined(SELECTIVE_BUILD_ANALYZER)
// Create dummy primitive to WA CC issue.
OPENVINO_ASSERT(dnnl::primitive(fwd_conv_pd));
#endif
} }
if (anyDeconvDesc) { if (anyDeconvDesc) {
@ -1083,11 +1091,11 @@ void Deconvolution::createDescriptor(const std::vector<MemoryDescPtr> &inputDesc
std::tie(deconv_desc, fwd_conv_pd) = createDescriptorInternalDefault(in_candidate, wgh_candidate, out_candidate, dnnl::algorithm::convolution_direct, std::tie(deconv_desc, fwd_conv_pd) = createDescriptorInternalDefault(in_candidate, wgh_candidate, out_candidate, dnnl::algorithm::convolution_direct,
deconvAttrs.stride, deconvAttrs.dilation, deconvAttrs.paddingL, deconvAttrs.stride, deconvAttrs.dilation, deconvAttrs.paddingL,
deconvAttrs.paddingR, *attr, getEngine()); deconvAttrs.paddingR, *attr, getEngine());
IE_ASSERT(fwd_conv_pd && deconv_desc && deconv_desc.get(true) != nullptr) if (fwd_conv_pd && deconv_desc && deconv_desc.get(true) != nullptr) {
<< "Failed to create convolution_backward_data::primitive_desc: " << "Node: ##" << getName();
fwdConvPD.push_back(fwd_conv_pd); // oneDNN requires forward pd to exists until primitive is created fwdConvPD.push_back(fwd_conv_pd); // oneDNN requires forward pd to exists until primitive is created
descs.push_back(deconv_desc); descs.push_back(deconv_desc);
} }
}
} }
std::shared_ptr<MemoryDesc> Deconvolution::getSrcMemDesc(const dnnl::primitive_desc &prim_desc, size_t idx) const { std::shared_ptr<MemoryDesc> Deconvolution::getSrcMemDesc(const dnnl::primitive_desc &prim_desc, size_t idx) const {