fix kernel_build_info is nullptr

This commit is contained in:
lby 2022-08-15 17:41:27 +08:00
parent 984a92c0b8
commit a0fcfb08f5
1 changed files with 5 additions and 1 deletions

View File

@ -191,10 +191,14 @@ void CallbackImpl::SetEmptyKernelInfo(const AnfNodePtr &node) {
}
void CallbackImpl::ResetKernelInfo(const AnfNodePtr &node) {
MS_EXCEPTION_IF_NULL(node);
auto cnode = node->cast<CNodePtr>();
MS_EXCEPTION_IF_NULL(cnode);
if (GetTargetFromContext() == kAscendDevice) {
cnode->set_kernel_info(std::make_shared<device::KernelInfo>());
auto kernel_info = cnode->kernel_info_ptr();
if (kernel_info == nullptr) {
cnode->set_kernel_info(std::make_shared<device::KernelInfo>());
}
auto kernel_info_setter = GraphKernelInfoManager::Instance().GetGraphKernelInfo(kAscendDevice);
MS_EXCEPTION_IF_NULL(kernel_info_setter);
kernel_info_setter->SetKernelInfo(cnode, KernelType::UNKNOWN_KERNEL_TYPE);