Skip to content

Commit 7833d62

Browse files
feature: integrate UsmMemAllocPoolsManager with OpenCL device pool
Related-To: NEO-16082 Signed-off-by: Aleksander Czerwionka <[email protected]>
1 parent 0ac8e8c commit 7833d62

File tree

12 files changed

+538
-152
lines changed

12 files changed

+538
-152
lines changed

opencl/source/api/api.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4046,7 +4046,7 @@ CL_API_ENTRY void *CL_API_CALL clDeviceMemAllocINTEL(
40464046

40474047
neoContext->initializeDeviceUsmAllocationPool();
40484048

4049-
auto allocationFromPool = neoContext->getDeviceMemAllocPool().createUnifiedMemoryAllocation(size, unifiedMemoryProperties);
4049+
auto allocationFromPool = neoContext->getDeviceMemAllocPoolsManager().createUnifiedMemoryAllocation(size, unifiedMemoryProperties);
40504050
if (allocationFromPool) {
40514051
TRACING_EXIT(ClDeviceMemAllocINTEL, &allocationFromPool);
40524052
return allocationFromPool;
@@ -4135,7 +4135,7 @@ CL_API_ENTRY cl_int CL_API_CALL clMemFreeCommon(cl_context context,
41354135

41364136
bool successfulFree = false;
41374137

4138-
if (ptr && neoContext->getDeviceMemAllocPool().freeSVMAlloc(const_cast<void *>(ptr), blocking)) {
4138+
if (ptr && neoContext->getDeviceMemAllocPoolsManager().freeSVMAlloc(const_cast<void *>(ptr), blocking)) {
41394139
successfulFree = true;
41404140
}
41414141

@@ -4236,7 +4236,7 @@ CL_API_ENTRY cl_int CL_API_CALL clGetMemAllocInfoINTEL(
42364236
TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal);
42374237
return retVal;
42384238
}
4239-
if (auto basePtrFromDevicePool = pContext->getDeviceMemAllocPool().getPooledAllocationBasePtr(ptr)) {
4239+
if (auto basePtrFromDevicePool = pContext->getDeviceMemAllocPoolsManager().getPooledAllocationBasePtr(ptr)) {
42404240
retVal = changeGetInfoStatusToCLResultType(info.set<uint64_t>(castToUint64(basePtrFromDevicePool)));
42414241
TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal);
42424242
return retVal;
@@ -4256,7 +4256,7 @@ CL_API_ENTRY cl_int CL_API_CALL clGetMemAllocInfoINTEL(
42564256
TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal);
42574257
return retVal;
42584258
}
4259-
if (auto sizeFromDevicePool = pContext->getDeviceMemAllocPool().getPooledAllocationSize(ptr)) {
4259+
if (auto sizeFromDevicePool = pContext->getDeviceMemAllocPoolsManager().getPooledAllocationSize(ptr)) {
42604260
retVal = changeGetInfoStatusToCLResultType(info.set<size_t>(sizeFromDevicePool));
42614261
TRACING_EXIT(ClGetMemAllocInfoINTEL, &retVal);
42624262
return retVal;

opencl/source/context/context.cpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Context::~Context() {
6464
smallBufferPoolAllocator.releasePools();
6565
}
6666

67-
usmDeviceMemAllocPool.cleanup();
67+
usmDeviceMemAllocPoolsManager.cleanup();
6868

6969
delete[] properties;
7070

@@ -123,10 +123,11 @@ cl_int Context::tryGetExistingSvmAllocation(const void *ptr,
123123
if (svmEntry) {
124124
memoryType = svmEntry->memoryType;
125125
UsmMemAllocPool *pool = nullptr;
126-
if (this->getDevice(0u)->getPlatform()->getHostMemAllocPool().isInPool(ptr)) {
127-
pool = &this->getDevice(0u)->getPlatform()->getHostMemAllocPool();
128-
} else if (this->getDeviceMemAllocPool().isInPool(ptr)) {
129-
pool = &this->getDeviceMemAllocPool();
126+
if (memoryType == InternalMemoryType::hostUnifiedMemory) {
127+
UsmMemAllocPool *hostAllocPool = &this->getDevice(0u)->getPlatform()->getHostMemAllocPool();
128+
pool = hostAllocPool->isInPool(ptr) ? hostAllocPool : nullptr;
129+
} else if (memoryType == InternalMemoryType::deviceUnifiedMemory) {
130+
pool = this->getDeviceMemAllocPoolsManager().getPoolContainingAlloc(ptr);
130131
}
131132
if (pool) {
132133
size_t pooledSize = pool->getPooledAllocationSize(ptr);
@@ -524,23 +525,18 @@ void Context::initializeDeviceUsmAllocationPool() {
524525
}
525526

526527
auto &productHelper = getDevices()[0]->getProductHelper();
527-
bool enabled = ApiSpecificConfig::isDeviceUsmPoolingEnabled() &&
528-
productHelper.isDeviceUsmPoolAllocatorSupported() &&
529-
DeviceFactory::isHwModeSelected();
528+
bool usmDeviceAllocPoolingEnabled = ApiSpecificConfig::isDeviceUsmPoolingEnabled() &&
529+
productHelper.isDeviceUsmPoolAllocatorSupported() &&
530+
DeviceFactory::isHwModeSelected();
530531

531-
auto usmDevicePoolParams = UsmPoolParams::getUsmPoolParams(getDevices()[0]->getGfxCoreHelper());
532532
if (debugManager.flags.EnableDeviceUsmAllocationPool.get() != -1) {
533-
enabled = debugManager.flags.EnableDeviceUsmAllocationPool.get() > 0;
534-
usmDevicePoolParams.poolSize = debugManager.flags.EnableDeviceUsmAllocationPool.get() * MemoryConstants::megaByte;
533+
usmDeviceAllocPoolingEnabled = debugManager.flags.EnableDeviceUsmAllocationPool.get() > 0;
535534
}
536-
if (enabled) {
535+
if (usmDeviceAllocPoolingEnabled) {
537536
auto subDeviceBitfields = getDeviceBitfields();
538537
auto &neoDevice = devices[0]->getDevice();
539538
subDeviceBitfields[neoDevice.getRootDeviceIndex()] = neoDevice.getDeviceBitfield();
540-
SVMAllocsManager::UnifiedMemoryProperties memoryProperties(InternalMemoryType::deviceUnifiedMemory, MemoryConstants::pageSize2M,
541-
getRootDeviceIndices(), subDeviceBitfields);
542-
memoryProperties.device = &neoDevice;
543-
usmDeviceMemAllocPool.initialize(svmMemoryManager, memoryProperties, usmDevicePoolParams.poolSize, usmDevicePoolParams.minServicedSize, usmDevicePoolParams.maxServicedSize);
539+
this->usmDeviceMemAllocPoolsManager.initialize(InternalMemoryType::deviceUnifiedMemory, rootDeviceIndices, deviceBitfields, &this->devices[0]->getDevice(), svmMemoryManager);
544540
}
545541
this->usmPoolInitialized = true;
546542
}

opencl/source/context/context.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ class Context : public BaseObject<_cl_context> {
245245
BufferPoolAllocator &getBufferPoolAllocator() {
246246
return smallBufferPoolAllocator;
247247
}
248-
UsmMemAllocPool &getDeviceMemAllocPool() {
249-
return usmDeviceMemAllocPool;
248+
UsmMemAllocPoolsFacade &getDeviceMemAllocPoolsManager() {
249+
return usmDeviceMemAllocPoolsManager;
250250
}
251251

252252
TagAllocatorBase *getMultiRootDeviceTimestampPacketAllocator();
@@ -292,7 +292,7 @@ class Context : public BaseObject<_cl_context> {
292292
StackVec<CommandQueue *, 1> specialQueues;
293293
DriverDiagnostics *driverDiagnostics = nullptr;
294294
BufferPoolAllocator smallBufferPoolAllocator;
295-
UsmDeviceMemAllocPool usmDeviceMemAllocPool;
295+
UsmMemAllocPoolsFacade usmDeviceMemAllocPoolsManager;
296296

297297
uint32_t maxRootDeviceIndex = std::numeric_limits<uint32_t>::max();
298298
cl_bool preferD3dSharedResources = 0u;

opencl/test/unit_test/api/cl_set_kernel_arg_svm_pointer_tests.inl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "shared/source/unified_memory/usm_memory_support.h"
1010
#include "shared/test/common/helpers/debug_manager_state_restore.h"
1111
#include "shared/test/common/mocks/mock_svm_manager.h"
12+
#include "shared/test/common/mocks/mock_usm_memory_pool.h"
1213
#include "shared/test/common/test_macros/test.h"
1314

1415
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
@@ -422,9 +423,12 @@ TEST_F(clSetKernelArgSVMPointerTests, givenSvmAndValidArgValueWhenAllocIdCacheHi
422423
EXPECT_EQ(CL_SUCCESS, retVal);
423424
EXPECT_EQ(++callCounter, pMockKernel->setArgSvmAllocCalls);
424425

426+
auto devicePoolsManager = static_cast<MockUsmMemAllocPoolsFacade *>(&pContext->getDeviceMemAllocPoolsManager());
427+
425428
auto expectedAllocationsCounter = 1u;
426429
expectedAllocationsCounter += pContext->getDevice(0u)->getPlatform()->getHostMemAllocPool().isInitialized() ? 1u : 0u;
427-
expectedAllocationsCounter += pContext->getDeviceMemAllocPool().isInitialized() ? 1u : 0u;
430+
expectedAllocationsCounter += devicePoolsManager->poolManager ? 3u : 0u;
431+
expectedAllocationsCounter += devicePoolsManager->pool ? 1u : 0u;
428432

429433
EXPECT_EQ(expectedAllocationsCounter, mockSvmManager->allocationsCounter);
430434
EXPECT_EQ(mockSvmManager->allocationsCounter, pMockKernel->getKernelArguments()[0].allocIdMemoryManagerCounter);

opencl/test/unit_test/api/cl_unified_shared_memory_tests.inl

Lines changed: 89 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "opencl/test/unit_test/fixtures/multi_root_device_fixture.h"
1717
#include "opencl/test/unit_test/mocks/mock_context.h"
1818
#include "opencl/test/unit_test/mocks/mock_kernel.h"
19+
#include "opencl/test/unit_test/mocks/mock_platform.h"
1920
#include "opencl/test/unit_test/mocks/ult_cl_device_factory_with_platform.h"
2021
#include "opencl/test/unit_test/test_macros/test_checks_ocl.h"
2122

@@ -702,51 +703,58 @@ TEST_F(ClUnifiedSharedMemoryTests, givenSVMAllocationPoolWhenClGetMemAllocInfoIN
702703
size_t paramValue = 0;
703704
size_t paramValueSizeRet = 0;
704705
const size_t allocationSize = 4u;
706+
auto platform = static_cast<MockPlatform *>(device->getPlatform());
707+
for (auto enablePoolManager : {false, true}) {
708+
debugManager.flags.EnableUsmAllocationPoolManager.set(enablePoolManager);
709+
platform->getHostMemAllocPool().cleanup();
710+
platform->usmPoolInitialized = false;
711+
mockContext->getDeviceMemAllocPoolsManager().cleanup();
712+
mockContext->usmPoolInitialized = false;
713+
{
714+
auto unifiedMemoryHostAllocation = clHostMemAllocINTEL(mockContext.get(), nullptr, allocationSize, 0, &retVal);
715+
auto allocationsManager = mockContext->getSVMAllocsManager();
716+
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryHostAllocation);
717+
718+
retVal = clGetMemAllocInfoINTEL(mockContext.get(), unifiedMemoryHostAllocation, CL_MEM_ALLOC_SIZE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
719+
720+
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::hostUnifiedMemory);
721+
EXPECT_EQ(allocationSize, paramValue);
722+
EXPECT_EQ(sizeof(size_t), paramValueSizeRet);
723+
EXPECT_EQ(CL_SUCCESS, retVal);
724+
725+
retVal = clGetMemAllocInfoINTEL(mockContext.get(), ptrOffset(unifiedMemoryHostAllocation, allocationSize - 1), CL_MEM_ALLOC_SIZE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
726+
727+
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::hostUnifiedMemory);
728+
EXPECT_EQ(allocationSize, paramValue);
729+
EXPECT_EQ(sizeof(size_t), paramValueSizeRet);
730+
EXPECT_EQ(CL_SUCCESS, retVal);
731+
732+
retVal = clMemFreeINTEL(mockContext.get(), unifiedMemoryHostAllocation);
733+
EXPECT_EQ(CL_SUCCESS, retVal);
734+
}
705735

706-
{
707-
auto unifiedMemoryHostAllocation = clHostMemAllocINTEL(mockContext.get(), nullptr, allocationSize, 0, &retVal);
708-
auto allocationsManager = mockContext->getSVMAllocsManager();
709-
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryHostAllocation);
710-
711-
retVal = clGetMemAllocInfoINTEL(mockContext.get(), unifiedMemoryHostAllocation, CL_MEM_ALLOC_SIZE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
712-
713-
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::hostUnifiedMemory);
714-
EXPECT_EQ(allocationSize, paramValue);
715-
EXPECT_EQ(sizeof(size_t), paramValueSizeRet);
716-
EXPECT_EQ(CL_SUCCESS, retVal);
717-
718-
retVal = clGetMemAllocInfoINTEL(mockContext.get(), ptrOffset(unifiedMemoryHostAllocation, allocationSize - 1), CL_MEM_ALLOC_SIZE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
719-
720-
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::hostUnifiedMemory);
721-
EXPECT_EQ(allocationSize, paramValue);
722-
EXPECT_EQ(sizeof(size_t), paramValueSizeRet);
723-
EXPECT_EQ(CL_SUCCESS, retVal);
724-
725-
retVal = clMemFreeINTEL(mockContext.get(), unifiedMemoryHostAllocation);
726-
EXPECT_EQ(CL_SUCCESS, retVal);
727-
}
736+
{
737+
auto unifiedMemoryDeviceAllocation = clDeviceMemAllocINTEL(mockContext.get(), device, nullptr, 4, 0, &retVal);
738+
auto allocationsManager = mockContext->getSVMAllocsManager();
739+
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryDeviceAllocation);
728740

729-
{
730-
auto unifiedMemoryDeviceAllocation = clDeviceMemAllocINTEL(mockContext.get(), device, nullptr, 4, 0, &retVal);
731-
auto allocationsManager = mockContext->getSVMAllocsManager();
732-
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryDeviceAllocation);
741+
retVal = clGetMemAllocInfoINTEL(mockContext.get(), unifiedMemoryDeviceAllocation, CL_MEM_ALLOC_SIZE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
733742

734-
retVal = clGetMemAllocInfoINTEL(mockContext.get(), unifiedMemoryDeviceAllocation, CL_MEM_ALLOC_SIZE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
743+
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::deviceUnifiedMemory);
744+
EXPECT_EQ(allocationSize, paramValue);
745+
EXPECT_EQ(sizeof(size_t), paramValueSizeRet);
746+
EXPECT_EQ(CL_SUCCESS, retVal);
735747

736-
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::deviceUnifiedMemory);
737-
EXPECT_EQ(allocationSize, paramValue);
738-
EXPECT_EQ(sizeof(size_t), paramValueSizeRet);
739-
EXPECT_EQ(CL_SUCCESS, retVal);
748+
retVal = clGetMemAllocInfoINTEL(mockContext.get(), ptrOffset(unifiedMemoryDeviceAllocation, allocationSize - 1), CL_MEM_ALLOC_SIZE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
740749

741-
retVal = clGetMemAllocInfoINTEL(mockContext.get(), ptrOffset(unifiedMemoryDeviceAllocation, allocationSize - 1), CL_MEM_ALLOC_SIZE_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
750+
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::deviceUnifiedMemory);
751+
EXPECT_EQ(allocationSize, paramValue);
752+
EXPECT_EQ(sizeof(size_t), paramValueSizeRet);
753+
EXPECT_EQ(CL_SUCCESS, retVal);
742754

743-
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::deviceUnifiedMemory);
744-
EXPECT_EQ(allocationSize, paramValue);
745-
EXPECT_EQ(sizeof(size_t), paramValueSizeRet);
746-
EXPECT_EQ(CL_SUCCESS, retVal);
747-
748-
retVal = clMemFreeINTEL(mockContext.get(), unifiedMemoryDeviceAllocation);
749-
EXPECT_EQ(CL_SUCCESS, retVal);
755+
retVal = clMemFreeINTEL(mockContext.get(), unifiedMemoryDeviceAllocation);
756+
EXPECT_EQ(CL_SUCCESS, retVal);
757+
}
750758
}
751759
}
752760

@@ -762,50 +770,59 @@ TEST_F(ClUnifiedSharedMemoryTests, givenSVMAllocationPoolWhenClGetMemAllocInfoIN
762770
uint64_t paramValue = 0;
763771
size_t paramValueSizeRet = 0;
764772

765-
{
766-
auto unifiedMemoryHostAllocation = clHostMemAllocINTEL(mockContext.get(), nullptr, 4, 0, &retVal);
767-
auto allocationsManager = mockContext->getSVMAllocsManager();
768-
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryHostAllocation);
773+
auto platform = static_cast<MockPlatform *>(device->getPlatform());
774+
for (auto enablePoolManager : {false, true}) {
775+
debugManager.flags.EnableUsmAllocationPoolManager.set(enablePoolManager);
776+
platform->getHostMemAllocPool().cleanup();
777+
platform->usmPoolInitialized = false;
778+
mockContext->getDeviceMemAllocPoolsManager().cleanup();
779+
mockContext->usmPoolInitialized = false;
769780

770-
retVal = clGetMemAllocInfoINTEL(mockContext.get(), unifiedMemoryHostAllocation, CL_MEM_ALLOC_BASE_PTR_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
781+
{
782+
auto unifiedMemoryHostAllocation = clHostMemAllocINTEL(mockContext.get(), nullptr, 4, 0, &retVal);
783+
auto allocationsManager = mockContext->getSVMAllocsManager();
784+
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryHostAllocation);
771785

772-
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::hostUnifiedMemory);
773-
EXPECT_EQ(unifiedMemoryHostAllocation, addrToPtr(paramValue));
774-
EXPECT_EQ(sizeof(uint64_t), paramValueSizeRet);
775-
EXPECT_EQ(CL_SUCCESS, retVal);
786+
retVal = clGetMemAllocInfoINTEL(mockContext.get(), unifiedMemoryHostAllocation, CL_MEM_ALLOC_BASE_PTR_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
776787

777-
retVal = clGetMemAllocInfoINTEL(mockContext.get(), ptrOffset(unifiedMemoryHostAllocation, 3), CL_MEM_ALLOC_BASE_PTR_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
788+
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::hostUnifiedMemory);
789+
EXPECT_EQ(unifiedMemoryHostAllocation, addrToPtr(paramValue));
790+
EXPECT_EQ(sizeof(uint64_t), paramValueSizeRet);
791+
EXPECT_EQ(CL_SUCCESS, retVal);
778792

779-
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::hostUnifiedMemory);
780-
EXPECT_EQ(unifiedMemoryHostAllocation, addrToPtr(paramValue));
781-
EXPECT_EQ(sizeof(uint64_t), paramValueSizeRet);
782-
EXPECT_EQ(CL_SUCCESS, retVal);
793+
retVal = clGetMemAllocInfoINTEL(mockContext.get(), ptrOffset(unifiedMemoryHostAllocation, 3), CL_MEM_ALLOC_BASE_PTR_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
783794

784-
retVal = clMemFreeINTEL(mockContext.get(), unifiedMemoryHostAllocation);
785-
EXPECT_EQ(CL_SUCCESS, retVal);
786-
}
795+
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::hostUnifiedMemory);
796+
EXPECT_EQ(unifiedMemoryHostAllocation, addrToPtr(paramValue));
797+
EXPECT_EQ(sizeof(uint64_t), paramValueSizeRet);
798+
EXPECT_EQ(CL_SUCCESS, retVal);
787799

788-
{
789-
auto unifiedMemoryDeviceAllocation = clDeviceMemAllocINTEL(mockContext.get(), device, nullptr, 4, 0, &retVal);
790-
auto allocationsManager = mockContext->getSVMAllocsManager();
791-
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryDeviceAllocation);
800+
retVal = clMemFreeINTEL(mockContext.get(), unifiedMemoryHostAllocation);
801+
EXPECT_EQ(CL_SUCCESS, retVal);
802+
}
792803

793-
retVal = clGetMemAllocInfoINTEL(mockContext.get(), unifiedMemoryDeviceAllocation, CL_MEM_ALLOC_BASE_PTR_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
804+
{
805+
auto unifiedMemoryDeviceAllocation = clDeviceMemAllocINTEL(mockContext.get(), device, nullptr, 4, 0, &retVal);
806+
auto allocationsManager = mockContext->getSVMAllocsManager();
807+
auto graphicsAllocation = allocationsManager->getSVMAlloc(unifiedMemoryDeviceAllocation);
794808

795-
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::deviceUnifiedMemory);
796-
EXPECT_EQ(unifiedMemoryDeviceAllocation, addrToPtr(paramValue));
797-
EXPECT_EQ(sizeof(uint64_t), paramValueSizeRet);
798-
EXPECT_EQ(CL_SUCCESS, retVal);
809+
retVal = clGetMemAllocInfoINTEL(mockContext.get(), unifiedMemoryDeviceAllocation, CL_MEM_ALLOC_BASE_PTR_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
799810

800-
retVal = clGetMemAllocInfoINTEL(mockContext.get(), ptrOffset(unifiedMemoryDeviceAllocation, 3), CL_MEM_ALLOC_BASE_PTR_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
811+
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::deviceUnifiedMemory);
812+
EXPECT_EQ(unifiedMemoryDeviceAllocation, addrToPtr(paramValue));
813+
EXPECT_EQ(sizeof(uint64_t), paramValueSizeRet);
814+
EXPECT_EQ(CL_SUCCESS, retVal);
801815

802-
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::deviceUnifiedMemory);
803-
EXPECT_EQ(unifiedMemoryDeviceAllocation, addrToPtr(paramValue));
804-
EXPECT_EQ(sizeof(uint64_t), paramValueSizeRet);
805-
EXPECT_EQ(CL_SUCCESS, retVal);
816+
retVal = clGetMemAllocInfoINTEL(mockContext.get(), ptrOffset(unifiedMemoryDeviceAllocation, 3), CL_MEM_ALLOC_BASE_PTR_INTEL, paramValueSize, &paramValue, &paramValueSizeRet);
806817

807-
retVal = clMemFreeINTEL(mockContext.get(), unifiedMemoryDeviceAllocation);
808-
EXPECT_EQ(CL_SUCCESS, retVal);
818+
EXPECT_EQ(graphicsAllocation->memoryType, InternalMemoryType::deviceUnifiedMemory);
819+
EXPECT_EQ(unifiedMemoryDeviceAllocation, addrToPtr(paramValue));
820+
EXPECT_EQ(sizeof(uint64_t), paramValueSizeRet);
821+
EXPECT_EQ(CL_SUCCESS, retVal);
822+
823+
retVal = clMemFreeINTEL(mockContext.get(), unifiedMemoryDeviceAllocation);
824+
EXPECT_EQ(CL_SUCCESS, retVal);
825+
}
809826
}
810827
}
811828

0 commit comments

Comments
 (0)