!40414 fix kernel build info is nullptr

Merge pull request !40414 from liubuyu/bug_fix
This commit is contained in:
i-robot 2022-08-16 13:28:12 +00:00 committed by Gitee
commit a9eea29c22
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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) {
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);