From d7b097c994c0afc4fd22d8b6b626760cd486ef77 Mon Sep 17 00:00:00 2001 From: kjayapra-amd Date: Sat, 17 Aug 2024 17:17:34 -0400 Subject: [PATCH] SWDEV-478097 - Check for parents size in case of VA Mem object. Change-Id: Icfdeabeb178c0dcc8c3a4bc48eec40067985794e --- hipamd/src/hip_memory.cpp | 6 ++++++ rocclr/device/blit.cpp | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hipamd/src/hip_memory.cpp b/hipamd/src/hip_memory.cpp index a484d06a0e..78ea87259f 100644 --- a/hipamd/src/hip_memory.cpp +++ b/hipamd/src/hip_memory.cpp @@ -3162,6 +3162,12 @@ hipError_t ihipMemset_validate(void* dst, int64_t value, size_t valueSize, // dst ptr is host ptr hence error return hipErrorInvalidValue; } + + // In case of vmm sub object, validate using parents vaddr mem object. + if (memory->parent() && (memory->getMemFlags() & CL_MEM_VA_RANGE_AMD)) { + memory = memory->parent(); + } + // Return error if sizeBytes passed to memcpy is more than the actual size allocated if (sizeBytes > (memory->getSize() - offset)){ return hipErrorInvalidValue; diff --git a/rocclr/device/blit.cpp b/rocclr/device/blit.cpp index 1e0301bed6..237f859a91 100644 --- a/rocclr/device/blit.cpp +++ b/rocclr/device/blit.cpp @@ -723,8 +723,6 @@ void HostBlitManager::FillBufferInfo::PackInfo(const device::Memory& memory, siz // 1. Validate input arguments guarantee(fill_size >= pattern_size, "Pattern Size: %u cannot be greater than fill size: %u \n", pattern_size, fill_size); - guarantee(fill_size <= memory.size(), "Cannot fill: %u more than the mem object size:%u \n", - fill_size, memory.size()); // 2. Calculate the next closest dword aligned address for faster processing size_t dst_addr = memory.virtualAddress() + fill_origin;