fix(ocl): allocation info from pool svm ptr

Fix querying allocation info from pooled svm ptr.
Handle requested allocation alignment.
Refactor sorted vector usage.
Do not associate device with host pool allocation.

Related-To: NEO-9700

Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
Dominik Dabek
2024-01-03 13:15:24 +00:00
committed by Compute-Runtime-Automation
parent bbb8193be7
commit af1620a308
9 changed files with 309 additions and 59 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -4110,12 +4110,24 @@ CL_API_ENTRY cl_int CL_API_CALL clGetMemAllocInfoINTEL(
if (!unifiedMemoryAllocation) {
return changeGetInfoStatusToCLResultType(info.set<void *>(nullptr));
}
if (auto basePtrFromDevicePool = pContext->getDeviceMemAllocPool().getPooledAllocationBasePtr(ptr)) {
return changeGetInfoStatusToCLResultType(info.set<uint64_t>(castToUint64(basePtrFromDevicePool)));
}
if (auto basePtrFromHostPool = pContext->getHostMemAllocPool().getPooledAllocationBasePtr(ptr)) {
return changeGetInfoStatusToCLResultType(info.set<uint64_t>(castToUint64(basePtrFromHostPool)));
}
return changeGetInfoStatusToCLResultType(info.set<uint64_t>(unifiedMemoryAllocation->gpuAllocations.getDefaultGraphicsAllocation()->getGpuAddress()));
}
case CL_MEM_ALLOC_SIZE_INTEL: {
if (!unifiedMemoryAllocation) {
return changeGetInfoStatusToCLResultType(info.set<size_t>(0u));
}
if (auto sizeFromDevicePool = pContext->getDeviceMemAllocPool().getPooledAllocationSize(ptr)) {
return changeGetInfoStatusToCLResultType(info.set<size_t>(sizeFromDevicePool));
}
if (auto sizeFromHostPool = pContext->getHostMemAllocPool().getPooledAllocationSize(ptr)) {
return changeGetInfoStatusToCLResultType(info.set<size_t>(sizeFromHostPool));
}
return changeGetInfoStatusToCLResultType(info.set<size_t>(unifiedMemoryAllocation->size));
}
case CL_MEM_ALLOC_FLAGS_INTEL: {