SWDEV-371206, SWDEV-371163 - Fix hipGraphNodeGetEnabled/SetEnabled negative scenarios

Change-Id: Icf4bcca743c2188ee89dbdc8eb32d9d727b95227


[ROCm/clr commit: ac0db17b54]
Este commit está contenido en:
Anusha GodavarthySurya
2022-12-01 14:59:01 +00:00
cometido por Anusha Godavarthy Surya
padre db752c6295
commit 38b4f50f9c
+12 -2
Ver fichero
@@ -2187,13 +2187,18 @@ hipError_t hipGraphDebugDotPrint(hipGraph_t graph, const char* path, unsigned in
hipError_t hipGraphNodeSetEnabled(hipGraphExec_t hGraphExec, hipGraphNode_t hNode,
unsigned int isEnabled) {
HIP_INIT_API(hipGraphNodeSetEnabled, hGraphExec, hNode, isEnabled);
if (hGraphExec == nullptr || hNode == nullptr) {
if (hGraphExec == nullptr || hNode == nullptr || !hipGraphExec::isGraphExecValid(hGraphExec) ||
!hipGraphNode::isNodeValid(hNode)) {
HIP_RETURN(hipErrorInvalidValue);
}
hipGraphNode_t clonedNode = hGraphExec->GetClonedNode(hNode);
if (clonedNode == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
if (!(hNode->GetType() == hipGraphNodeTypeKernel || hNode->GetType() == hipGraphNodeTypeMemcpy ||
hNode->GetType() == hipGraphNodeTypeMemset)) {
return HIP_RETURN(hipErrorInvalidValue);
}
clonedNode->SetEnabled(isEnabled);
HIP_RETURN(hipSuccess);
}
@@ -2201,13 +2206,18 @@ hipError_t hipGraphNodeSetEnabled(hipGraphExec_t hGraphExec, hipGraphNode_t hNod
hipError_t hipGraphNodeGetEnabled(hipGraphExec_t hGraphExec, hipGraphNode_t hNode,
unsigned int* isEnabled) {
HIP_INIT_API(hipGraphNodeGetEnabled, hGraphExec, hNode, isEnabled);
if (hGraphExec == nullptr || hNode == nullptr || isEnabled == nullptr) {
if (hGraphExec == nullptr || hNode == nullptr || isEnabled == nullptr ||
!hipGraphExec::isGraphExecValid(hGraphExec) || !hipGraphNode::isNodeValid(hNode)) {
HIP_RETURN(hipErrorInvalidValue);
}
hipGraphNode_t clonedNode = hGraphExec->GetClonedNode(hNode);
if (clonedNode == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
if (!(hNode->GetType() == hipGraphNodeTypeKernel || hNode->GetType() == hipGraphNodeTypeMemcpy ||
hNode->GetType() == hipGraphNodeTypeMemset)) {
return HIP_RETURN(hipErrorInvalidValue);
}
*isEnabled = clonedNode->GetEnabled();
HIP_RETURN(hipSuccess);
}