Skip to content

Commit 9cd4150

Browse files
committed
Apply review feedback to remove unnecessary noise
1 parent d580090 commit 9cd4150

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

source/adapters/hip/enqueue.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,8 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy2D(
16211621
// Determine if pSrc and/or pDst are system allocated pageable host memory.
16221622
bool srcIsSystemAlloc{false};
16231623
bool dstIsSystemAlloc{false};
1624+
1625+
hipError_t hipRes{};
16241626
// Error code hipErrorInvalidValue returned from hipPointerGetAttributes
16251627
// for a non-null pointer refers to an OS-allocation, hence we can work
16261628
// with the assumption that this is a pointer to a pageable host memory.
@@ -1630,11 +1632,11 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy2D(
16301632
// the pointer handle as system allocated pageable host memory.
16311633
// The HIP runtime can handle the registering/unregistering of the memory
16321634
// as long as the right copy-kind (direction) is provided to hipMemcpy2D*.
1633-
hipError_t hipRet = hipPointerGetAttributes(&srcAttribs, pSrc);
1634-
if (pSrc && hipRet == hipErrorInvalidValue)
1635+
hipRes = hipPointerGetAttributes(&srcAttribs, pSrc);
1636+
if (hipRes == hipErrorInvalidValue && pSrc)
16351637
srcIsSystemAlloc = true;
1636-
hipRet = hipPointerGetAttributes(&dstAttribs, (const void *)pDst);
1637-
if (pDst && hipRet == hipErrorInvalidValue)
1638+
hipRes = hipPointerGetAttributes(&dstAttribs, (const void *)pDst);
1639+
if (hipRes == hipErrorInvalidValue && pDst)
16381640
dstIsSystemAlloc = true;
16391641
#if HIP_VERSION_MAJOR >= 6
16401642
srcIsSystemAlloc |= srcAttribs.type == hipMemoryTypeUnregistered;
@@ -1653,7 +1655,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urEnqueueUSMMemcpy2D(
16531655
// NOTE: The hipPointerGetAttribute API is marked as [BETA] and fails with
16541656
// exit code -11 when passing a system allocated pointer to it.
16551657
if (!srcIsSystemAlloc && srcAttribs.isManaged) {
1656-
UR_ASSERT(srcAttribs.hostPointer && srcAttribs.hostPointer,
1658+
UR_ASSERT(srcAttribs.hostPointer && srcAttribs.devicePointer,
16571659
UR_RESULT_ERROR_INVALID_VALUE);
16581660
UR_CHECK_ERROR(hipPointerGetAttribute(
16591661
&srcMemType, HIP_POINTER_ATTRIBUTE_MEMORY_TYPE,

0 commit comments

Comments
 (0)