Disable internal device address relationship in zero copy.

This commit is contained in:
gaoyong10 2023-02-14 17:43:55 +08:00
parent e70b601c47
commit 60853f8e2c
1 changed files with 4 additions and 1 deletions

View File

@ -669,7 +669,10 @@ void KernelRuntime::AssignStaticMemoryInput(const session::KernelGraph &graph) {
MS_LOG(WARNING) << "It is not suggested to use a lonely weight parameter as the output of graph";
continue;
}
DeviceAddressPtr device_address = GetInternalDeviceAddress(graph, item);
// If kernel has flag kFlagEnableZeroCopyInGraph, the internal parameter and the corresponding
// cnode cannot use the same device address.
DeviceAddressPtr device_address =
(graph.has_flag(kFlagEnableZeroCopyInGraph) ? nullptr : GetInternalDeviceAddress(graph, item));
GetDeviceAddress(item, shadow_backend_node_map, index, graph, &device_address);
AnfAlgo::SetOutputAddr(device_address, index, item.get());
}