!49306 fix the address bug of input node has no user in the old runtime

Merge pull request !49306 from limingqi107/new_actor_runtime
This commit is contained in:
i-robot 2023-02-23 09:53:26 +00:00 committed by Gitee
commit bd3dd5af8b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 22 additions and 0 deletions

View File

@ -43,6 +43,10 @@ void AscendInferenceSession::LoadInputData(const std::shared_ptr<KernelGraph> &k
}
auto pk_node = input_node->cast<ParameterPtr>();
MS_EXCEPTION_IF_NULL(pk_node);
if (!pk_node->IsUsedByRealKernelInGraph(kernel_graph->graph_id())) {
MS_LOG(INFO) << "Kernel graph inputs have anfnode which has no user.";
continue;
}
auto device_address = AnfAlgo::GetMutableOutputAddr(pk_node, 0);
MS_EXCEPTION_IF_NULL(device_address);
if (!common::AnfAlgo::IsParameterWeight(pk_node)) {
@ -70,6 +74,10 @@ GraphId AscendInferenceSession::CompileGraphImpl(NotNull<FuncGraphPtr> func_grap
}
auto pk_node = input_node->cast<ParameterPtr>();
MS_EXCEPTION_IF_NULL(pk_node);
if (!pk_node->IsUsedByRealKernelInGraph(kernel_graph->graph_id())) {
MS_LOG(INFO) << "Kernel graph inputs have anfnode which has no user.";
continue;
}
auto device_address = AnfAlgo::GetMutableOutputAddr(pk_node, 0);
MS_EXCEPTION_IF_NULL(device_address);
if (common::AnfAlgo::IsParameterWeight(pk_node)) {

View File

@ -42,6 +42,10 @@ void GpuInferenceSession::LoadInputData(const std::shared_ptr<KernelGraph> &kern
}
auto pk_node = input_nodes[i]->cast<ParameterPtr>();
MS_EXCEPTION_IF_NULL(pk_node);
if (!pk_node->IsUsedByRealKernelInGraph(kernel_graph->graph_id())) {
MS_LOG(INFO) << "Kernel graph inputs have anfnode which has no user.";
continue;
}
auto device_address = AnfAlgo::GetMutableOutputAddr(pk_node, 0);
MS_EXCEPTION_IF_NULL(device_address);
if (!common::AnfAlgo::IsParameterWeight(pk_node)) {
@ -69,6 +73,10 @@ GraphId GpuInferenceSession::CompileGraphImpl(NotNull<FuncGraphPtr> func_graph)
}
auto pk_node = input_nodes[i]->cast<ParameterPtr>();
MS_EXCEPTION_IF_NULL(pk_node);
if (!pk_node->IsUsedByRealKernelInGraph(kernel_graph->graph_id())) {
MS_LOG(INFO) << "Kernel graph inputs have anfnode which has no user.";
continue;
}
auto device_address = AnfAlgo::GetMutableOutputAddr(pk_node, 0);
MS_EXCEPTION_IF_NULL(device_address);
if (common::AnfAlgo::IsParameterWeight(pk_node)) {

View File

@ -355,6 +355,12 @@ void GPUSession::LoadInputData(const std::shared_ptr<KernelGraph> &kernel_graph,
MS_EXCEPTION_IF_NULL(input_node);
if (input_node->isa<Parameter>() && AnfAlgo::OutputAddrExist(input_node, 0)) {
auto pk_node = input_node->cast<ParameterPtr>();
MS_EXCEPTION_IF_NULL(pk_node);
if (!pk_node->IsUsedByRealKernelInGraph(kernel_graph->graph_id())) {
MS_LOG(INFO) << "Kernel graph inputs have anfnode which has no user.";
tensor->set_sync_status(kNoNeedSync);
continue;
}
auto device_address = AnfAlgo::GetMutableOutputAddr(pk_node, 0);
MS_EXCEPTION_IF_NULL(device_address);
bool need_sync = CheckIfNeedSync(tensor, device_address, pk_node);