SWDEV-457316 - Other graph can free mem alloc node and return invalid val only if there is double mem free node in all captured graphs.
Change-Id: Icf12164bf0ecd171a4673ff4f384528e7671f944
This commit is contained in:
committed by
Jaydeepkumar Patel
parent
4e77806ee5
commit
5c77e30b18
@@ -2580,26 +2580,17 @@ hipError_t hipGraphAddMemFreeNode(hipGraphNode_t* pGraphNode, hipGraph_t graph,
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
hip::GraphNode* pNode;
|
||||
bool AllocNodeFound = false;
|
||||
hip::Graph* g = reinterpret_cast<hip::Graph*>(graph);
|
||||
for (auto n : g->vertices_) {
|
||||
if (n->GetType() == hipGraphNodeTypeMemAlloc) {
|
||||
hipMemAllocNodeParams param = {};
|
||||
reinterpret_cast<hip::GraphMemAllocNode*>(n)->GetParams(¶m);
|
||||
if (param.dptr == dev_ptr) {
|
||||
AllocNodeFound = true;
|
||||
}
|
||||
} else if (n->GetType() == hipGraphNodeTypeMemFree) {
|
||||
void* param;
|
||||
reinterpret_cast<hip::GraphMemFreeNode*>(n)->GetParams(¶m);
|
||||
if (param == dev_ptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
for (auto it : hip::Graph::graphSet_) {
|
||||
for (auto n : it->vertices_) {
|
||||
if (n->GetType() == hipGraphNodeTypeMemFree) {
|
||||
void* param;
|
||||
reinterpret_cast<hip::GraphMemFreeNode*>(n)->GetParams(¶m);
|
||||
if (param == dev_ptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!AllocNodeFound) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
auto status =
|
||||
ihipGraphAddMemFreeNode(&pNode,
|
||||
reinterpret_cast<hip::Graph*>(graph),
|
||||
|
||||
Reference in New Issue
Block a user