SWDEV-436859 - Enable pitch for COPY_HOST_PTR

Original logic didn't use pitch because, abstraction layer had
a sysmem copy without pitch. Since extra sysmem copy was
disabled, the code has to accept pitch values from the app.

Change-Id: Ia9fba7b33ddff4e9109b4e63d0d6afa52f501c8f


[ROCm/clr commit: fb3dfcf889]
This commit is contained in:
German Andryeyev
2023-12-12 16:26:46 -05:00
parent 8b94eaf0a6
commit 7130b87d5c
2 changed files with 9 additions and 4 deletions
+5 -3
View File
@@ -1789,9 +1789,11 @@ pal::Memory* Device::createImage(amd::Memory& owner, bool directAccess) const {
owner.setHostMem(nullptr);
} else {
amd::Coord3D origin(0, 0, 0);
static const bool Entire = true;
if (xferMgr().writeImage(owner.getHostMem(), *gpuImage, origin, image.getRegion(), 0, 0,
Entire)) {
// Copy data with the original pitch values, since runtime doesn't perform
// extra sysmem allocation for one device
constexpr bool kEntire = true;
if (xferMgr().writeImage(owner.getHostMem(), *gpuImage, origin, image.getRegion(),
image.getRowPitch(), image.getSlicePitch(), kEntire)) {
// Clear CHP memory
owner.setHostMem(nullptr);
}
@@ -2086,8 +2086,11 @@ device::Memory* Device::createMemory(amd::Memory& owner) const {
imageView->replaceDeviceMemory(this, devImageView);
// Copy data with the original pitch values, since runtime doesn't perform
// extra sysmem allocation for one device
const auto image = owner.asImage();
result = xferMgr().writeImage(owner.getHostMem(), *devImageView, amd::Coord3D(0, 0, 0),
imageView->getRegion(), 0, 0, true);
imageView->getRegion(), image->getRowPitch(), image->getSlicePitch(), true);
// Release host memory, since runtime copied data
owner.setHostMem(nullptr);