mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 07:14:10 +08:00
performance(ocl): enable usm pool allocator
Enable opencl usm pool allocator by default Related-To: NEO-9700 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
aec6b2b46a
commit
7bc8424a69
@@ -218,11 +218,15 @@ TEST_F(clSetKernelArgSVMPointerTests, givenSvmAndValidArgValueWhenSettingSameKer
|
||||
if (devInfo.svmCapabilities != 0) {
|
||||
auto mockSvmManager = reinterpret_cast<MockSVMAllocsManager *>(pMockKernel->getContext().getSVMAllocsManager());
|
||||
EXPECT_EQ(0u, pMockKernel->setArgSvmAllocCalls);
|
||||
mockSvmManager->allocationsCounter = 0u;
|
||||
void *const ptrSvm = clSVMAlloc(pContext, CL_MEM_READ_WRITE, 256, 4);
|
||||
mockSvmManager->allocationsCounter = 0u;
|
||||
EXPECT_NE(nullptr, ptrSvm);
|
||||
auto svmData = mockSvmManager->getSVMAlloc(ptrSvm);
|
||||
EXPECT_NE(nullptr, svmData);
|
||||
auto &kernelArgument = pMockMultiDeviceKernel->getKernelArguments()[0];
|
||||
auto callCounter = 0u;
|
||||
// first set arg - called
|
||||
mockSvmManager->allocationsCounter = 0u;
|
||||
auto retVal = clSetKernelArgSVMPointer(
|
||||
pMockMultiDeviceKernel, // cl_kernel kernel
|
||||
0, // cl_uint arg_index
|
||||
@@ -272,7 +276,7 @@ TEST_F(clSetKernelArgSVMPointerTests, givenSvmAndValidArgValueWhenSettingSameKer
|
||||
++mockSvmManager->allocationsCounter;
|
||||
|
||||
// different allocId - called
|
||||
pMockKernel->kernelArguments[0].allocId = 2;
|
||||
pMockKernel->kernelArguments[0].allocId = svmData->getAllocId() + 1;
|
||||
retVal = clSetKernelArgSVMPointer(
|
||||
pMockMultiDeviceKernel, // cl_kernel kernel
|
||||
0, // cl_uint arg_index
|
||||
@@ -282,15 +286,16 @@ TEST_F(clSetKernelArgSVMPointerTests, givenSvmAndValidArgValueWhenSettingSameKer
|
||||
EXPECT_EQ(++callCounter, pMockKernel->setArgSvmAllocCalls);
|
||||
++mockSvmManager->allocationsCounter;
|
||||
|
||||
// allocId = 3 - called
|
||||
pMockKernel->kernelArguments[0].allocId = 3;
|
||||
// allocation counter incremented - not called
|
||||
EXPECT_NE(mockSvmManager->allocationsCounter, kernelArgument.allocIdMemoryManagerCounter);
|
||||
retVal = clSetKernelArgSVMPointer(
|
||||
pMockMultiDeviceKernel, // cl_kernel kernel
|
||||
0, // cl_uint arg_index
|
||||
nextPtrSvm // const void *arg_value
|
||||
);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
EXPECT_EQ(++callCounter, pMockKernel->setArgSvmAllocCalls);
|
||||
EXPECT_EQ(callCounter, pMockKernel->setArgSvmAllocCalls);
|
||||
EXPECT_EQ(mockSvmManager->allocationsCounter, kernelArgument.allocIdMemoryManagerCounter);
|
||||
++mockSvmManager->allocationsCounter;
|
||||
|
||||
// same values - not called
|
||||
|
||||
@@ -32,6 +32,7 @@ TEST_F(ContextFailureInjection, GivenFailedAllocationInjectionWhenCreatingContex
|
||||
debugManager.flags.ExperimentalSmallBufferPoolAllocator.set(0); // failing to allocate pool buffer is non-critical
|
||||
debugManager.flags.SetAmountOfReusableAllocationsPerCmdQueue.set(0); // same for preallocations
|
||||
debugManager.flags.EnableDeviceUsmAllocationPool.set(0); // usm device allocation pooling
|
||||
debugManager.flags.EnableHostUsmAllocationPool.set(0); // usm host allocation pooling
|
||||
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
cl_device_id deviceID = device.get();
|
||||
|
||||
|
||||
@@ -41,13 +41,15 @@ struct ContextUsmPoolFlagValuesTest : public ::testing::Test {
|
||||
using ContextUsmPoolDefaultFlagsTest = ContextUsmPoolFlagValuesTest<-1, -1>;
|
||||
|
||||
TEST_F(ContextUsmPoolDefaultFlagsTest, givenDefaultDebugFlagsWhenCreatingContextThenPoolsAreNotInitialized) {
|
||||
EXPECT_FALSE(mockDeviceUsmMemAllocPool->isInitialized());
|
||||
EXPECT_EQ(0u, mockDeviceUsmMemAllocPool->poolSize);
|
||||
EXPECT_EQ(nullptr, mockDeviceUsmMemAllocPool->pool);
|
||||
EXPECT_TRUE(mockDeviceUsmMemAllocPool->isInitialized());
|
||||
EXPECT_EQ(2 * MemoryConstants::megaByte, mockDeviceUsmMemAllocPool->poolSize);
|
||||
EXPECT_NE(nullptr, mockDeviceUsmMemAllocPool->pool);
|
||||
EXPECT_EQ(InternalMemoryType::deviceUnifiedMemory, mockDeviceUsmMemAllocPool->poolMemoryType);
|
||||
|
||||
EXPECT_FALSE(mockHostUsmMemAllocPool->isInitialized());
|
||||
EXPECT_EQ(0u, mockHostUsmMemAllocPool->poolSize);
|
||||
EXPECT_EQ(nullptr, mockHostUsmMemAllocPool->pool);
|
||||
EXPECT_TRUE(mockHostUsmMemAllocPool->isInitialized());
|
||||
EXPECT_EQ(2 * MemoryConstants::megaByte, mockHostUsmMemAllocPool->poolSize);
|
||||
EXPECT_NE(nullptr, mockHostUsmMemAllocPool->pool);
|
||||
EXPECT_EQ(InternalMemoryType::hostUnifiedMemory, mockHostUsmMemAllocPool->poolMemoryType);
|
||||
}
|
||||
|
||||
using ContextUsmPoolEnabledFlagsTest = ContextUsmPoolFlagValuesTest<1, 3>;
|
||||
|
||||
@@ -52,6 +52,7 @@ class AggregatedSmallBuffersTestTemplate : public ::testing::Test {
|
||||
void setUpImpl() {
|
||||
debugManager.flags.ExperimentalSmallBufferPoolAllocator.set(poolBufferFlag);
|
||||
debugManager.flags.EnableDeviceUsmAllocationPool.set(0);
|
||||
debugManager.flags.EnableHostUsmAllocationPool.set(0);
|
||||
this->deviceFactory = std::make_unique<UltClDeviceFactory>(2, 0);
|
||||
this->device = deviceFactory->rootDevices[rootDeviceIndex];
|
||||
this->mockMemoryManager = static_cast<MockMemoryManager *>(device->getMemoryManager());
|
||||
|
||||
Reference in New Issue
Block a user