Revert "fix: set properly resource params when setAllocationType"

This reverts commit 2e0884a301.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation 2024-08-24 04:39:40 +02:00 committed by Compute-Runtime-Automation
parent 8d32a3a3ad
commit 956dd8e17d
35 changed files with 124 additions and 196 deletions

View File

@ -803,7 +803,7 @@ TEST_F(KernelImmutableDataTests, givenInternalModuleWhenKernelIsCreatedThenIsaIs
bool isInternal = true;
std::unique_ptr<MockImmutableData> mockKernelImmData = std::make_unique<MockImmutableData>(perHwThreadPrivateMemorySizeRequested);
mockKernelImmData->getIsaGraphicsAllocation()->setAllocationType(AllocationType::kernelIsaInternal, device->getProductHelper());
mockKernelImmData->getIsaGraphicsAllocation()->setAllocationType(AllocationType::kernelIsaInternal);
size_t previouscopyMemoryToAllocationCalledTimes =
mockMemoryManager->copyMemoryToAllocationCalledTimes;
@ -878,7 +878,7 @@ TEST_P(KernelIsaCopyingMomentTest, givenInternalModuleWhenKernelIsCreatedThenIsa
kernelMock.immutableData.kernelInfo = kernelInfo;
kernelMock.immutableData.surfaceStateHeapSize = 64;
kernelMock.immutableData.surfaceStateHeapTemplate.reset(new uint8_t[64]);
kernelMock.immutableData.getIsaGraphicsAllocation()->setAllocationType(AllocationType::kernelIsaInternal, device->getProductHelper());
kernelMock.immutableData.getIsaGraphicsAllocation()->setAllocationType(AllocationType::kernelIsaInternal);
kernelInfo->kernelDescriptor.payloadMappings.implicitArgs.systemThreadSurfaceAddress.bindful = 0;
moduleMock->translationUnit->programInfo.kernelInfos.push_back(kernelInfo);

View File

@ -476,7 +476,7 @@ Buffer *Buffer::create(Context *context,
allocationInfo.allocationType = AllocationType::bufferHostMemory;
}
allocationInfo.memory->setAllocationType(allocationInfo.allocationType, defaultDevice->getProductHelper());
allocationInfo.memory->setAllocationType(allocationInfo.allocationType);
auto isWritable = !(memoryProperties.flags.readOnly || memoryProperties.flags.hostReadOnly || memoryProperties.flags.hostNoAccess);
allocationInfo.memory->setMemObjectsAllocationWithWritableFlags(isWritable);

View File

@ -268,7 +268,7 @@ Image *Image::create(Context *context,
}
if (parentBuffer == nullptr) {
allocationInfo.memory->setAllocationType(AllocationType::image, defaultDevice->getProductHelper());
allocationInfo.memory->setAllocationType(AllocationType::image);
}
if (parentImage) {

View File

@ -99,7 +99,7 @@ void CompressionXeHPAndLater<testLocalMemory>::givenCompressedBuffersWhenWriting
auto notCompressedBuffer = std::unique_ptr<Buffer>(Buffer::create(context, CL_MEM_READ_WRITE, bufferSize, nullptr, retVal));
auto nonCompressedAllocation = notCompressedBuffer->getGraphicsAllocation(device->getRootDeviceIndex());
nonCompressedAllocation->setAllocationType(AllocationType::buffer, device->getProductHelper());
nonCompressedAllocation->setAllocationType(AllocationType::buffer);
if (nonCompressedAllocation->getDefaultGmm()) {
nonCompressedAllocation->getDefaultGmm()->setCompressionEnabled(false);
}

View File

@ -18,7 +18,7 @@ GraphicsAllocation *AUBFixture::createHostPtrAllocationFromSvmPtr(void *svmPtr,
GraphicsAllocation *allocation = csr->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), false, size}, svmPtr);
csr->makeResidentHostPtrAllocation(allocation);
csr->getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(allocation), TEMPORARY_ALLOCATION);
allocation->setAllocationType(AllocationType::buffer, csr->getProductHelper());
allocation->setAllocationType(AllocationType::buffer);
allocation->setMemObjectsAllocationWithWritableFlags(true);
return allocation;
}

View File

@ -73,7 +73,7 @@ struct SimpleArgFixture : public FixtureFactory::IndirectHeapFixture,
outBuffer = AUBCommandStreamFixture::createResidentAllocationAndStoreItInCsr(pDestMemory, sizeUserMemory);
ASSERT_NE(nullptr, outBuffer);
outBuffer->setAllocationType(AllocationType::buffer, pClDevice->getProductHelper());
outBuffer->setAllocationType(AllocationType::buffer);
outBuffer->setMemObjectsAllocationWithWritableFlags(true);
}

View File

@ -289,9 +289,9 @@ TEST_F(BuiltInTests, GivenCopyBufferToSystemMemoryBufferWhenDispatchInfoIsCreate
MockBuffer &src = *srcPtr;
MockBuffer &dst = *dstPtr;
auto &productHelper = pDevice->getProductHelper();
srcPtr->mockGfxAllocation.setAllocationType(AllocationType::buffer, productHelper);
dstPtr->mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
srcPtr->mockGfxAllocation.setAllocationType(AllocationType::buffer);
dstPtr->mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory);
BuiltinOpParams builtinOpsParams;
@ -356,9 +356,9 @@ TEST_F(BuiltInTests, GivenCopyBufferToLocalMemoryBufferWhenDispatchInfoIsCreated
MockBuffer &src = *srcPtr;
MockBuffer &dst = *dstPtr;
auto &productHelper = pDevice->getProductHelper();
srcPtr->mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
dstPtr->mockGfxAllocation.setAllocationType(AllocationType::buffer, productHelper);
srcPtr->mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory);
dstPtr->mockGfxAllocation.setAllocationType(AllocationType::buffer);
BuiltinOpParams builtinOpsParams;
@ -922,9 +922,9 @@ TEST_F(BuiltInTests, givenBigOffsetAndSizeWhenBuilderCopyBufferToSystemBufferRec
srcBuffer.size = static_cast<size_t>(bigSize);
MockBuffer dstBuffer;
dstBuffer.size = static_cast<size_t>(bigSize);
auto &productHelper = pDevice->getProductHelper();
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer, productHelper);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory);
BuiltinOpParams dc;
dc.srcMemObj = &srcBuffer;
@ -963,9 +963,8 @@ TEST_F(BuiltInTests, givenBigOffsetAndSizeWhenBuilderCopyBufferToLocalBufferRect
MockBuffer dstBuffer;
dstBuffer.size = static_cast<size_t>(bigSize);
auto &productHelper = pDevice->getProductHelper();
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer, productHelper);
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer);
BuiltinOpParams dc;
dc.srcMemObj = &srcBuffer;
@ -1004,9 +1003,8 @@ TEST_F(BuiltInTests, givenBigOffsetAndSizeWhenBuilderFillSystemBufferStatelessIs
MockBuffer dstBuffer;
dstBuffer.size = static_cast<size_t>(bigSize);
auto &productHelper = pDevice->getProductHelper();
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer, productHelper);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory);
BuiltinOpParams dc;
dc.srcMemObj = &srcBuffer;
@ -1040,9 +1038,8 @@ TEST_F(BuiltInTests, givenBigOffsetAndSizeWhenBuilderFillLocalBufferStatelessIsU
MockBuffer dstBuffer;
dstBuffer.size = static_cast<size_t>(bigSize);
auto &productHelper = pDevice->getProductHelper();
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer, productHelper);
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer);
BuiltinOpParams dc;
dc.srcMemObj = &srcBuffer;
@ -1104,7 +1101,7 @@ HWTEST_F(BuiltInTests, givenBigOffsetAndSizeWhenBuilderCopyImageToSystemBufferSt
MockBuffer dstBuffer;
dstBuffer.size = static_cast<size_t>(bigSize);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory, pDevice->getProductHelper());
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory);
std ::unique_ptr<Image> pSrcImage(Image2dHelper<>::create(pContext));
ASSERT_NE(nullptr, pSrcImage.get());
@ -1142,7 +1139,7 @@ HWTEST_F(BuiltInTests, givenBigOffsetAndSizeWhenBuilderCopyImageToLocalBufferSta
MockBuffer dstBuffer;
dstBuffer.size = static_cast<size_t>(bigSize);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer, pDevice->getProductHelper());
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer);
std ::unique_ptr<Image> pSrcImage(Image2dHelper<>::create(pContext));
ASSERT_NE(nullptr, pSrcImage.get());
@ -2471,9 +2468,8 @@ HWTEST2_F(BuiltInTests, whenBuilderCopyBufferToSystemBufferRectStatelessHeapless
MockBuffer dstBuffer;
dstBuffer.size = static_cast<size_t>(bigSize);
const auto &productHelper = pDevice->getRootDeviceEnvironment().getHelper<ProductHelper>();
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer, productHelper);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory);
BuiltinOpParams dc;
dc.srcMemObj = &srcBuffer;
@ -2511,9 +2507,9 @@ HWTEST2_F(BuiltInTests, whenBuilderCopyBufferToLocalBufferRectStatelessHeaplessI
srcBuffer.size = static_cast<size_t>(bigSize);
MockBuffer dstBuffer;
dstBuffer.size = static_cast<size_t>(bigSize);
const auto &productHelper = pDevice->getRootDeviceEnvironment().getHelper<ProductHelper>();
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer, productHelper);
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer);
BuiltinOpParams dc;
dc.srcMemObj = &srcBuffer;
@ -2551,9 +2547,9 @@ HWTEST2_F(BuiltInTests, whenBuilderFillSystemBufferStatelessHeaplessIsUsedThenPa
srcBuffer.size = static_cast<size_t>(bigSize);
MockBuffer dstBuffer;
dstBuffer.size = static_cast<size_t>(bigSize);
const auto &productHelper = pDevice->getRootDeviceEnvironment().getHelper<ProductHelper>();
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer, productHelper);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory);
BuiltinOpParams dc;
dc.srcMemObj = &srcBuffer;
@ -2586,9 +2582,9 @@ HWTEST2_F(BuiltInTests, whenBuilderFillLocalBufferStatelessHeaplessIsUsedThenPar
srcBuffer.size = static_cast<size_t>(bigSize);
MockBuffer dstBuffer;
dstBuffer.size = static_cast<size_t>(bigSize);
const auto &productHelper = pDevice->getRootDeviceEnvironment().getHelper<ProductHelper>();
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer, productHelper);
srcBuffer.mockGfxAllocation.setAllocationType(AllocationType::bufferHostMemory);
dstBuffer.mockGfxAllocation.setAllocationType(AllocationType::buffer);
BuiltinOpParams dc;
dc.srcMemObj = &srcBuffer;

View File

@ -164,7 +164,7 @@ struct BlitEnqueueTests : public ::testing::Test {
}
void setAllocationType(GraphicsAllocation *graphicsAllocation, bool compressed) {
graphicsAllocation->setAllocationType(AllocationType::buffer, device->getProductHelper());
graphicsAllocation->setAllocationType(AllocationType::buffer);
if (compressed && !graphicsAllocation->getDefaultGmm()) {
auto gmmHelper = device->getRootDeviceEnvironment().getGmmHelper();

View File

@ -1442,7 +1442,7 @@ HWTEST_F(CommandQueueHwTest, givenDirectSubmissionAndSharedDisplayableImageWhenR
auto image = std::unique_ptr<Image>(ImageHelper<Image2dDefaults>::create(context));
image->setSharingHandler(mockSharingHandler);
image->getGraphicsAllocation(0u)->setAllocationType(AllocationType::sharedImage, pClDevice->getProductHelper());
image->getGraphicsAllocation(0u)->setAllocationType(AllocationType::sharedImage);
cl_mem memObject = image.get();
cl_uint numObjects = 1;

View File

@ -1321,7 +1321,7 @@ HWTEST_F(CommandQueueTests, givenEnqueuesForSharedObjectsWithImageWhenUsingShari
auto image = std::unique_ptr<Image>(ImageHelper<Image2dDefaults>::create(&context));
image->setSharingHandler(mockSharingHandler);
image->getGraphicsAllocation(0u)->setAllocationType(AllocationType::sharedImage, context.getDevice(0)->getProductHelper());
image->getGraphicsAllocation(0u)->setAllocationType(AllocationType::sharedImage);
cl_mem memObject = image.get();
cl_uint numObjects = 1;
@ -1345,7 +1345,7 @@ HWTEST_F(CommandQueueTests, givenDirectSubmissionAndSharedImageWhenReleasingShar
auto image = std::unique_ptr<Image>(ImageHelper<Image2dDefaults>::create(&context));
image->setSharingHandler(mockSharingHandler);
image->getGraphicsAllocation(0u)->setAllocationType(AllocationType::sharedImage, context.getDevice(0)->getProductHelper());
image->getGraphicsAllocation(0u)->setAllocationType(AllocationType::sharedImage);
cl_mem memObject = image.get();
cl_uint numObjects = 1;
@ -1376,7 +1376,7 @@ HWTEST_F(CommandQueueTests, givenDcFlushMitigationAndDirectSubmissionAndBufferWh
auto buffer = std::unique_ptr<Buffer>(BufferHelper<>::create(&context));
buffer->setSharingHandler(mockSharingHandler);
buffer->getGraphicsAllocation(0u)->setAllocationType(AllocationType::sharedBuffer, context.getDevice(0)->getProductHelper());
buffer->getGraphicsAllocation(0u)->setAllocationType(AllocationType::sharedBuffer);
cl_mem memObject = buffer.get();
cl_uint numObjects = 1;

View File

@ -517,9 +517,8 @@ HWTEST_F(EnqueueSvmMemCopyTest, givenEnqueueSvmMemcpyWhenSvmZeroCopyThenBuiltinK
std::unique_ptr<NEO::BuiltinDispatchInfoBuilder>(new MockBuiltinDispatchInfoBuilder(*builtIns, pCmdQ->getClDevice(), &origBuilder)));
EXPECT_EQ(&origBuilder, oldBuilder.get());
auto &productHelper = pDevice->getProductHelper();
srcSvmAlloc->setAllocationType(NEO::AllocationType::svmZeroCopy, productHelper);
dstSvmAlloc->setAllocationType(NEO::AllocationType::svmZeroCopy, productHelper);
srcSvmAlloc->setAllocationType(NEO::AllocationType::svmZeroCopy);
dstSvmAlloc->setAllocationType(NEO::AllocationType::svmZeroCopy);
// call enqueue on mock builder
auto retVal = pCmdQ->enqueueSVMMemcpy(
@ -595,9 +594,8 @@ HWTEST_F(EnqueueSvmMemCopyTest, givenEnqueueSvmMemcpyWhenSvmGpuThenBuiltinKernel
std::unique_ptr<NEO::BuiltinDispatchInfoBuilder>(new MockBuiltinDispatchInfoBuilder(*builtIns, pCmdQ->getClDevice(), &origBuilder)));
EXPECT_EQ(&origBuilder, oldBuilder.get());
auto &productHelper = pDevice->getProductHelper();
srcSvmAlloc->setAllocationType(NEO::AllocationType::svmGpu, productHelper);
dstSvmAlloc->setAllocationType(NEO::AllocationType::svmGpu, productHelper);
srcSvmAlloc->setAllocationType(NEO::AllocationType::svmGpu);
dstSvmAlloc->setAllocationType(NEO::AllocationType::svmGpu);
// call enqueue on mock builder
auto retVal = pCmdQ->enqueueSVMMemcpy(

View File

@ -275,9 +275,7 @@ HWTEST_F(EnqueueSvmMemFillHwTest, givenEnqueueSVMMemFillWhenUsingCopyBufferToSys
auto cmdQ = std::make_unique<CommandQueueStateless<FamilyType>>(context.get(), device.get());
auto svmData = context->getSVMAllocsManager()->getSVMAlloc(svmPtr);
svmData->size = static_cast<size_t>(bigSize);
auto &productHelper = device->getProductHelper();
svmData->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex())->setAllocationType(AllocationType::svmZeroCopy, productHelper);
svmData->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex())->setAllocationType(AllocationType::svmZeroCopy);
cmdQ->validateKernelSystemMemory = true;
cmdQ->expectedKernelSystemMemory = true;
@ -300,8 +298,7 @@ HWTEST_F(EnqueueSvmMemFillHwTest, givenEnqueueSVMMemFillWhenUsingCopyBufferToLoc
GTEST_SKIP();
}
auto svmData = context->getSVMAllocsManager()->getSVMAlloc(svmPtr);
auto &productHelper = device->getProductHelper();
svmData->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex())->setAllocationType(AllocationType::svmGpu, productHelper);
svmData->gpuAllocations.getGraphicsAllocation(device->getRootDeviceIndex())->setAllocationType(AllocationType::svmGpu);
cmdQ->validateKernelSystemMemory = true;
cmdQ->expectedKernelSystemMemory = false;

View File

@ -75,8 +75,7 @@ GEN12LPTEST_F(BufferTestsTgllp, givenConstantSurfaceWhenProgrammingSurfaceStateT
nullptr,
retVal));
ASSERT_EQ(CL_SUCCESS, retVal);
auto &productHelper = device->getProductHelper();
buffer->getGraphicsAllocation(0)->setAllocationType(AllocationType::constantSurface, productHelper);
buffer->getGraphicsAllocation(0)->setAllocationType(AllocationType::constantSurface);
typename FamilyType::RENDER_SURFACE_STATE surfaceState = {};
buffer->setArgStateful(&surfaceState, false, false, false, false, context->getDevice(0)->getDevice(), false);

View File

@ -275,8 +275,7 @@ GEN12LPTEST_F(GfxCoreHelperTestsGen12LpBuffer, givenBufferThenCheckResourceCompa
buffer.reset(Buffer::create(context.get(), 0, MemoryConstants::cacheLineSize, nullptr, retVal));
auto &productHelper = device->getProductHelper();
buffer->getGraphicsAllocation(rootDeviceIndex)->setAllocationType(AllocationType::buffer, productHelper);
buffer->getGraphicsAllocation(rootDeviceIndex)->setAllocationType(AllocationType::buffer);
EXPECT_TRUE(gfxCoreHelper.checkResourceCompatibility(*buffer->getGraphicsAllocation(rootDeviceIndex)));
}

View File

@ -206,8 +206,7 @@ TEST_F(KernelArgBufferTest, given32BitDeviceWhenArgPassedIsNullThenOnly4BytesAre
TEST_F(KernelArgBufferTest, givenBufferWhenHasDirectStatelessAccessToHostMemoryIsCalledThenReturnFalse) {
MockBuffer buffer;
auto &productHelper = pClDevice->getProductHelper();
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::buffer, productHelper);
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::buffer);
auto val = (cl_mem)&buffer;
auto pVal = &val;
@ -224,8 +223,7 @@ TEST_F(KernelArgBufferTest, givenBufferWhenHasDirectStatelessAccessToHostMemoryI
TEST_F(KernelArgBufferTest, givenSharedBufferWhenHasDirectStatelessAccessToSharedBufferIsCalledThenReturnCorrectValue) {
MockBuffer buffer;
auto &productHelper = pClDevice->getProductHelper();
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::sharedBuffer, productHelper);
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::sharedBuffer);
auto val = (cl_mem)&buffer;
auto pVal = &val;
@ -242,8 +240,7 @@ TEST_F(KernelArgBufferTest, givenSharedBufferWhenHasDirectStatelessAccessToShare
TEST_F(KernelArgBufferTest, givenBufferInHostMemoryWhenHasDirectStatelessAccessToHostMemoryIsCalledThenReturnCorrectValue) {
MockBuffer buffer;
auto &productHelper = pClDevice->getProductHelper();
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::bufferHostMemory, productHelper);
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::bufferHostMemory);
auto val = (cl_mem)&buffer;
auto pVal = &val;
@ -267,8 +264,7 @@ TEST_F(KernelArgBufferTest, givenGfxAllocationWhenHasDirectStatelessAccessToHost
char data[128];
void *ptr = &data;
MockGraphicsAllocation gfxAllocation(ptr, 128);
auto &productHelper = pClDevice->getProductHelper();
gfxAllocation.setAllocationType(AllocationType::buffer, productHelper);
gfxAllocation.setAllocationType(AllocationType::buffer);
for (auto pureStatefulBufferAccess : {false, true}) {
pKernelInfo->setBufferStateful(0, pureStatefulBufferAccess);
@ -289,8 +285,7 @@ TEST_F(KernelArgBufferTest, givenGfxAllocationInHostMemoryWhenHasDirectStateless
char data[128];
void *ptr = &data;
MockGraphicsAllocation gfxAllocation(ptr, 128);
auto &productHelper = pClDevice->getProductHelper();
gfxAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
gfxAllocation.setAllocationType(AllocationType::bufferHostMemory);
for (auto pureStatefulBufferAccess : {false, true}) {
pKernelInfo->setBufferStateful(0, pureStatefulBufferAccess);
@ -334,9 +329,8 @@ TEST_F(KernelArgBufferTest, givenKernelWithIndirectStatelessAccessWhenHasIndirec
MockKernel kernelWithIndirectUnifiedMemoryAllocation(pProgram, kernelInfo, *pClDevice);
MockGraphicsAllocation gfxAllocation;
auto &productHelper = pClDevice->getProductHelper();
for (const auto type : allocationTypes) {
gfxAllocation.setAllocationType(type, productHelper);
gfxAllocation.setAllocationType(type);
kernelWithIndirectUnifiedMemoryAllocation.setUnifiedMemoryExecInfo(&gfxAllocation);
if (type == AllocationType::bufferHostMemory) {
EXPECT_TRUE(kernelWithIndirectUnifiedMemoryAllocation.hasIndirectStatelessAccessToHostMemory());
@ -391,8 +385,7 @@ TEST_F(KernelArgBufferTest, givenSetArgBufferOnKernelWithDirectStatelessAccessTo
debugManager.flags.EnableStatelessCompression.set(1);
MockBuffer buffer;
auto &productHelper = pClDevice->getProductHelper();
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::sharedBuffer, productHelper);
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::sharedBuffer);
auto val = (cl_mem)&buffer;
auto pVal = &val;
@ -414,8 +407,7 @@ TEST_F(KernelArgBufferTest, givenSetArgBufferOnKernelWithDirectStatelessAccessTo
debugManager.flags.EnableStatelessCompression.set(1);
MockBuffer buffer;
auto &productHelper = pClDevice->getProductHelper();
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::bufferHostMemory, productHelper);
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::bufferHostMemory);
auto val = (cl_mem)&buffer;
auto pVal = &val;
@ -465,8 +457,7 @@ TEST_F(KernelArgBufferTest, givenSetArgSvmAllocOnKernelWithDirectStatelessAccess
char data[128];
void *ptr = &data;
MockGraphicsAllocation gfxAllocation(ptr, 128);
auto &productHelper = pClDevice->getProductHelper();
gfxAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
gfxAllocation.setAllocationType(AllocationType::bufferHostMemory);
auto retVal = pKernel->setArgSvmAlloc(0, ptr, &gfxAllocation, 0u);
EXPECT_EQ(CL_SUCCESS, retVal);
@ -512,8 +503,7 @@ TEST_F(KernelArgBufferTest, givenSetUnifiedMemoryExecInfoOnKernelWithNoIndirectS
pKernelInfo->kernelDescriptor.kernelAttributes.hasIndirectStatelessAccess = false;
MockGraphicsAllocation gfxAllocation;
auto &productHelper = pClDevice->getProductHelper();
gfxAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
gfxAllocation.setAllocationType(AllocationType::bufferHostMemory);
pKernel->setUnifiedMemoryExecInfo(&gfxAllocation);
@ -536,9 +526,9 @@ TEST_F(KernelArgBufferTest, givenSetUnifiedMemoryExecInfoOnKernelWithIndirectSta
AllocationType::bufferHostMemory};
MockGraphicsAllocation gfxAllocation;
auto &productHelper = pClDevice->getProductHelper();
for (const auto type : allocationTypes) {
gfxAllocation.setAllocationType(type, productHelper);
gfxAllocation.setAllocationType(type);
pKernel->setUnifiedMemoryExecInfo(&gfxAllocation);
@ -579,9 +569,9 @@ TEST_F(KernelArgBufferTest, givenSetUnifiedMemoryExecInfoOnKernelWithIndirectSta
auto gmm = std::make_unique<Gmm>(pDevice->getRootDeviceEnvironment().getGmmHelper(), nullptr, 0, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, StorageInfo{}, gmmRequirements);
MockGraphicsAllocation gfxAllocation;
gfxAllocation.setDefaultGmm(gmm.get());
auto &productHelper = pClDevice->getProductHelper();
for (const auto type : allocationTypes) {
gfxAllocation.setAllocationType(type.allocationType, productHelper);
gfxAllocation.setAllocationType(type.allocationType);
pKernel->setUnifiedMemoryExecInfo(&gfxAllocation);
gmm->setCompressionEnabled(type.compressed);
@ -626,9 +616,9 @@ TEST_F(KernelArgBufferTest, givenSVMAllocsManagerWithCompressedSVMAllocationsWhe
SvmAllocationData allocData(0);
allocData.gpuAllocations.addAllocation(&gfxAllocation);
allocData.device = &pClDevice->getDevice();
auto &productHelper = pClDevice->getProductHelper();
for (const auto type : allocationTypes) {
gfxAllocation.setAllocationType(type.allocationType, productHelper);
gfxAllocation.setAllocationType(type.allocationType);
gmm->setCompressionEnabled(type.compressed);
@ -743,8 +733,7 @@ HWTEST_F(KernelArgBufferTestBindless, givenBindlessBuffersWhenPatchBindlessOffse
TEST_F(KernelArgBufferTest, givenBufferAsHostMemoryWhenSettingKernelArgThenKernelUsesSystemMemory) {
MockBuffer buffer;
auto &productHelper = pClDevice->getProductHelper();
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::bufferHostMemory, productHelper);
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::bufferHostMemory);
auto memVal = (cl_mem)&buffer;
auto val = &memVal;
@ -759,8 +748,7 @@ TEST_F(KernelArgBufferTest, givenBufferAsHostMemoryWhenSettingKernelArgThenKerne
TEST_F(KernelArgBufferTest, givenBufferAsDeviceMemoryWhenSettingKernelArgThenKernelNotUsesSystemMemory) {
MockBuffer buffer;
auto &productHelper = pClDevice->getProductHelper();
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::buffer, productHelper);
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::buffer);
auto memVal = (cl_mem)&buffer;
auto val = &memVal;
@ -775,8 +763,7 @@ TEST_F(KernelArgBufferTest, givenBufferAsDeviceMemoryWhenSettingKernelArgThenKer
TEST_F(KernelArgBufferTest, givenBufferAsDeviceMemoryAndKernelIsAlreadySetToUseSystemWhenSettingKernelArgThenKernelUsesSystemMemory) {
MockBuffer buffer;
auto &productHelper = pClDevice->getProductHelper();
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::buffer, productHelper);
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::buffer);
auto memVal = (cl_mem)&buffer;
auto val = &memVal;

View File

@ -714,8 +714,7 @@ TEST_F(KernelArgSvmTest, GivenZeroCopySvmPtrWhenSettingKernelArgThenKernelUsesSy
auto svmData = pContext->getSVMAllocsManager()->getSVMAlloc(alloc);
auto gpuAllocation = svmData->gpuAllocations.getGraphicsAllocation(*pContext->getRootDeviceIndices().begin());
auto &productHelper = pClDevice->getProductHelper();
gpuAllocation->setAllocationType(NEO::AllocationType::svmZeroCopy, productHelper);
gpuAllocation->setAllocationType(NEO::AllocationType::svmZeroCopy);
EXPECT_FALSE(pKernel->isAnyKernelArgumentUsingSystemMemory());
@ -741,8 +740,7 @@ TEST_F(KernelArgSvmTest, GivenGpuSvmPtrWhenSettingKernelArgThenKernelNotUsesSyst
auto svmData = pContext->getSVMAllocsManager()->getSVMAlloc(alloc);
auto gpuAllocation = svmData->gpuAllocations.getGraphicsAllocation(*pContext->getRootDeviceIndices().begin());
auto &productHelper = pClDevice->getProductHelper();
gpuAllocation->setAllocationType(NEO::AllocationType::svmGpu, productHelper);
gpuAllocation->setAllocationType(NEO::AllocationType::svmGpu);
EXPECT_FALSE(pKernel->isAnyKernelArgumentUsingSystemMemory());
@ -768,8 +766,7 @@ TEST_F(KernelArgSvmTest, GivenGpuSvmPtrAndKernelIsAlreadySetToUseSystemWhenSetti
auto svmData = pContext->getSVMAllocsManager()->getSVMAlloc(alloc);
auto gpuAllocation = svmData->gpuAllocations.getGraphicsAllocation(*pContext->getRootDeviceIndices().begin());
auto &productHelper = pClDevice->getProductHelper();
gpuAllocation->setAllocationType(NEO::AllocationType::svmGpu, productHelper);
gpuAllocation->setAllocationType(NEO::AllocationType::svmGpu);
EXPECT_FALSE(pKernel->isAnyKernelArgumentUsingSystemMemory());
pKernel->anyKernelArgumentUsingSystemMemory = true;

View File

@ -644,7 +644,7 @@ XE_HPC_CORETEST_F(ProductHelperTestXeHpcCore, givenDefaultProductHelperHwWhenGet
auto &productHelper = getHelper<ProductHelper>();
MockGraphicsAllocation allocation;
allocation.overrideMemoryPool(MemoryPool::localMemory);
allocation.setAllocationType(AllocationType::bufferHostMemory, pDevice->getProductHelper());
allocation.setAllocationType(AllocationType::bufferHostMemory);
EXPECT_FALSE(productHelper.isBlitCopyRequiredForLocalMemory(pDevice->getRootDeviceEnvironment(), allocation));
}

View File

@ -22,22 +22,6 @@
#include "shared/source/memory_manager/definitions/storage_info.h"
namespace NEO {
void Gmm::updateUsageAndCachableFlag(GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsage, const GmmRequirements &gmmRequirements) {
resourceParams.Usage = gmmResourceUsage;
this->preferNoCpuAccess = CacheSettingsHelper::preferNoCpuAccess(gmmResourceUsage, gmmHelper->getRootDeviceEnvironment());
bool cacheable = !this->preferNoCpuAccess && !CacheSettingsHelper::isUncachedType(gmmResourceUsage);
gmmRequirements.overriderPreferNoCpuAccess.doOverride(this->preferNoCpuAccess);
gmmRequirements.overriderCacheable.doOverride(cacheable);
if (NEO::debugManager.flags.OverrideGmmCacheableField.get() != -1) {
cacheable = !!NEO::debugManager.flags.OverrideGmmCacheableField.get();
}
resourceParams.Flags.Info.Cacheable = cacheable;
}
void Gmm::applyResourceInfo() {
gmmResourceInfo.reset(GmmResourceInfo::create(gmmHelper->getClientContext(), &resourceParams));
}
Gmm::Gmm(GmmHelper *gmmHelper, const void *alignedPtr, size_t alignedSize, size_t alignment, GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsage,
const StorageInfo &storageInfo, const GmmRequirements &gmmRequirements) : gmmHelper(gmmHelper) {
resourceParams.Type = RESOURCE_BUFFER;
@ -53,9 +37,20 @@ Gmm::Gmm(GmmHelper *gmmHelper, const void *alignedPtr, size_t alignedSize, size_
}
}
resourceParams.Usage = gmmResourceUsage;
resourceParams.Flags.Info.Linear = 1;
updateUsageAndCachableFlag(gmmResourceUsage, gmmRequirements);
this->preferNoCpuAccess = CacheSettingsHelper::preferNoCpuAccess(gmmResourceUsage, gmmHelper->getRootDeviceEnvironment());
bool cacheable = !this->preferNoCpuAccess && !CacheSettingsHelper::isUncachedType(gmmResourceUsage);
gmmRequirements.overriderPreferNoCpuAccess.doOverride(this->preferNoCpuAccess);
gmmRequirements.overriderCacheable.doOverride(cacheable);
if (NEO::debugManager.flags.OverrideGmmCacheableField.get() != -1) {
cacheable = !!NEO::debugManager.flags.OverrideGmmCacheableField.get();
}
resourceParams.Flags.Info.Cacheable = cacheable;
resourceParams.Flags.Gpu.Texture = 1;
@ -76,7 +71,7 @@ Gmm::Gmm(GmmHelper *gmmHelper, const void *alignedPtr, size_t alignedSize, size_
applyAppResource(storageInfo);
applyDebugOverrides();
applyResourceInfo();
gmmResourceInfo.reset(GmmResourceInfo::create(gmmHelper->getClientContext(), &resourceParams));
}
Gmm::Gmm(GmmHelper *gmmHelper, GMM_RESOURCE_INFO *inputGmm) : Gmm(gmmHelper, inputGmm, false) {}

View File

@ -53,7 +53,6 @@ class Gmm {
void applyAuxFlagsForBuffer(bool preferCompression);
void applyMemoryFlags(const StorageInfo &storageInfo);
void applyAppResource(const StorageInfo &storageInfo);
void applyResourceInfo();
bool unifiedAuxTranslationCapable() const;
bool hasMultisampleControlSurface() const;
@ -63,7 +62,6 @@ class Gmm {
uint32_t queryQPitch(GMM_RESOURCE_TYPE resType);
void updateImgInfoAndDesc(ImageInfo &imgInfo, uint32_t arrayIndex, ImagePlane yuvPlaneType);
void updateOffsetsInImgInfo(ImageInfo &imgInfo, uint32_t arrayIndex);
void updateUsageAndCachableFlag(GMM_RESOURCE_USAGE_TYPE_ENUM gmmResourceUsage, const GmmRequirements &gmmRequirements);
uint8_t resourceCopyBlt(void *sys, void *gpu, uint32_t pitch, uint32_t height, unsigned char upload, ImagePlane plane);
uint32_t getUnifiedAuxPitchTiles();

View File

@ -8,10 +8,8 @@
#include "graphics_allocation.h"
#include "shared/source/command_stream/command_stream_receiver.h"
#include "shared/source/gmm_helper/cache_settings_helper.h"
#include "shared/source/gmm_helper/gmm.h"
#include "shared/source/gmm_helper/gmm_helper.h"
#include "shared/source/gmm_helper/resource_info.h"
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/bit_helpers.h"
#include "shared/source/memory_manager/allocation_properties.h"
@ -20,16 +18,9 @@
#include "shared/source/utilities/logger.h"
namespace NEO {
void GraphicsAllocation::setAllocationType(AllocationType allocationType, const ProductHelper &productHelper) {
void GraphicsAllocation::setAllocationType(AllocationType allocationType) {
if (this->allocationType != allocationType) {
this->allocationType = allocationType;
auto gmm = getDefaultGmm();
if (gmm) {
GmmRequirements gmmRequirements{};
auto gmmResourceUsage = CacheSettingsHelper::getGmmUsageType(allocationType, false, productHelper);
gmm->updateUsageAndCachableFlag(gmmResourceUsage, gmmRequirements);
gmm->applyResourceInfo();
}
fileLoggerInstance().logAllocation(this);
}
}

View File

@ -36,7 +36,6 @@ class Gmm;
class MemoryManager;
class CommandStreamReceiver;
class GraphicsAllocation;
class ProductHelper;
struct AllocationProperties;
@ -151,7 +150,7 @@ class GraphicsAllocation : public IDNode<GraphicsAllocation> {
osHandle peekSharedHandle() const { return sharingInfo.sharedHandle; }
void setSharedHandle(osHandle handle) { sharingInfo.sharedHandle = handle; }
void setAllocationType(AllocationType allocationType, const ProductHelper &productHelper);
void setAllocationType(AllocationType allocationType);
AllocationType getAllocationType() const { return allocationType; }
MemoryPool getMemoryPool() const { return memoryPool; }

View File

@ -36,44 +36,44 @@ struct AubFileStreamMock : public AubMemDump::AubFileStream {
HWTEST_F(AubAllocDumpTests, givenBufferOrImageWhenGraphicsAllocationIsKnownThenItsTypeCanBeCheckedIfItIsWritable) {
auto memoryManager = pDevice->getMemoryManager();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
auto &productHelper = pDevice->getProductHelper();
gfxAllocation->setAllocationType(AllocationType::buffer, productHelper);
gfxAllocation->setAllocationType(AllocationType::buffer);
EXPECT_FALSE(gfxAllocation->isMemObjectsAllocationWithWritableFlags());
EXPECT_FALSE(AubAllocDump::isWritableBuffer(*gfxAllocation));
gfxAllocation->setAllocationType(AllocationType::buffer, productHelper);
gfxAllocation->setAllocationType(AllocationType::buffer);
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
gfxAllocation->setAllocationType(AllocationType::bufferHostMemory, productHelper);
gfxAllocation->setAllocationType(AllocationType::bufferHostMemory);
gfxAllocation->setMemObjectsAllocationWithWritableFlags(false);
EXPECT_FALSE(AubAllocDump::isWritableBuffer(*gfxAllocation));
gfxAllocation->setAllocationType(AllocationType::bufferHostMemory, productHelper);
gfxAllocation->setAllocationType(AllocationType::bufferHostMemory);
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
gfxAllocation->setAllocationType(AllocationType::externalHostPtr, productHelper);
gfxAllocation->setAllocationType(AllocationType::externalHostPtr);
gfxAllocation->setMemObjectsAllocationWithWritableFlags(false);
EXPECT_FALSE(AubAllocDump::isWritableBuffer(*gfxAllocation));
gfxAllocation->setAllocationType(AllocationType::externalHostPtr, productHelper);
gfxAllocation->setAllocationType(AllocationType::externalHostPtr);
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
gfxAllocation->setAllocationType(AllocationType::mapAllocation, productHelper);
gfxAllocation->setAllocationType(AllocationType::mapAllocation);
gfxAllocation->setMemObjectsAllocationWithWritableFlags(false);
EXPECT_FALSE(AubAllocDump::isWritableBuffer(*gfxAllocation));
gfxAllocation->setAllocationType(AllocationType::mapAllocation, productHelper);
gfxAllocation->setAllocationType(AllocationType::mapAllocation);
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
EXPECT_TRUE(AubAllocDump::isWritableBuffer(*gfxAllocation));
gfxAllocation->setAllocationType(AllocationType::image, productHelper);
gfxAllocation->setAllocationType(AllocationType::image);
gfxAllocation->setMemObjectsAllocationWithWritableFlags(false);
EXPECT_FALSE(AubAllocDump::isWritableImage(*gfxAllocation));
gfxAllocation->setAllocationType(AllocationType::image, productHelper);
gfxAllocation->setAllocationType(AllocationType::image);
gfxAllocation->setMemObjectsAllocationWithWritableFlags(true);
EXPECT_TRUE(AubAllocDump::isWritableImage(*gfxAllocation));

View File

@ -786,7 +786,6 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
memoryManager.reset(new OsAgnosticMemoryManager(*pDevice->executionEnvironment));
aubCsr->initializeEngine();
auto &productHelper = pDevice->getProductHelper();
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{pDevice->getRootDeviceIndex(), MemoryConstants::pageSize});
@ -810,7 +809,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe
for (auto allocationType : onlyOneTimeAubWritableTypes) {
gfxAllocation->setAubWritable(true, GraphicsAllocation::defaultBank);
gfxAllocation->setAllocationType(allocationType, productHelper);
gfxAllocation->setAllocationType(allocationType);
aubCsr->writeMemory(*gfxAllocation);
EXPECT_FALSE(aubCsr->isAubWritable(*gfxAllocation));

View File

@ -272,7 +272,6 @@ HWTEST_F(AubCommandStreamReceiverTests, givenNoCpuPtrAndNotLockableAllocationWhe
auto aubExecutionEnvironment = getEnvironment<MockAubCsr<FamilyType>>(true, true, true);
auto aubCsr = aubExecutionEnvironment->template getCsr<MockAubCsr<FamilyType>>();
auto mockMemoryManager = new MockMemoryManager();
auto &productHelper = pDevice->getProductHelper();
auto memoryManagerBackup = aubExecutionEnvironment->executionEnvironment->memoryManager.release();
aubExecutionEnvironment->executionEnvironment->memoryManager.reset(mockMemoryManager);
@ -282,7 +281,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenNoCpuPtrAndNotLockableAllocationWhe
constexpr uint64_t initGpuAddress = 1234;
constexpr size_t initSize = 10;
MockGraphicsAllocation allocation(nullptr, initGpuAddress, initSize);
allocation.setAllocationType(AllocationType::buffer, productHelper);
allocation.setAllocationType(AllocationType::buffer);
allocation.overrideMemoryPool(MemoryPool::localMemory);
aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->initGmm();
@ -320,8 +319,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenNoCpuPtrAndLockableAllocationWhenGe
constexpr uint64_t initGpuAddress = 1234;
constexpr size_t initSize = 10;
MockGraphicsAllocation allocation(nullptr, initGpuAddress, initSize);
auto &productHelper = pDevice->getProductHelper();
allocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
allocation.setAllocationType(AllocationType::bufferHostMemory);
allocation.overrideMemoryPool(MemoryPool::localMemory);
aubExecutionEnvironment->executionEnvironment->rootDeviceEnvironments[0]->initGmm();

View File

@ -1654,8 +1654,7 @@ TEST(CommandStreamReceiverSimpleTest, givenNewResourceFlushEnabledWhenProvidingN
DeviceBitfield deviceBitfield(1);
MockCommandStreamReceiver csr(executionEnvironment, 0, deviceBitfield);
MockGraphicsAllocation mockAllocation;
auto &productHelper = executionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
mockAllocation.setAllocationType(AllocationType::kernelIsa, productHelper);
mockAllocation.setAllocationType(AllocationType::kernelIsa);
csr.useNewResourceImplicitFlush = true;
csr.newResources = false;

View File

@ -5,12 +5,9 @@
*
*/
#include "shared/source/gmm_helper/gmm.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/mocks/mock_aub_csr.h"
#include "shared/test/common/mocks/mock_command_stream_receiver.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/mocks/mock_graphics_allocation.h"
#include "shared/test/common/test_macros/hw_test.h"
@ -639,16 +636,4 @@ TEST(GraphicsAllocationTest, givenGraphicsAllocationsWhenAllocationTypeIsRingBuf
graphicsAllocation.hasAllocationReadOnlyTypeCallBase = true;
graphicsAllocation.allocationType = AllocationType::ringBuffer;
EXPECT_TRUE(graphicsAllocation.hasAllocationReadOnlyType());
}
using GraphicsAllocationSetAllocationTypeTest = Test<DeviceFixture>;
HWTEST_F(GraphicsAllocationSetAllocationTypeTest, givenAnotherAllocationTypeWhenCalSetAllocationTypeThenUsageAndCacheableAreSetCorrectly) {
MockGraphicsAllocation graphicsAllocation;
GmmRequirements gmmRequirements{};
auto gmm = std::unique_ptr<Gmm>(new Gmm(pDevice->getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, {}, gmmRequirements));
graphicsAllocation.setDefaultGmm(gmm.get());
auto &productHelper = getHelper<ProductHelper>();
graphicsAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
EXPECT_EQ(graphicsAllocation.getDefaultGmm()->resourceParams.Usage, GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER);
EXPECT_TRUE(graphicsAllocation.getDefaultGmm()->resourceParams.Flags.Info.Cacheable);
}

View File

@ -1118,7 +1118,7 @@ TEST(MemoryManagerTest, givenMemoryManagerWhenAllocationIsCommandBufferAndItIsSe
std::swap(executionEnvironment.rootDeviceEnvironments[0]->productHelper, productHelper);
MockMemoryManager memoryManager(false, true, executionEnvironment);
MockGraphicsAllocation mockGa;
mockGa.setAllocationType(AllocationType::commandBuffer, *productHelper.get());
mockGa.setAllocationType(AllocationType::commandBuffer);
mockGa.hasAllocationReadOnlyTypeResult = true;
@ -1143,7 +1143,7 @@ TEST(MemoryManagerTest, givenMemoryManagerWhenAllocationIsCommandBufferAndMultiC
std::swap(executionEnvironment.rootDeviceEnvironments[0]->productHelper, productHelper);
MockMemoryManager memoryManager(false, true, executionEnvironment);
MockGraphicsAllocation mockGa;
mockGa.setAllocationType(AllocationType::commandBuffer, *productHelper.get());
mockGa.setAllocationType(AllocationType::commandBuffer);
mockGa.hasAllocationReadOnlyTypeResult = true;
@ -1169,7 +1169,7 @@ TEST(MemoryManagerTest, givenMemoryManagerWhenAllocationTypeAndPlatrormSupportRe
std::swap(executionEnvironment.rootDeviceEnvironments[0]->productHelper, productHelper);
MockMemoryManager memoryManager(false, true, executionEnvironment);
MockGraphicsAllocation mockGa;
mockGa.setAllocationType(AllocationType::buffer, *productHelper.get());
mockGa.setAllocationType(AllocationType::buffer);
mockGa.hasAllocationReadOnlyTypeResult = true;

View File

@ -3073,8 +3073,8 @@ HWTEST_F(MemoryAllocatorTest, givenUseLocalPreferredForCacheableBuffersAndCompre
EXPECT_EQ(false, allocData.storageInfo.systemMemoryForced);
}
}
using MemoryTransferHelperTest = Test<DeviceFixture>;
HWTEST_F(MemoryTransferHelperTest, WhenBlitterIsSelectedButBlitCopyFailsThenFallbackToCopyOnCPU) {
TEST(MemoryTransferHelperTest, WhenBlitterIsSelectedButBlitCopyFailsThenFallbackToCopyOnCPU) {
constexpr uint32_t dataSize = 16;
uint8_t destData[dataSize] = {};
uint8_t srcData[dataSize] = {};
@ -3082,8 +3082,7 @@ HWTEST_F(MemoryTransferHelperTest, WhenBlitterIsSelectedButBlitCopyFailsThenFall
srcData[i] = i;
}
MockGraphicsAllocation graphicsAllocation{destData, sizeof(destData)};
auto &productHelper = getHelper<ProductHelper>();
graphicsAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
graphicsAllocation.setAllocationType(AllocationType::bufferHostMemory);
auto hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.blitterOperationsSupported = false;
@ -3097,15 +3096,14 @@ HWTEST_F(MemoryTransferHelperTest, WhenBlitterIsSelectedButBlitCopyFailsThenFall
EXPECT_EQ(0, memcmp(destData, srcData, dataSize));
}
HWTEST_F(MemoryTransferHelperTest, givenBlitOperationSupportedWhenBcsEngineNotAvailableThenReturnUnsupported) {
TEST(MemoryTransferHelperTest, givenBlitOperationSupportedWhenBcsEngineNotAvailableThenReturnUnsupported) {
constexpr uint32_t dataSize = 16;
uint8_t destData[dataSize] = {};
uint8_t srcData[dataSize] = {};
MockGraphicsAllocation graphicsAllocation{destData, sizeof(destData)};
graphicsAllocation.storageInfo.memoryBanks = 1;
auto &productHelper = getHelper<ProductHelper>();
graphicsAllocation.setAllocationType(AllocationType::buffer, productHelper);
graphicsAllocation.setAllocationType(AllocationType::buffer);
auto hwInfo = *defaultHwInfo;
hwInfo.capabilityTable.blitterOperationsSupported = true;

View File

@ -75,8 +75,7 @@ TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerWhenCallingLockThenTrueRe
TEST_F(AubMemoryOperationsHandlerTests, givenAubManagerAndAllocationOfOneTimeAubWritableAllocationTypeWhenMakeResidentCalledTwoTimesThenWriteMemoryOnce) {
ASSERT_TRUE(AubHelper::isOneTimeAubWritableAllocationType(AllocationType::buffer));
auto &productHelper = device->getProductHelper();
allocPtr->setAllocationType(AllocationType::buffer, productHelper);
allocPtr->setAllocationType(AllocationType::buffer);
MockAubManager aubManager;
getMemoryOperationsHandler()->setAubManager(&aubManager);

View File

@ -524,7 +524,7 @@ HWTEST_F(ProductHelperTest, givenLockableAllocationWhenGettingIsBlitCopyRequired
pInHwInfo.capabilityTable.blitterOperationsSupported = true;
MockGraphicsAllocation graphicsAllocation;
graphicsAllocation.setAllocationType(AllocationType::bufferHostMemory, *productHelper);
graphicsAllocation.setAllocationType(AllocationType::bufferHostMemory);
EXPECT_TRUE(GraphicsAllocation::isLockable(graphicsAllocation.getAllocationType()));
graphicsAllocation.overrideMemoryPool(MemoryPool::localMemory);
@ -556,7 +556,7 @@ HWTEST_F(ProductHelperTest, givenNotLockableAllocationWhenGettingIsBlitCopyRequi
hwInfo.capabilityTable.blitterOperationsSupported = true;
MockGraphicsAllocation graphicsAllocation;
graphicsAllocation.setAllocationType(AllocationType::svmGpu, *productHelper);
graphicsAllocation.setAllocationType(AllocationType::svmGpu);
EXPECT_FALSE(GraphicsAllocation::isLockable(graphicsAllocation.getAllocationType()));
graphicsAllocation.overrideMemoryPool(MemoryPool::localMemory);
@ -596,7 +596,7 @@ HWTEST2_F(ProductHelperTest, givenProductHelperWhenGettingIsBlitCopyRequiredForL
MockGraphicsAllocation graphicsAllocation;
graphicsAllocation.overrideMemoryPool(MemoryPool::localMemory);
graphicsAllocation.setAllocationType(AllocationType::bufferHostMemory, *productHelper);
graphicsAllocation.setAllocationType(AllocationType::bufferHostMemory);
EXPECT_FALSE(productHelper->isBlitCopyRequiredForLocalMemory(rootDeviceEnvironment, graphicsAllocation));
}

View File

@ -22,7 +22,6 @@ TEST_F(FileLoggerTests, GivenLogAllocationMemoryPoolFlagThenLogsCorrectInfo) {
DebugVariables flags;
flags.LogAllocationMemoryPool.set(true);
FullyEnabledFileLogger fileLogger(testFile, flags);
auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getProductHelper();
// Log file not created
bool logFileCreated = fileExists(fileLogger.getLogFileName());
@ -30,7 +29,7 @@ TEST_F(FileLoggerTests, GivenLogAllocationMemoryPoolFlagThenLogsCorrectInfo) {
MockWddmAllocation allocation(getGmmHelper());
allocation.handle = 4;
allocation.setAllocationType(AllocationType::buffer, productHelper);
allocation.setAllocationType(AllocationType::buffer);
allocation.memoryPool = MemoryPool::system64KBPages;
allocation.getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly = 0;
allocation.setGpuAddress(0x12345);
@ -67,7 +66,6 @@ TEST_F(FileLoggerTests, GivenLogAllocationMemoryPoolFlagSetFalseThenAllocationIs
DebugVariables flags;
flags.LogAllocationMemoryPool.set(false);
FullyEnabledFileLogger fileLogger(testFile, flags);
auto &productHelper = executionEnvironment->rootDeviceEnvironments[0]->getProductHelper();
// Log file not created
bool logFileCreated = fileExists(fileLogger.getLogFileName());
@ -77,7 +75,7 @@ TEST_F(FileLoggerTests, GivenLogAllocationMemoryPoolFlagSetFalseThenAllocationIs
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
MockWddmAllocation allocation(executionEnvironment->rootDeviceEnvironments[0]->getGmmHelper());
allocation.handle = 4;
allocation.setAllocationType(AllocationType::buffer, productHelper);
allocation.setAllocationType(AllocationType::buffer);
allocation.memoryPool = MemoryPool::system64KBPages;
allocation.getDefaultGmm()->resourceParams.Flags.Info.NonLocalOnly = 0;

View File

@ -1415,7 +1415,7 @@ TEST_F(WddmMemoryManagerSimpleTest, whenDestroyingAllocationWithReservedGpuVirtu
TEST_F(WddmMemoryManagerSimpleTest, givenAllocationWithReservedGpuVirtualAddressWhenMapCallFailsDuringCreateWddmAllocationThenReleasePreferredAddress) {
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper(), 1);
allocation.setAllocationType(AllocationType::kernelIsa, csr->getProductHelper());
allocation.setAllocationType(AllocationType::kernelIsa);
uint64_t gpuAddress = 0x123;
uint64_t sizeForFree = 0x1234;
allocation.setReservedGpuVirtualAddress(gpuAddress);
@ -1437,8 +1437,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMultiHandleAllocationAndPreferredGpuVaI
uint32_t numGmms = 10;
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper(), numGmms);
allocation.setAllocationType(AllocationType::buffer, csr->getProductHelper());
allocation.setAllocationType(AllocationType::buffer);
allocation.storageInfo.multiStorage = true;
wddm->callBaseMapGpuVa = true;
@ -1465,7 +1464,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMultiHandleAllocationWhenCreatePhysical
uint32_t numGmms = 10;
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper(), numGmms);
allocation.setAllocationType(AllocationType::buffer, csr->getProductHelper());
allocation.setAllocationType(AllocationType::buffer);
allocation.storageInfo.multiStorage = true;
wddm->callBaseMapGpuVa = true;
@ -1483,7 +1482,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenMultiHandleAllocationWhenCreatePhysical
uint32_t numGmms = 10;
MockWddmAllocation allocation(rootDeviceEnvironment->getGmmHelper(), numGmms);
allocation.setAllocationType(AllocationType::buffer, csr->getProductHelper());
allocation.setAllocationType(AllocationType::buffer);
allocation.storageInfo.multiStorage = true;
wddm->callBaseMapGpuVa = true;

View File

@ -11,10 +11,8 @@
#include "shared/source/memory_manager/memory_manager.h"
#include "shared/source/memory_manager/memory_pool.h"
#include "shared/source/utilities/logger.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/gtest_helpers.h"
#include "shared/test/common/test_macros/hw_test.h"
#include "shared/test/common/utilities/base_object_utils.h"
#include "gtest/gtest.h"
@ -495,17 +493,16 @@ TEST(AllocationTypeLoggingSingle, givenGraphicsAllocationTypeWhenConvertingToStr
EXPECT_STREQ(result, "ILLEGAL_VALUE");
}
using AllocationTypeLoggingSingleTest = Test<DeviceFixture>;
HWTEST_F(AllocationTypeLoggingSingleTest, givenAllocationTypeWhenConvertingToStringThenSupportAll) {
TEST(AllocationTypeLoggingSingle, givenAllocationTypeWhenConvertingToStringThenSupportAll) {
std::string testFile = "testfile";
DebugVariables flags;
FullyEnabledFileLogger fileLogger(testFile, flags);
GraphicsAllocation graphicsAllocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, 0, 0, MemoryPool::memoryNull, MemoryManager::maxOsContextCount, 0llu);
auto &productHelper = getHelper<NEO::ProductHelper>();
for (uint32_t i = 0; i < static_cast<uint32_t>(AllocationType::count); i++) {
graphicsAllocation.setAllocationType(static_cast<AllocationType>(i), productHelper);
graphicsAllocation.setAllocationType(static_cast<AllocationType>(i));
auto result = getAllocationTypeString(&graphicsAllocation);

View File

@ -517,7 +517,7 @@ XE2_HPG_CORETEST_F(ProductHelperTestXe2HpgCore, givenProductHelperWhenGettingIsB
auto &productHelper = getHelper<ProductHelper>();
MockGraphicsAllocation allocation;
allocation.overrideMemoryPool(MemoryPool::localMemory);
allocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
allocation.setAllocationType(AllocationType::bufferHostMemory);
EXPECT_FALSE(productHelper.isBlitCopyRequiredForLocalMemory(pDevice->getRootDeviceEnvironment(), allocation));
}

View File

@ -590,7 +590,7 @@ PVCTEST_F(EngineNodeHelperPvcTests, givenNonTile0AccessWhenGettingIsBlitCopyRequ
auto &productHelper = getHelper<ProductHelper>();
hwInfo.capabilityTable.blitterOperationsSupported = true;
MockGraphicsAllocation graphicsAllocation;
graphicsAllocation.setAllocationType(AllocationType::bufferHostMemory, productHelper);
graphicsAllocation.setAllocationType(AllocationType::bufferHostMemory);
EXPECT_TRUE(GraphicsAllocation::isLockable(graphicsAllocation.getAllocationType()));
graphicsAllocation.overrideMemoryPool(MemoryPool::localMemory);
hwInfo.platform.usRevId = 0u;