From 68b68b17a89f2232ed6039ddc483b56604774ad0 Mon Sep 17 00:00:00 2001 From: Georgi Mirazchiyski Date: Tue, 2 Apr 2024 15:38:56 +0100 Subject: [PATCH] Apply review feedback to remove unnecessary noise --- source/adapters/hip/enqueue.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/adapters/hip/enqueue.cpp b/source/adapters/hip/enqueue.cpp index 473fb9db65..45186fe67b 100644 --- a/source/adapters/hip/enqueue.cpp +++ b/source/adapters/hip/enqueue.cpp @@ -1618,6 +1618,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( hipPointerAttribute_t srcAttribs{}; hipPointerAttribute_t dstAttribs{}; + hipError_t hipRes{}; // Determine if pSrc and/or pDst are system allocated pageable host memory. bool srcIsSystemAlloc{false}; bool dstIsSystemAlloc{false}; @@ -1630,11 +1631,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy2D( // the pointer handle as system allocated pageable host memory. // The HIP runtime can handle the registering/unregistering of the memory // as long as the right copy-kind (direction) is provided to hipMemcpy2D*. - hipError_t hipRet = hipPointerGetAttributes(&srcAttribs, pSrc); - if (pSrc && hipRet == hipErrorInvalidValue) + hipRes = hipPointerGetAttributes(&srcAttribs, pSrc); + if (hipRes == hipErrorInvalidValue && pSrc) srcIsSystemAlloc = true; - hipRet = hipPointerGetAttributes(&dstAttribs, (const void *)pDst); - if (pDst && hipRet == hipErrorInvalidValue) + hipRes = hipPointerGetAttributes(&dstAttribs, (const void *)pDst); + if (hipRes == hipErrorInvalidValue && pDst) dstIsSystemAlloc = true; #if HIP_VERSION_MAJOR >= 6 srcIsSystemAlloc |= srcAttribs.type == hipMemoryTypeUnregistered;