From 96b4618d26acfb7e21537ed8b48a77feb0305209 Mon Sep 17 00:00:00 2001 From: Rahul Garg Date: Thu, 24 May 2018 08:27:24 +0530 Subject: [PATCH] Correct remaining bytes in copy 2d kernel --- hipamd/src/hip_memory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hipamd/src/hip_memory.cpp b/hipamd/src/hip_memory.cpp index b76f7f0524..a1bc1416a0 100644 --- a/hipamd/src/hip_memory.cpp +++ b/hipamd/src/hip_memory.cpp @@ -1501,7 +1501,7 @@ __global__ void hip_copy2d_n(T* dst, const T* src, size_t width, size_t height, T *srcPtr = (T *)((uint8_t*) src + idy * srcPitch); dstPtr[idx] = srcPtr[idx]; } else { - size_t bytesToCopy = width - floorWidth; + size_t bytesToCopy = width - (floorWidth * sizeof(T)); uint8_t *dstPtr = (uint8_t *) ((uint8_t*) dst + idy * destPitch); uint8_t *srcPtr = (uint8_t *) ((uint8_t*) src + idy * srcPitch); for(int i =0 ; i < bytesToCopy ; i++) {