From 696d00e71b594c8b846189d84ec6e4aec1ea2d53 Mon Sep 17 00:00:00 2001 From: Vladislav Sytchenko Date: Thu, 20 Feb 2020 18:00:27 -0500 Subject: [PATCH] Correct pitch alignment calculation When we're aligning rowPitch to imagePitchAlignment, rowPitch is in pixels, but imagePitchAlignment_ is bytes, so we end up overaligning the pitch. Convert imagePitchAlignment_ to pixels before doing any logic. Change-Id: Ia5ab9d54bed150fe974e86b060dbadc196165b29 --- rocclr/device/rocm/rocmemory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rocclr/device/rocm/rocmemory.cpp b/rocclr/device/rocm/rocmemory.cpp index dac94ce2d4..74bc1c5447 100644 --- a/rocclr/device/rocm/rocmemory.cpp +++ b/rocclr/device/rocm/rocmemory.cpp @@ -1143,7 +1143,7 @@ bool Image::createView(const Memory& parent) { } // Make sure the row pitch is aligned to pixels - rowPitch = elementSize * amd::alignUp(rowPitch, dev().info().imagePitchAlignment_); + rowPitch = elementSize * amd::alignUp(rowPitch, (dev().info().imagePitchAlignment_ / elementSize)); status = hsa_ext_image_create_with_layout( dev().getBackendDevice(), &imageDescriptor_, deviceMemory_, permission_,