Revert "fix: set NotLockable flag when resource does not need to be lockable"

This reverts commit c597b03a33.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation 2023-05-14 04:18:43 +02:00 committed by Compute-Runtime-Automation
parent 29c4a12b75
commit 57851a5d29
16 changed files with 15 additions and 70 deletions

View File

@ -292,9 +292,6 @@ HWTEST2_F(CommandQueuePvcAndLaterTests, whenPrepareHostPtrSurfaceForSplitThenSet
HostPtrSurface hostPtrSurf(ptr, ptrSize);
queue->getGpgpuCommandStreamReceiver().createAllocationForHostSurface(hostPtrSurf, false);
EXPECT_EQ(1u, hostPtrSurf.getAllocation()->hostPtrTaskCountAssignment.load());
hostPtrSurf.getAllocation()->hostPtrTaskCountAssignment--;
queue->prepareHostPtrSurfaceForSplit(false, *hostPtrSurf.getAllocation());
for (auto i = static_cast<uint32_t>(aub_stream::EngineType::ENGINE_BCS1); i <= static_cast<uint32_t>(aub_stream::EngineType::ENGINE_BCS8); i++) {

View File

@ -133,6 +133,4 @@ TEST_F(CommandStreamReceiverMultiRootDeviceTest, WhenCreatingCommandStreamGraphi
EXPECT_TRUE(commandStreamReceiver->createAllocationForHostSurface(surface, false));
ASSERT_NE(nullptr, surface.getAllocation());
EXPECT_EQ(expectedRootDeviceIndex, surface.getAllocation()->getRootDeviceIndex());
EXPECT_EQ(1u, surface.getAllocation()->hostPtrTaskCountAssignment.load());
surface.getAllocation()->hostPtrTaskCountAssignment--;
}

View File

@ -1090,14 +1090,10 @@ struct RelaxedOrderingBcsTests : public BcsTests {
}
BlitProperties generateBlitProperties(CommandStreamReceiver &csr, Buffer *clBuffer) {
auto properties = BlitProperties::constructPropertiesForReadWrite(BlitterConstants::BlitDirection::HostPtrToBuffer,
csr, clBuffer->getGraphicsAllocation(pDevice->getRootDeviceIndex()), nullptr, hostPtr,
clBuffer->getGraphicsAllocation(pDevice->getRootDeviceIndex())->getGpuAddress(), 0,
0, 0, {1, 1, 1}, 0, 0, 0, 0);
EXPECT_EQ(1u, properties.srcAllocation->hostPtrTaskCountAssignment.load());
properties.srcAllocation->hostPtrTaskCountAssignment--;
return properties;
return BlitProperties::constructPropertiesForReadWrite(BlitterConstants::BlitDirection::HostPtrToBuffer,
csr, clBuffer->getGraphicsAllocation(pDevice->getRootDeviceIndex()), nullptr, hostPtr,
clBuffer->getGraphicsAllocation(pDevice->getRootDeviceIndex())->getGpuAddress(), 0,
0, 0, {1, 1, 1}, 0, 0, 0, 0);
}
std::unique_ptr<VariableBackup<UltHwConfig>> ultHwConfigBackup;

View File

@ -1748,9 +1748,6 @@ HWTEST_F(BcsTests, givenHostPtrToImageWhenConstructPropertiesIsCalledThenValuesA
EXPECT_EQ(dstRowPitchExpected, blitProperties.dstRowPitch);
EXPECT_EQ(srcSlicePitchExpected, blitProperties.srcSlicePitch);
EXPECT_EQ(dstSlicePitchExpected, blitProperties.dstSlicePitch);
EXPECT_EQ(1u, blitProperties.srcAllocation->hostPtrTaskCountAssignment.load());
blitProperties.srcAllocation->hostPtrTaskCountAssignment--;
}
HWTEST_F(BcsTests, givenImageToHostPtrWhenConstructPropertiesIsCalledThenValuesAreSetCorrectly) {
@ -1789,9 +1786,6 @@ HWTEST_F(BcsTests, givenImageToHostPtrWhenConstructPropertiesIsCalledThenValuesA
EXPECT_EQ(dstRowPitchExpected, blitProperties.dstRowPitch);
EXPECT_EQ(srcSlicePitchExpected, blitProperties.srcSlicePitch);
EXPECT_EQ(dstSlicePitchExpected, blitProperties.dstSlicePitch);
EXPECT_EQ(1u, blitProperties.dstAllocation->hostPtrTaskCountAssignment.load());
blitProperties.dstAllocation->hostPtrTaskCountAssignment--;
}
HWTEST_F(BcsTests, givenHostPtrToImageWithInputRowSlicePitchesWhenConstructPropertiesIsCalledThenValuesAreSetCorrectly) {
@ -1822,9 +1816,6 @@ HWTEST_F(BcsTests, givenHostPtrToImageWithInputRowSlicePitchesWhenConstructPrope
EXPECT_EQ(dstRowPitchExpected, blitProperties.dstRowPitch);
EXPECT_EQ(inputSlicePitch, blitProperties.srcSlicePitch);
EXPECT_EQ(dstSlicePitchExpected, blitProperties.dstSlicePitch);
EXPECT_EQ(1u, blitProperties.srcAllocation->hostPtrTaskCountAssignment.load());
blitProperties.srcAllocation->hostPtrTaskCountAssignment--;
}
HWTEST_F(BcsTests, givenImageToHostPtrWithInputRowSlicePitchesWhenConstructPropertiesIsCalledThenValuesAreSetCorrectly) {
@ -1856,9 +1847,6 @@ HWTEST_F(BcsTests, givenImageToHostPtrWithInputRowSlicePitchesWhenConstructPrope
EXPECT_EQ(inputRowPitch, blitProperties.dstRowPitch);
EXPECT_EQ(srcSlicePitchExpected, blitProperties.srcSlicePitch);
EXPECT_EQ(inputSlicePitch, blitProperties.dstSlicePitch);
EXPECT_EQ(1u, blitProperties.dstAllocation->hostPtrTaskCountAssignment.load());
blitProperties.dstAllocation->hostPtrTaskCountAssignment--;
}
HWTEST_F(BcsTests, givenHostPtrToImageWhenBlitBufferIsCalledThenBlitCmdIsFound) {

View File

@ -1473,7 +1473,7 @@ TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUsingLocalMemoryAndAllocation
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NotLockable);
}
TEST_F(GmmHelperTests, givenNotLockableAllocationWhenCreatingGmmThenNotLockableFlagsIsSetAndLocalAndNonLocalOnlyAreNotSet) {
TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUsingLocalMemoryFalseAndAllocationIsNotLockableThenNotLockableFlagsIsSetAndLocalAndNonLocalOnlyAreNotSet) {
StorageInfo storageInfo{};
storageInfo.isLockable = false;
storageInfo.memoryBanks.set(1);
@ -1530,7 +1530,7 @@ TEST_F(GmmLocalMemoryTests, givenLocalMemoryAndStorageInfoWithoutLocalOnlyRequir
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.LocalOnly);
}
TEST_F(GmmHelperTests, givenCompressionEnabledWhenUsingLocalMemoryAndAllocationIsNotLockableThenNotLockableAndLocalOnlyFlagsAreSetAndNonLocalOnlyIsNotSet) {
TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryAndCompressionEnabledWhenUsingLocalMemoryAndAllocationIsNotLockableThenNotLockableAndLocalOnlyFlagsAreSetAndNonLocalOnlyIsNotSet) {
DebugManagerStateRestore restorer;
DebugManager.flags.RenderCompressedBuffersEnabled.set(1);
StorageInfo storageInfo{};
@ -1541,23 +1541,10 @@ TEST_F(GmmHelperTests, givenCompressionEnabledWhenUsingLocalMemoryAndAllocationI
auto gmm = std::make_unique<Gmm>(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, storageInfo, true);
EXPECT_TRUE(gmm->isCompressionEnabled);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NonLocalOnly);
EXPECT_EQ(defaultHwInfo->featureTable.flags.ftrLocalMemory, gmm->resourceParams.Flags.Info.LocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.LocalOnly);
EXPECT_EQ(1u, gmm->resourceParams.Flags.Info.NotLockable);
}
TEST_F(GmmHelperTests, givenCompressionSupportedWhenAllocationIsLockableThenGmmHasNoCompression) {
DebugManagerStateRestore restorer;
DebugManager.flags.RenderCompressedBuffersEnabled.set(1);
StorageInfo storageInfo{};
storageInfo.isLockable = true;
storageInfo.systemMemoryPlacement = false;
storageInfo.memoryBanks.set(1);
auto gmm = std::make_unique<Gmm>(getGmmHelper(), nullptr, 1, 0, GMM_RESOURCE_USAGE_OCL_BUFFER, true, storageInfo, true);
EXPECT_FALSE(gmm->isCompressionEnabled);
EXPECT_EQ(0u, gmm->resourceParams.Flags.Info.NotLockable);
}
TEST_F(GmmLocalMemoryTests, givenFtrLocalMemoryWhenUseSystemMemoryIsFalseAndAllocationIsNotLockableThenLocalAndNonLocalOnlyAndNotLockableFlagsAreNotSet) {
DebugManagerStateRestore restorer;
for (auto csrMode = static_cast<int32_t>(CommandStreamReceiverType::CSR_HW); csrMode < static_cast<int32_t>(CommandStreamReceiverType::CSR_TYPES_NUM); csrMode++) {

View File

@ -1973,14 +1973,11 @@ HWTEST_F(BufferCreateTests, givenClMemCopyHostPointerPassedToBufferCreateWhenAll
DebugManagerStateRestore subTestRestorer;
DebugManager.flags.RenderCompressedBuffersEnabled.set(1);
DebugManager.flags.OverrideBufferSuitableForRenderCompression.set(1);
cl_int retVal;
cl_mem_flags flags = CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR;
auto writeBufferCounter = commandQueue->writeBufferCounter;
size_t lockResourceCalled = memoryManager->lockResourceCalled;
static_cast<MockGfxCoreHelperHwWithSetIsLockable<FamilyType> *>(executionEnvironment->rootDeviceEnvironments[0]->gfxCoreHelper.get())->setIsLockable = false;
std::unique_ptr<Buffer> buffer(Buffer::create(&context, flags, sizeof(memory), memory, retVal));
ASSERT_NE(nullptr, buffer.get());
EXPECT_EQ(commandQueue->writeBufferCounter, writeBufferCounter + 1);

View File

@ -184,9 +184,6 @@ HWTEST2_F(MigrationControllerTests, givenMultiGraphicsAllocationUsedInOneCsrWhen
ASSERT_TRUE(pImage->getMultiGraphicsAllocation().requiresMigrations());
pImage->getMultiGraphicsAllocation().getGraphicsAllocation(0)->getDefaultGmm()->resourceParams.Flags.Info.NotLockable = false;
pImage->getMultiGraphicsAllocation().getGraphicsAllocation(1)->getDefaultGmm()->resourceParams.Flags.Info.NotLockable = false;
auto migrationSyncData = static_cast<MockMigrationSyncData *>(pImage->getMultiGraphicsAllocation().getMigrationSyncData());
EXPECT_EQ(0u, migrationSyncData->waitOnCpuCalled);

View File

@ -191,8 +191,6 @@ HWTEST_F(PrintfHandlerTests, givenGpuHangOnFlushBcsStreamAndEnabledStatelessComp
EXPECT_FALSE(printfHandler->printEnqueueOutput());
EXPECT_EQ(1u, bcsCsr->blitBufferCalled);
EXPECT_EQ(BlitterConstants::BlitDirection::BufferToHostPtr, bcsCsr->receivedBlitProperties[0].blitDirection);
EXPECT_EQ(1u, bcsCsr->receivedBlitProperties[0].dstAllocation->hostPtrTaskCountAssignment.load());
bcsCsr->receivedBlitProperties[0].dstAllocation->hostPtrTaskCountAssignment--;
}
HWTEST_F(PrintfHandlerTests, givenDisallowedLocalMemoryCpuAccessWhenPrintEnqueueOutputIsCalledThenBCSEngineIsUsedToCopyPrintfOutput) {

View File

@ -54,8 +54,6 @@ Gmm::Gmm(GmmHelper *gmmHelper, const void *alignedPtr, size_t alignedSize, size_
resourceParams.Flags.Gpu.NoRestriction = 1;
}
preferCompressed &= !storageInfo.isLockable;
applyAuxFlagsForBuffer(preferCompressed);
applyMemoryFlags(storageInfo);
applyAppResource(storageInfo);
@ -75,7 +73,6 @@ Gmm::~Gmm() = default;
Gmm::Gmm(GmmHelper *gmmHelper, ImageInfo &inputOutputImgInfo, const StorageInfo &storageInfo, bool preferCompressed) : gmmHelper(gmmHelper) {
this->resourceParams = {};
preferCompressed &= !storageInfo.isLockable;
setupImageResourceParams(inputOutputImgInfo, preferCompressed);
applyMemoryFlags(storageInfo);
applyAppResource(storageInfo);
@ -349,15 +346,13 @@ void Gmm::applyMemoryFlags(const StorageInfo &storageInfo) {
if (extraMemoryFlagsRequired()) {
applyExtraMemoryFlags(storageInfo);
} else if (!storageInfo.isLockable) {
resourceParams.Flags.Info.NotLockable = 1;
if (isCompressionEnabled || storageInfo.localOnlyRequired) {
resourceParams.Flags.Info.LocalOnly = 1;
}
}
}
}
if (!storageInfo.isLockable) {
resourceParams.Flags.Info.NotLockable = 1;
}
if (hardwareInfo->featureTable.flags.ftrMultiTileArch) {
resourceParams.MultiTileArch.Enable = 1;

View File

@ -363,7 +363,10 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
bool createAllocationForHostSurface(HostPtrSurface &surface, bool requiresL3Flush) override {
createAllocationForHostSurfaceCalled++;
cpuCopyForHostPtrSurfaceAllowed = surface.peekIsPtrCopyAllowed();
return BaseClass::createAllocationForHostSurface(surface, requiresL3Flush);
auto status = BaseClass::createAllocationForHostSurface(surface, requiresL3Flush);
if (status)
surface.getAllocation()->hostPtrTaskCountAssignment--;
return status;
}
void ensureCommandBufferAllocation(LinearStream &commandStream, size_t minimumRequiredSize, size_t additionalAllocationSize) override {

View File

@ -586,7 +586,7 @@ class OsAgnosticMemoryManagerForImagesWithNoHostPtr : public OsAgnosticMemoryMan
};
using AubCommandStreamReceiverNoHostPtrTests = ::testing::Test;
HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWhenWriteMemoryIsCalledOnLockableImageWithNoHostPtrThenResourceShouldBeLockedToGetCpuAddress) {
HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWhenWriteMemoryIsCalledOnImageWithNoHostPtrThenResourceShouldBeLockedToGetCpuAddress) {
ExecutionEnvironment *executionEnvironment = new MockExecutionEnvironment();
auto memoryManager = new OsAgnosticMemoryManagerForImagesWithNoHostPtr(*executionEnvironment);
executionEnvironment->memoryManager.reset(memoryManager);
@ -611,7 +611,6 @@ HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWh
auto imageAllocation = memoryManager->allocateGraphicsMemoryInPreferredPool(allocProperties, nullptr);
ASSERT_NE(nullptr, imageAllocation);
imageAllocation->getDefaultGmm()->resourceParams.Flags.Info.NotLockable = false;
EXPECT_TRUE(aubCsr->writeMemory(*imageAllocation));

View File

@ -1799,9 +1799,6 @@ TEST_F(CreateAllocationForHostSurfaceTest, givenReadOnlyHostPointerWhenAllocatio
auto allocation = surface.getAllocation();
ASSERT_NE(nullptr, allocation);
EXPECT_EQ(1u, allocation->hostPtrTaskCountAssignment.load());
allocation->hostPtrTaskCountAssignment--;
EXPECT_NE(memory, allocation->getUnderlyingBuffer());
EXPECT_EQ(0, memcmp(allocation->getUnderlyingBuffer(), memory, size));

View File

@ -66,9 +66,6 @@ TEST(BlitCommandsHelperTest, GivenBufferParamsWhenConstructingPropertiesForReadW
EXPECT_EQ(blitProperties.dstSlicePitch, dstSlicePitch);
EXPECT_EQ(blitProperties.srcRowPitch, srcRowPitch);
EXPECT_EQ(blitProperties.srcSlicePitch, srcSlicePitch);
EXPECT_EQ(1u, blitProperties.dstAllocation->hostPtrTaskCountAssignment.load());
blitProperties.dstAllocation->hostPtrTaskCountAssignment--;
}
TEST(BlitCommandsHelperTest, GivenBufferParamsWhenConstructingPropertiesForBufferRegionsThenPropertiesCreatedCorrectly) {

View File

@ -107,7 +107,7 @@ TEST_F(WddmMemoryManagerTests, GivenNotCompressedAndNotLockableAllocationTypeWhe
EXPECT_NE(nullptr, graphicsAllocation);
EXPECT_TRUE(graphicsAllocation->isAllocationLockable());
EXPECT_TRUE(graphicsAllocation->storageInfo.isLockable);
memoryManager->freeGraphicsMemory(graphicsAllocation);
}
@ -126,7 +126,7 @@ TEST_F(WddmMemoryManagerTests, GivenCompressedAndNotLockableAllocationTypeWhenAl
EXPECT_NE(nullptr, graphicsAllocation);
EXPECT_FALSE(graphicsAllocation->isAllocationLockable());
EXPECT_FALSE(graphicsAllocation->storageInfo.isLockable);
memoryManager->freeGraphicsMemory(graphicsAllocation);
}

View File

@ -58,8 +58,6 @@ TEST_F(WddmFrontWindowPoolAllocatorTests, givenAllocateInFrontWindowPoolFlagWhen
if (preferredAllocationMethod == GfxMemoryAllocationMethod::AllocateByKmd) {
EXPECT_TRUE(allocation->isAllocationLockable());
} else {
EXPECT_FALSE(allocation->isAllocationLockable());
}
memManager->freeGraphicsMemory(allocation);
}

View File

@ -67,8 +67,6 @@ TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreNotExportedTh
}
TEST(AllocateGlobalSurfaceTest, GivenSvmAllocsManagerWhenGlobalsAreExportedThenMemoryIsAllocatedAsUsmDeviceAllocation) {
DebugManagerStateRestore restorer;
DebugManager.flags.ForceLocalMemoryAccessMode.set(0);
MockDevice device{};
REQUIRE_SVM_OR_SKIP(&device);
device.injectMemoryManager(new MockMemoryManager());