SWDEV-386685 - return proper error
- if graph is already instantiated there cant be a second instance in case nodes are free or alloc Signed-off-by: sdashmiz <shadi.dashmiz@amd.com> Change-Id: I51e2ca8ade24799da96ed126a26c5ea3bad6f452
Этот коммит содержится в:
коммит произвёл
Maneesh Gupta
родитель
3a45a965e2
Коммит
f6c36be185
@@ -1218,12 +1218,20 @@ hipError_t hipGraphAddChildGraphNode(hipGraphNode_t* pGraphNode, hipGraph_t grap
|
||||
hipError_t ihipGraphInstantiate(hipGraphExec_t* pGraphExec, hipGraph_t graph,
|
||||
uint64_t flags = 0) {
|
||||
if (pGraphExec == nullptr || graph == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
if (graph->IsGraphInstantiated() == true) {
|
||||
for (auto node : graph->GetNodes()) {
|
||||
if ((node->GetType() == hipGraphNodeTypeMemAlloc)
|
||||
|| (node->GetType() == hipGraphNodeTypeMemFree)) {
|
||||
return hipErrorNotSupported;
|
||||
}
|
||||
}
|
||||
}
|
||||
std::unordered_map<Node, Node> clonedNodes;
|
||||
hipGraph_t clonedGraph = graph->clone(clonedNodes);
|
||||
if (clonedGraph == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
std::vector<std::vector<Node>> parallelLists;
|
||||
std::unordered_map<Node, std::vector<Node>> nodeWaitLists;
|
||||
@@ -1236,6 +1244,7 @@ hipError_t ihipGraphInstantiate(hipGraphExec_t* pGraphExec, hipGraph_t graph,
|
||||
new hipGraphExec(levelOrder, parallelLists, nodeWaitLists, clonedNodes,
|
||||
graphExeUserObj, flags);
|
||||
if (*pGraphExec != nullptr) {
|
||||
graph->SetGraphInstantiated(true);
|
||||
return (*pGraphExec)->Init();
|
||||
} else {
|
||||
return hipErrorOutOfMemory;
|
||||
|
||||
Ссылка в новой задаче
Block a user