refactor: remove not needed code

Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
This commit is contained in:
Mrozek, Michal 2023-09-11 16:18:30 +00:00 committed by Compute-Runtime-Automation
parent bad0df5b9c
commit 0a28d622fa
7 changed files with 1 additions and 167 deletions

View File

@ -938,7 +938,6 @@ cl_int Kernel::setArgSvm(uint32_t argIndex, size_t svmAllocSize, void *svmPtr, G
if (svmPtr != nullptr && isBuiltIn == false) {
this->anyKernelArgumentUsingSystemMemory |= true;
}
addAllocationToCacheFlushVector(argIndex, svmAlloc);
return CL_SUCCESS;
}
@ -1001,7 +1000,6 @@ cl_int Kernel::setArgSvmAlloc(uint32_t argIndex, void *svmPtr, GraphicsAllocatio
this->anyKernelArgumentUsingSystemMemory |= true;
}
}
addAllocationToCacheFlushVector(argIndex, svmAlloc);
return CL_SUCCESS;
}
@ -1546,14 +1544,6 @@ cl_int Kernel::setArgBuffer(uint32_t argIndex,
kernelArguments[argIndex].isStatelessUncacheable = argAsPtr.isPureStateful() ? false : buffer->isMemObjUncacheable();
auto allocationForCacheFlush = graphicsAllocation;
// if we make object uncacheable for surface state and there are only stateful accesses, then don't flush caches
if (buffer->isMemObjUncacheableForSurfaceState() && argAsPtr.isPureStateful()) {
allocationForCacheFlush = nullptr;
}
addAllocationToCacheFlushVector(argIndex, allocationForCacheFlush);
return CL_SUCCESS;
} else {
storeKernelArg(argIndex, BUFFER_OBJ, nullptr, argVal, argSize);
@ -1693,7 +1683,6 @@ cl_int Kernel::setArgImageWithMipLevel(uint32_t argIndex,
patch<uint32_t, uint64_t>((imageDesc.image_height * pixelSize) - 1, crossThreadData, argAsImg.metadataPayload.flatHeight);
patch<uint32_t, uint64_t>(imageDesc.image_row_pitch - 1, crossThreadData, argAsImg.metadataPayload.flatPitch);
addAllocationToCacheFlushVector(argIndex, graphicsAllocation);
retVal = CL_SUCCESS;
}

View File

@ -349,40 +349,4 @@ HWCMDTEST_F(IGFX_GEN8_CORE, clMemLocallyUncachedResourceFixture, WhenUnsettingUn
EXPECT_EQ(mocsUncacheable, cmdQueueMocs<FamilyType>(pCmdQ));
}
HWCMDTEST_F(IGFX_GEN8_CORE, clMemLocallyUncachedResourceFixture, givenBuffersThatAreUncachedInSurfaceStateAndAreNotUsedInStatelessFashionThenThoseResourcesAreNotRegistredAsResourcesForCacheFlush) {
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleSubDevices.set(2);
auto context = std::make_unique<MockContext>();
cl_int retVal = CL_SUCCESS;
MockKernelWithInternals mockKernel(*context->getDevice(0), context.get(), true);
auto kernel = mockKernel.mockKernel;
auto pMultiDeviceKernel = mockKernel.mockMultiDeviceKernel;
mockKernel.kernelInfo.setBufferStateful(0);
mockKernel.kernelInfo.setBufferStateful(1);
auto bufferCacheable = clCreateBufferWithPropertiesINTEL(context.get(), propertiesCacheable, 0, n * sizeof(float), nullptr, nullptr);
auto bufferUncacheableInSurfaceState = clCreateBufferWithPropertiesINTEL(context.get(), propertiesUncacheableInSurfaceState, 0, n * sizeof(float), nullptr, nullptr);
auto bufferUncacheable = clCreateBufferWithPropertiesINTEL(context.get(), propertiesUncacheable, 0, n * sizeof(float), nullptr, nullptr);
retVal = clSetKernelArg(pMultiDeviceKernel, 0, sizeof(cl_mem), &bufferUncacheableInSurfaceState);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(nullptr, kernel->kernelArgRequiresCacheFlush[0]);
retVal = clSetKernelArg(pMultiDeviceKernel, 0, sizeof(cl_mem), &bufferCacheable);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_NE(nullptr, kernel->kernelArgRequiresCacheFlush[0]);
retVal = clSetKernelArg(pMultiDeviceKernel, 0, sizeof(cl_mem), &bufferUncacheable);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(nullptr, kernel->kernelArgRequiresCacheFlush[0]);
clReleaseMemObject(bufferUncacheableInSurfaceState);
clReleaseMemObject(bufferUncacheable);
clReleaseMemObject(bufferCacheable);
}
} // namespace clMemLocallyUncachedResourceTests

View File

@ -1232,34 +1232,6 @@ TEST_F(HardwareCommandsTest, givenCacheFlushAfterWalkerEnabledWhenPlatformNotSup
using KernelCacheFlushTests = Test<HelloWorldFixture<HelloWorldFixtureFactory>>;
HWTEST_F(KernelCacheFlushTests, givenLocallyUncachedBufferWhenGettingAllocationsForFlushThenEmptyVectorIsReturned) {
DebugManagerStateRestore dbgRestore;
DebugManager.flags.EnableCacheFlushAfterWalker.set(-1);
DebugManager.flags.CreateMultipleSubDevices.set(2);
auto context = std::make_unique<MockContext>();
auto kernel = std::unique_ptr<Kernel>(Kernel::create(pProgram, pProgram->getKernelInfoForKernel("CopyBuffer"), *context->getDevice(0), retVal));
ASSERT_EQ(CL_SUCCESS, retVal);
cl_mem_properties_intel bufferPropertiesUncachedResource[] = {CL_MEM_FLAGS_INTEL, CL_MEM_LOCALLY_UNCACHED_RESOURCE, 0};
auto bufferLocallyUncached = clCreateBufferWithPropertiesINTEL(context.get(), bufferPropertiesUncachedResource, 0, 1, nullptr, nullptr);
kernel->setArg(0, sizeof(bufferLocallyUncached), &bufferLocallyUncached);
using CacheFlushAllocationsVec = StackVec<GraphicsAllocation *, 32>;
CacheFlushAllocationsVec cacheFlushVec;
kernel->getAllocationsForCacheFlush(cacheFlushVec);
EXPECT_EQ(0u, cacheFlushVec.size());
auto bufferRegular = clCreateBufferWithPropertiesINTEL(context.get(), nullptr, 0, 1, nullptr, nullptr);
kernel->setArg(1, sizeof(bufferRegular), &bufferRegular);
kernel->getAllocationsForCacheFlush(cacheFlushVec);
size_t expectedCacheFlushVecSize = (hardwareInfo.capabilityTable.supportCacheFlushAfterWalker ? 1u : 0u);
EXPECT_EQ(expectedCacheFlushVecSize, cacheFlushVec.size());
clReleaseMemObject(bufferLocallyUncached);
clReleaseMemObject(bufferRegular);
}
struct HardwareCommandsImplicitArgsTests : Test<ClDeviceFixture> {
void SetUp() override {

View File

@ -246,7 +246,7 @@ class GivenCacheFlushAfterWalkerEnabledAndProperSteppingIsSetWhenAllocationRequi
mockKernel.kernelInfo.kernelAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties(pDevice->getRootDeviceIndex(), true, MemoryConstants::pageSize, AllocationType::INTERNAL_HEAP));
mockKernel.mockKernel->kernelArgRequiresCacheFlush.resize(1);
mockKernel.mockKernel->setArgSvmAlloc(0, svm, svmAllocation, 0u);
mockKernel.mockKernel->kernelArgRequiresCacheFlush[0] = svmAllocation;
cmdQ->getUltCommandStreamReceiver().timestampPacketWriteEnabled = false;

View File

@ -284,45 +284,6 @@ TEST_F(KernelArgBufferTest, given32BitDeviceWhenArgPassedIsNullThenOnly4BytesAre
EXPECT_NE(expValue, *pKernelArg64bit);
}
TEST_F(KernelArgBufferTest, givenWritableBufferWhenSettingAsArgThenDoNotExpectAllocationInCacheFlushVector) {
auto buffer = std::make_unique<MockBuffer>();
buffer->mockGfxAllocation.setMemObjectsAllocationWithWritableFlags(true);
buffer->mockGfxAllocation.setFlushL3Required(false);
auto val = static_cast<cl_mem>(buffer.get());
auto pVal = &val;
auto retVal = pKernel->setArg(0, sizeof(cl_mem *), pVal);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(nullptr, pKernel->kernelArgRequiresCacheFlush[0]);
}
TEST_F(KernelArgBufferTest, givenCacheFlushBufferWhenSettingAsArgThenExpectAllocationInCacheFlushVector) {
auto buffer = std::make_unique<MockBuffer>();
buffer->mockGfxAllocation.setMemObjectsAllocationWithWritableFlags(false);
buffer->mockGfxAllocation.setFlushL3Required(true);
auto val = static_cast<cl_mem>(buffer.get());
auto pVal = &val;
auto retVal = pKernel->setArg(0, sizeof(cl_mem *), pVal);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(&buffer->mockGfxAllocation, pKernel->kernelArgRequiresCacheFlush[0]);
}
TEST_F(KernelArgBufferTest, givenNoCacheFlushBufferWhenSettingAsArgThenNotExpectAllocationInCacheFlushVector) {
auto buffer = std::make_unique<MockBuffer>();
buffer->mockGfxAllocation.setMemObjectsAllocationWithWritableFlags(false);
buffer->mockGfxAllocation.setFlushL3Required(false);
auto val = static_cast<cl_mem>(buffer.get());
auto pVal = &val;
auto retVal = pKernel->setArg(0, sizeof(cl_mem *), pVal);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(nullptr, pKernel->kernelArgRequiresCacheFlush[0]);
}
TEST_F(KernelArgBufferTest, givenBufferWhenHasDirectStatelessAccessToHostMemoryIsCalledThenReturnFalse) {
MockBuffer buffer;
buffer.getGraphicsAllocation(mockRootDeviceIndex)->setAllocationType(AllocationType::BUFFER);

View File

@ -488,46 +488,6 @@ TEST_F(KernelArgSvmTest, givenWritableSvmAllocationWhenSettingAsArgThenDoNotExpe
alignedFree(svmPtr);
}
TEST_F(KernelArgSvmTest, givenCacheFlushSvmAllocationWhenSettingAsArgThenExpectAllocationInCacheFlushVector) {
const ClDeviceInfo &devInfo = pClDevice->getDeviceInfo();
if (devInfo.svmCapabilities == 0) {
GTEST_SKIP();
}
size_t svmSize = 4096;
void *svmPtr = alignedMalloc(svmSize, MemoryConstants::pageSize);
MockGraphicsAllocation svmAlloc(svmPtr, svmSize);
svmAlloc.setMemObjectsAllocationWithWritableFlags(false);
svmAlloc.setFlushL3Required(true);
auto retVal = pKernel->setArgSvmAlloc(0, svmPtr, &svmAlloc, 0u);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(&svmAlloc, pKernel->kernelArgRequiresCacheFlush[0]);
alignedFree(svmPtr);
}
TEST_F(KernelArgSvmTest, givenNoCacheFlushSvmAllocationWhenSettingAsArgThenNotExpectAllocationInCacheFlushVector) {
const ClDeviceInfo &devInfo = pClDevice->getDeviceInfo();
if (devInfo.svmCapabilities == 0) {
GTEST_SKIP();
}
size_t svmSize = 4096;
void *svmPtr = alignedMalloc(svmSize, MemoryConstants::pageSize);
MockGraphicsAllocation svmAlloc(svmPtr, svmSize);
svmAlloc.setMemObjectsAllocationWithWritableFlags(false);
svmAlloc.setFlushL3Required(false);
auto retVal = pKernel->setArgSvmAlloc(0, svmPtr, &svmAlloc, 0u);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(nullptr, pKernel->kernelArgRequiresCacheFlush[0]);
alignedFree(svmPtr);
}
TEST_F(KernelArgSvmTest, givenWritableSvmAllocationWhenSettingKernelExecInfoThenDoNotExpectSvmFlushFlagTrue) {
const ClDeviceInfo &devInfo = pClDevice->getDeviceInfo();
if (devInfo.svmCapabilities == 0) {

View File

@ -330,18 +330,6 @@ TEST_F(KernelImageArgTest, givenWritableImageWhenSettingAsArgThenDoNotExpectAllo
EXPECT_EQ(nullptr, pKernel->kernelArgRequiresCacheFlush[0]);
}
TEST_F(KernelImageArgTest, givenCacheFlushImageWhenSettingAsArgThenExpectAllocationInCacheFlushVector) {
MockImageBase image;
image.graphicsAllocation->setMemObjectsAllocationWithWritableFlags(false);
image.graphicsAllocation->setFlushL3Required(true);
cl_mem imageObj = &image;
pKernel->setArg(0, sizeof(imageObj), &imageObj);
EXPECT_EQ(CL_SUCCESS, retVal);
EXPECT_EQ(image.graphicsAllocation, pKernel->kernelArgRequiresCacheFlush[0]);
}
TEST_F(KernelImageArgTest, givenNoCacheFlushImageWhenSettingAsArgThenExpectAllocationInCacheFlushVector) {
MockImageBase image;
image.graphicsAllocation->setMemObjectsAllocationWithWritableFlags(false);