mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-08 22:12:59 +08:00
Revert "performance(ocl): enable usm pool allocator"
This reverts commit 7bc8424a69.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
c4278095c8
commit
5535ef3049
@@ -4996,6 +4996,9 @@ cl_int CL_API_CALL clSetKernelArgSVMPointer(cl_kernel kernel,
|
||||
const auto allocationsCounter = svmManager->allocationsCounter.load();
|
||||
if (allocationsCounter > 0) {
|
||||
if (allocationsCounter == multiDeviceKernel->getKernelArguments()[argIndex].allocIdMemoryManagerCounter) {
|
||||
// manager count is not being incremented when allocation is from pool
|
||||
// 1) add check for allocation from pool
|
||||
// 2) increment when allocation is from pool
|
||||
reuseFromCache = true;
|
||||
} else {
|
||||
const auto svmData = svmManager->getSVMAlloc(argValue);
|
||||
|
||||
@@ -495,7 +495,7 @@ void Context::initializeUsmAllocationPools() {
|
||||
return;
|
||||
}
|
||||
|
||||
bool enabled = true;
|
||||
bool enabled = false;
|
||||
size_t poolSize = 2 * MemoryConstants::megaByte;
|
||||
if (debugManager.flags.EnableDeviceUsmAllocationPool.get() != -1) {
|
||||
enabled = debugManager.flags.EnableDeviceUsmAllocationPool.get() > 0;
|
||||
@@ -511,7 +511,7 @@ void Context::initializeUsmAllocationPools() {
|
||||
usmDeviceMemAllocPool.initialize(svmMemoryManager, memoryProperties, poolSize);
|
||||
}
|
||||
|
||||
enabled = true;
|
||||
enabled = false;
|
||||
poolSize = 2 * MemoryConstants::megaByte;
|
||||
if (debugManager.flags.EnableHostUsmAllocationPool.get() != -1) {
|
||||
enabled = debugManager.flags.EnableHostUsmAllocationPool.get() > 0;
|
||||
|
||||
@@ -218,15 +218,11 @@ 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
|
||||
@@ -276,7 +272,7 @@ TEST_F(clSetKernelArgSVMPointerTests, givenSvmAndValidArgValueWhenSettingSameKer
|
||||
++mockSvmManager->allocationsCounter;
|
||||
|
||||
// different allocId - called
|
||||
pMockKernel->kernelArguments[0].allocId = svmData->getAllocId() + 1;
|
||||
pMockKernel->kernelArguments[0].allocId = 2;
|
||||
retVal = clSetKernelArgSVMPointer(
|
||||
pMockMultiDeviceKernel, // cl_kernel kernel
|
||||
0, // cl_uint arg_index
|
||||
@@ -286,16 +282,15 @@ TEST_F(clSetKernelArgSVMPointerTests, givenSvmAndValidArgValueWhenSettingSameKer
|
||||
EXPECT_EQ(++callCounter, pMockKernel->setArgSvmAllocCalls);
|
||||
++mockSvmManager->allocationsCounter;
|
||||
|
||||
// allocation counter incremented - not called
|
||||
EXPECT_NE(mockSvmManager->allocationsCounter, kernelArgument.allocIdMemoryManagerCounter);
|
||||
// allocId = 3 - called
|
||||
pMockKernel->kernelArguments[0].allocId = 3;
|
||||
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(mockSvmManager->allocationsCounter, kernelArgument.allocIdMemoryManagerCounter);
|
||||
EXPECT_EQ(++callCounter, pMockKernel->setArgSvmAllocCalls);
|
||||
++mockSvmManager->allocationsCounter;
|
||||
|
||||
// same values - not called
|
||||
|
||||
@@ -32,7 +32,6 @@ 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,15 +41,13 @@ struct ContextUsmPoolFlagValuesTest : public ::testing::Test {
|
||||
using ContextUsmPoolDefaultFlagsTest = ContextUsmPoolFlagValuesTest<-1, -1>;
|
||||
|
||||
TEST_F(ContextUsmPoolDefaultFlagsTest, givenDefaultDebugFlagsWhenCreatingContextThenPoolsAreNotInitialized) {
|
||||
EXPECT_TRUE(mockDeviceUsmMemAllocPool->isInitialized());
|
||||
EXPECT_EQ(2 * MemoryConstants::megaByte, mockDeviceUsmMemAllocPool->poolSize);
|
||||
EXPECT_NE(nullptr, mockDeviceUsmMemAllocPool->pool);
|
||||
EXPECT_EQ(InternalMemoryType::deviceUnifiedMemory, mockDeviceUsmMemAllocPool->poolMemoryType);
|
||||
EXPECT_FALSE(mockDeviceUsmMemAllocPool->isInitialized());
|
||||
EXPECT_EQ(0u, mockDeviceUsmMemAllocPool->poolSize);
|
||||
EXPECT_EQ(nullptr, mockDeviceUsmMemAllocPool->pool);
|
||||
|
||||
EXPECT_TRUE(mockHostUsmMemAllocPool->isInitialized());
|
||||
EXPECT_EQ(2 * MemoryConstants::megaByte, mockHostUsmMemAllocPool->poolSize);
|
||||
EXPECT_NE(nullptr, mockHostUsmMemAllocPool->pool);
|
||||
EXPECT_EQ(InternalMemoryType::hostUnifiedMemory, mockHostUsmMemAllocPool->poolMemoryType);
|
||||
EXPECT_FALSE(mockHostUsmMemAllocPool->isInitialized());
|
||||
EXPECT_EQ(0u, mockHostUsmMemAllocPool->poolSize);
|
||||
EXPECT_EQ(nullptr, mockHostUsmMemAllocPool->pool);
|
||||
}
|
||||
|
||||
using ContextUsmPoolEnabledFlagsTest = ContextUsmPoolFlagValuesTest<1, 3>;
|
||||
|
||||
@@ -52,7 +52,6 @@ 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