From 2777b013bddd930dd6df150b008779c64c845002 Mon Sep 17 00:00:00 2001 From: foreman Date: Wed, 28 Mar 2018 17:22:48 -0400 Subject: [PATCH] P4 to Git Change 1533991 by gandryey@gera-w8 on 2018/03/28 17:07:37 SWDEV-149178 - [CQE OCL][DTB-BLOCKER][RS4][WF][QR]observed failures while running samplers test due to faulty CL#1529531 - Image alignment requirement could be different from the original buffer chunk alignment and that could cause a failure on the final address alignment. Use fragment size alignment for the chunk and protect suballocations from possible alignment mismatch Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/device/pal/palresource.cpp#58 edit --- rocclr/runtime/device/pal/palresource.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rocclr/runtime/device/pal/palresource.cpp b/rocclr/runtime/device/pal/palresource.cpp index d247303154..98436de3c3 100644 --- a/rocclr/runtime/device/pal/palresource.cpp +++ b/rocclr/runtime/device/pal/palresource.cpp @@ -1814,7 +1814,7 @@ bool MemorySubAllocator::InitAllocator(GpuMemoryReference* mem_ref) { bool MemorySubAllocator::CreateChunk(const Pal::IGpuMemory* reserved_va) { Pal::GpuMemoryCreateInfo createInfo = {}; createInfo.size = device_->settings().subAllocationChunkSize_; - createInfo.alignment = 0; + createInfo.alignment = device_->properties().gpuMemoryProperties.fragmentSize; createInfo.vaRange = Pal::VaRange::Default; createInfo.priority = Pal::GpuMemPriority::Normal; createInfo.heapCount = 1; @@ -1877,8 +1877,9 @@ GpuMemoryReference* MemorySubAllocator::Allocate(Pal::gpusize size, Pal::gpusize { GpuMemoryReference* mem_ref = nullptr; MemBuddyAllocator* allocator = nullptr; - // Check if resource size is allowed for suballocation - if (size < device_->settings().subAllocationMaxSize_) { + // Check if the resource size and alignment are allowed for suballocation + if ((size < device_->settings().subAllocationMaxSize_) && + (alignment <= device_->properties().gpuMemoryProperties.fragmentSize)) { uint i = 0; size = amd::alignUp(size, device_->settings().subAllocationMinSize_); do {