From 41174e6244852a2b7390c45021ad5717ba9c88e9 Mon Sep 17 00:00:00 2001 From: Ioannis Assiouras Date: Wed, 8 Mar 2023 16:46:04 +0000 Subject: [PATCH] SWDEV-387383 - Changed error message in hipDevice[Get/Set]GraphMemAttribute to match cuda Change-Id: I34a9f3d8572e004ae3d25ef25a4d404bea6d9597 [ROCm/clr commit: 9e1e3035ec6f381b80b27bb874803119aa1c0980] --- projects/clr/hipamd/src/hip_graph.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/clr/hipamd/src/hip_graph.cpp b/projects/clr/hipamd/src/hip_graph.cpp index c4504d4c87..fcaa2b2449 100644 --- a/projects/clr/hipamd/src/hip_graph.cpp +++ b/projects/clr/hipamd/src/hip_graph.cpp @@ -2224,9 +2224,12 @@ hipError_t hipGraphMemFreeNodeGetParams(hipGraphNode_t node, void* dev_ptr) { // ================================================================================================ hipError_t hipDeviceGetGraphMemAttribute(int device, hipGraphMemAttributeType attr, void* value) { HIP_INIT_API(hipDeviceGetGraphMemAttribute, device, attr, value); - if ((static_cast(device) >= g_devices.size()) || device < 0 || value == nullptr) { + if ((static_cast(device) >= g_devices.size()) || device < 0) { HIP_RETURN(hipErrorInvalidDevice); } + if (value == nullptr) { + HIP_RETURN(hipErrorInvalidValue); + } hipError_t result = hipErrorInvalidValue; switch (attr) { case hipGraphMemAttrUsedMemCurrent: @@ -2254,9 +2257,12 @@ hipError_t hipDeviceGetGraphMemAttribute(int device, hipGraphMemAttributeType at // ================================================================================================ hipError_t hipDeviceSetGraphMemAttribute(int device, hipGraphMemAttributeType attr, void* value) { HIP_INIT_API(hipDeviceSetGraphMemAttribute, device, attr, value); - if ((static_cast(device) >= g_devices.size()) || device < 0 || value == nullptr) { + if ((static_cast(device) >= g_devices.size()) || device < 0) { HIP_RETURN(hipErrorInvalidDevice); } + if (value == nullptr) { + HIP_RETURN(hipErrorInvalidValue); + } hipError_t result = hipErrorInvalidValue; switch (attr) { case hipGraphMemAttrUsedMemHigh: