From e6dfc620c478f479a14097012bfab5598f3573a2 Mon Sep 17 00:00:00 2001 From: Konrad Kusiak Date: Tue, 5 Mar 2024 10:08:04 +0000 Subject: [PATCH] Added isManaged to if statement check --- source/adapters/hip/enqueue.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/adapters/hip/enqueue.cpp b/source/adapters/hip/enqueue.cpp index a1b78bf936..72c596e825 100644 --- a/source/adapters/hip/enqueue.cpp +++ b/source/adapters/hip/enqueue.cpp @@ -807,7 +807,10 @@ ur_result_t commonMemSetLargePattern(hipStream_t Stream, uint32_t PatternSize, hipPointerAttribute_t ptrAttribs{}; UR_CHECK_ERROR(hipPointerGetAttributes(&ptrAttribs, (const void *)Ptr)); - if (ptrAttribs.hostPointer) { + // The hostPointer attribute is non-null also for shared memory allocations. + // To make sure that this workaround only executes for host pinned memory, we + // need to check that isManaged attribute is false. + if (ptrAttribs.hostPointer && !ptrAttribs.isManaged) { const auto NumOfCopySteps = Size / PatternSize; const auto Offset = sizeof(uint32_t); const auto LeftPatternSize = PatternSize - Offset;