Revert "refactor: Add dc flush mitigation infrastructure"

This reverts commit d6076941a8.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation 2024-07-15 09:18:43 +02:00 committed by Compute-Runtime-Automation
parent 09cbbc2625
commit 9a6403f3bc
18 changed files with 12 additions and 80 deletions

View File

@ -17,8 +17,4 @@ bool CommandQueue::isTimestampWaitEnabled() {
return true; return true;
} }
bool checkIsGpuCopyRequiredForDcFlushMitigation(AllocationType type) {
return type != AllocationType::bufferHostMemory;
}
} // namespace NEO } // namespace NEO

View File

@ -184,8 +184,6 @@ Buffer *Buffer::create(Context *context,
flags, 0, size, hostPtr, bufferCreateArgs, errcodeRet); flags, 0, size, hostPtr, bufferCreateArgs, errcodeRet);
} }
extern bool checkIsGpuCopyRequiredForDcFlushMitigation(AllocationType type);
bool inline copyHostPointer(Buffer *buffer, bool inline copyHostPointer(Buffer *buffer,
Device &device, Device &device,
size_t size, size_t size,
@ -197,8 +195,7 @@ bool inline copyHostPointer(Buffer *buffer,
auto memory = buffer->getGraphicsAllocation(rootDeviceIndex); auto memory = buffer->getGraphicsAllocation(rootDeviceIndex);
auto isCompressionEnabled = memory->isCompressionEnabled(); auto isCompressionEnabled = memory->isCompressionEnabled();
const bool isLocalMemory = !MemoryPoolHelper::isSystemMemoryPool(memory->getMemoryPool()); const bool isLocalMemory = !MemoryPoolHelper::isSystemMemoryPool(memory->getMemoryPool());
const bool isGpuCopyRequiredForDcFlushMitigation = productHelper.isDcFlushMitigated() && checkIsGpuCopyRequiredForDcFlushMitigation(memory->getAllocationType()); const bool gpuCopyRequired = isCompressionEnabled || isLocalMemory || productHelper.isDcFlushMitigated();
const bool gpuCopyRequired = isCompressionEnabled || isLocalMemory || isGpuCopyRequiredForDcFlushMitigation;
if (gpuCopyRequired) { if (gpuCopyRequired) {
auto &hwInfo = device.getHardwareInfo(); auto &hwInfo = device.getHardwareInfo();
@ -213,7 +210,7 @@ bool inline copyHostPointer(Buffer *buffer,
isCompressionEnabled == false && isCompressionEnabled == false &&
productHelper.getLocalMemoryAccessMode(hwInfo) != LocalMemoryAccessMode::cpuAccessDisallowed && productHelper.getLocalMemoryAccessMode(hwInfo) != LocalMemoryAccessMode::cpuAccessDisallowed &&
isLockable && isLockable &&
!isGpuCopyRequiredForDcFlushMitigation; !productHelper.isDcFlushMitigated();
if (debugManager.flags.CopyHostPtrOnCpu.get() != -1) { if (debugManager.flags.CopyHostPtrOnCpu.get() != -1) {
copyOnCpuAllowed = debugManager.flags.CopyHostPtrOnCpu.get() == 1; copyOnCpuAllowed = debugManager.flags.CopyHostPtrOnCpu.get() == 1;
@ -226,7 +223,7 @@ bool inline copyHostPointer(Buffer *buffer,
} else { } else {
auto blitMemoryToAllocationResult = BlitOperationResult::unsupported; auto blitMemoryToAllocationResult = BlitOperationResult::unsupported;
if (productHelper.isBlitterFullySupported(hwInfo) && (isLocalMemory || isGpuCopyRequiredForDcFlushMitigation)) { if (productHelper.isBlitterFullySupported(hwInfo) && (isLocalMemory || productHelper.isDcFlushMitigated())) {
blitMemoryToAllocationResult = BlitHelperFunctions::blitMemoryToAllocation(device, memory, buffer->getOffset(), hostPtr, {size, 1, 1}); blitMemoryToAllocationResult = BlitHelperFunctions::blitMemoryToAllocation(device, memory, buffer->getOffset(), hostPtr, {size, 1, 1});
} }

View File

@ -403,7 +403,7 @@ void CopyEngineXeHPAndLater<numTiles, testLocalMemory>::givenSrcCompressedBuffer
template <uint32_t numTiles, bool testLocalMemory> template <uint32_t numTiles, bool testLocalMemory>
template <typename FamilyType> template <typename FamilyType>
void CopyEngineXeHPAndLater<numTiles, testLocalMemory>::givenCompressedBufferWhenAuxTranslationCalledThenResolveAndCompressImpl() { void CopyEngineXeHPAndLater<numTiles, testLocalMemory>::givenCompressedBufferWhenAuxTranslationCalledThenResolveAndCompressImpl() {
if (this->context->getDevice(0u)->areSharedSystemAllocationsAllowed() || !compressionSupported() || this->context->getDevice(0u)->getProductHelper().isDcFlushMitigated()) { if (this->context->getDevice(0u)->areSharedSystemAllocationsAllowed() || !compressionSupported()) {
// no support for scenarios where stateless is mixed with blitter compression // no support for scenarios where stateless is mixed with blitter compression
GTEST_SKIP(); GTEST_SKIP();
} }

View File

@ -19,8 +19,4 @@ bool CommandQueue::isTimestampWaitEnabled() {
return ultHwConfig.useWaitForTimestamps; return ultHwConfig.useWaitForTimestamps;
} }
bool checkIsGpuCopyRequiredForDcFlushMitigation(AllocationType type) {
return false;
}
} // namespace NEO } // namespace NEO

View File

@ -1930,10 +1930,6 @@ HWTEST_F(BufferCreateTests, givenClMemCopyHostPointerPassedToBufferCreateWhenAll
auto memoryManager = new MockMemoryManager(true, *executionEnvironment); auto memoryManager = new MockMemoryManager(true, *executionEnvironment);
executionEnvironment->memoryManager.reset(memoryManager); executionEnvironment->memoryManager.reset(memoryManager);
if (executionEnvironment->rootDeviceEnvironments[0]->getProductHelper().isDcFlushMitigated()) {
debugManager.flags.AllowDcFlush.set(1);
}
MockClDevice device(new MockDevice(executionEnvironment, mockRootDeviceIndex)); MockClDevice device(new MockDevice(executionEnvironment, mockRootDeviceIndex));
ASSERT_TRUE(device.createEngines()); ASSERT_TRUE(device.createEngines());
DeviceFactory::prepareDeviceEnvironments(*device.getExecutionEnvironment()); DeviceFactory::prepareDeviceEnvironments(*device.getExecutionEnvironment());

View File

@ -115,10 +115,6 @@ HWTEST2_F(PvcAndLaterBufferTests, givenCompressedBufferInSystemAndBlitterSupport
auto pDevice = deviceFactory.rootDevices[0]; auto pDevice = deviceFactory.rootDevices[0];
auto pMockContext = std::make_unique<MockContext>(pDevice); auto pMockContext = std::make_unique<MockContext>(pDevice);
if (pDevice->getProductHelper().isDcFlushMitigated()) {
debugManager.flags.AllowDcFlush.set(1);
}
static_cast<MockMemoryManager *>(pDevice->getExecutionEnvironment()->memoryManager.get())->enable64kbpages[0] = true; static_cast<MockMemoryManager *>(pDevice->getExecutionEnvironment()->memoryManager.get())->enable64kbpages[0] = true;
static_cast<MockMemoryManager *>(pDevice->getExecutionEnvironment()->memoryManager.get())->localMemorySupported[0] = false; static_cast<MockMemoryManager *>(pDevice->getExecutionEnvironment()->memoryManager.get())->localMemorySupported[0] = false;

View File

@ -152,10 +152,6 @@ HWTEST_F(BufferCreateWindowsTests, givenClMemCopyHostPointerPassedToBufferCreate
auto memoryManager = new MockMemoryManager(true, *executionEnvironment); auto memoryManager = new MockMemoryManager(true, *executionEnvironment);
executionEnvironment->memoryManager.reset(memoryManager); executionEnvironment->memoryManager.reset(memoryManager);
if (executionEnvironment->rootDeviceEnvironments[0]->getProductHelper().isDcFlushMitigated()) {
debugManager.flags.AllowDcFlush.set(1);
}
MockClDevice device(new MockDevice(executionEnvironment, mockRootDeviceIndex)); MockClDevice device(new MockDevice(executionEnvironment, mockRootDeviceIndex));
ASSERT_TRUE(device.createEngines()); ASSERT_TRUE(device.createEngines());
DeviceFactory::prepareDeviceEnvironments(*device.getExecutionEnvironment()); DeviceFactory::prepareDeviceEnvironments(*device.getExecutionEnvironment());

View File

@ -132,7 +132,6 @@ class ProductHelper {
virtual bool isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const = 0; virtual bool isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const = 0;
virtual bool isDcFlushAllowed() const = 0; virtual bool isDcFlushAllowed() const = 0;
virtual bool isDcFlushMitigated() const = 0; virtual bool isDcFlushMitigated() const = 0;
virtual bool mitigateDcFlush() const = 0;
virtual bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const = 0; virtual bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const = 0;
virtual bool overrideCacheableForDcFlushMitigation(AllocationType allocationType) const = 0; virtual bool overrideCacheableForDcFlushMitigation(AllocationType allocationType) const = 0;
virtual uint32_t computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const = 0; virtual uint32_t computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const = 0;

View File

@ -394,7 +394,7 @@ bool ProductHelperHw<gfxProduct>::isDisableScratchPagesSupported() const {
template <PRODUCT_FAMILY gfxProduct> template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isDcFlushAllowed() const { bool ProductHelperHw<gfxProduct>::isDcFlushAllowed() const {
using GfxProduct = typename HwMapper<gfxProduct>::GfxProduct; using GfxProduct = typename HwMapper<gfxProduct>::GfxProduct;
bool dcFlushAllowed = GfxProduct::isDcFlushAllowed && !this->mitigateDcFlush(); bool dcFlushAllowed = GfxProduct::isDcFlushAllowed;
if (debugManager.flags.AllowDcFlush.get() != -1) { if (debugManager.flags.AllowDcFlush.get() != -1) {
dcFlushAllowed = debugManager.flags.AllowDcFlush.get(); dcFlushAllowed = debugManager.flags.AllowDcFlush.get();
@ -403,11 +403,6 @@ bool ProductHelperHw<gfxProduct>::isDcFlushAllowed() const {
return dcFlushAllowed; return dcFlushAllowed;
} }
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::mitigateDcFlush() const {
return false;
}
template <PRODUCT_FAMILY gfxProduct> template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isDcFlushMitigated() const { bool ProductHelperHw<gfxProduct>::isDcFlushMitigated() const {
using GfxProduct = typename HwMapper<gfxProduct>::GfxProduct; using GfxProduct = typename HwMapper<gfxProduct>::GfxProduct;

View File

@ -76,7 +76,6 @@ class ProductHelperHw : public ProductHelper {
bool isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const override; bool isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const override;
bool isDcFlushAllowed() const override; bool isDcFlushAllowed() const override;
bool isDcFlushMitigated() const override; bool isDcFlushMitigated() const override;
bool mitigateDcFlush() const override;
bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const override; bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const override;
bool overrideCacheableForDcFlushMitigation(AllocationType allocationType) const override; bool overrideCacheableForDcFlushMitigation(AllocationType allocationType) const override;
uint32_t computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const override; uint32_t computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const override;

View File

@ -35,11 +35,6 @@ uint64_t ProductHelperHw<gfxProduct>::overridePatIndex(bool isUncachedType, uint
return patIndex; return patIndex;
} }
template <>
bool ProductHelperHw<gfxProduct>::mitigateDcFlush() const {
return true;
}
template <> template <>
bool ProductHelperHw<gfxProduct>::isDirectSubmissionSupported(ReleaseHelper *releaseHelper) const { bool ProductHelperHw<gfxProduct>::isDirectSubmissionSupported(ReleaseHelper *releaseHelper) const {
return true; return true;

View File

@ -281,11 +281,6 @@ bool ProductHelperHw<IGFX_UNKNOWN>::isDcFlushMitigated() const {
return false; return false;
} }
template <>
bool ProductHelperHw<IGFX_UNKNOWN>::mitigateDcFlush() const {
return false;
}
template <> template <>
bool ProductHelperHw<IGFX_UNKNOWN>::overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const { bool ProductHelperHw<IGFX_UNKNOWN>::overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const {
return false; return false;

View File

@ -685,11 +685,6 @@ TEST(GmmTest, givenHwInfoWhenDeviceIsCreatedThenSetThisHwInfoToGmmHelper) {
TEST(GmmTest, givenAllocationTypeWhenGettingUsageTypeThenReturnCorrectValue) { TEST(GmmTest, givenAllocationTypeWhenGettingUsageTypeThenReturnCorrectValue) {
MockExecutionEnvironment mockExecutionEnvironment{}; MockExecutionEnvironment mockExecutionEnvironment{};
const auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>(); const auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
if (productHelper.isDcFlushMitigated()) {
GTEST_SKIP();
}
for (uint32_t i = 0; i < static_cast<uint32_t>(AllocationType::count); i++) { for (uint32_t i = 0; i < static_cast<uint32_t>(AllocationType::count); i++) {
auto allocationType = static_cast<AllocationType>(i); auto allocationType = static_cast<AllocationType>(i);
auto uncachedGmmUsageType = productHelper.isNewCoherencyModelSupported() ? GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC : GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED; auto uncachedGmmUsageType = productHelper.isNewCoherencyModelSupported() ? GMM_RESOURCE_USAGE_OCL_BUFFER_CSR_UC : GMM_RESOURCE_USAGE_OCL_BUFFER_CACHELINE_MISALIGNED;
@ -888,10 +883,6 @@ TEST(GmmTest, givenUncachedDebugFlagMaskSetWhenAskingForUsageTypeThenReturnUncac
MockExecutionEnvironment mockExecutionEnvironment{}; MockExecutionEnvironment mockExecutionEnvironment{};
const auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>(); const auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
if (productHelper.isDcFlushMitigated()) {
GTEST_SKIP();
}
constexpr int64_t bufferMask = 1 << (static_cast<int64_t>(AllocationType::buffer) - 1); constexpr int64_t bufferMask = 1 << (static_cast<int64_t>(AllocationType::buffer) - 1);
constexpr int64_t imageMask = 1 << (static_cast<int64_t>(AllocationType::image) - 1); constexpr int64_t imageMask = 1 << (static_cast<int64_t>(AllocationType::image) - 1);

View File

@ -311,12 +311,10 @@ HWTEST_F(ProductHelperTest, givenVariousValuesWhenGettingAubStreamSteppingFromHw
HWTEST_F(ProductHelperTest, givenDcFlushMitigationWhenOverridePatAndUsageForDcFlushMitigationThenReturnCorrectValue) { HWTEST_F(ProductHelperTest, givenDcFlushMitigationWhenOverridePatAndUsageForDcFlushMitigationThenReturnCorrectValue) {
DebugManagerStateRestore restorer; DebugManagerStateRestore restorer;
if (!productHelper->isDcFlushMitigated()) {
for (auto i = 0; i < static_cast<int>(AllocationType::count); ++i) { for (auto i = 0; i < static_cast<int>(AllocationType::count); ++i) {
auto allocationType = static_cast<AllocationType>(i); auto allocationType = static_cast<AllocationType>(i);
EXPECT_FALSE(productHelper->overridePatAndUsageForDcFlushMitigation(allocationType)); EXPECT_FALSE(productHelper->overridePatAndUsageForDcFlushMitigation(allocationType));
} }
}
debugManager.flags.AllowDcFlush.set(0); debugManager.flags.AllowDcFlush.set(0);
for (auto i = 0; i < static_cast<int>(AllocationType::count); ++i) { for (auto i = 0; i < static_cast<int>(AllocationType::count); ++i) {
auto allocationType = static_cast<AllocationType>(i); auto allocationType = static_cast<AllocationType>(i);

View File

@ -2873,11 +2873,7 @@ HWTEST_F(WddmMemoryManagerTest, givenInternalHeapOrLinearStreamTypeWhenAllocatin
ASSERT_NE(nullptr, allocation); ASSERT_NE(nullptr, allocation);
if (rootDeviceEnvironment->getProductHelper().isDcFlushMitigated()) {
EXPECT_TRUE(allocation->getDefaultGmm()->resourceParams.Usage == GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED);
} else {
EXPECT_TRUE(allocation->getDefaultGmm()->resourceParams.Usage == GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER); EXPECT_TRUE(allocation->getDefaultGmm()->resourceParams.Usage == GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER);
}
memoryManager->freeGraphicsMemory(allocation); memoryManager->freeGraphicsMemory(allocation);
} }
@ -2889,11 +2885,7 @@ HWTEST_F(WddmMemoryManagerTest, givenInternalHeapOrLinearStreamTypeWhenAllocatin
ASSERT_NE(nullptr, allocation); ASSERT_NE(nullptr, allocation);
if (rootDeviceEnvironment->getProductHelper().isDcFlushMitigated()) {
EXPECT_TRUE(allocation->getDefaultGmm()->resourceParams.Usage == GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_SYSTEM_MEMORY_BUFFER_CACHELINE_MISALIGNED);
} else {
EXPECT_TRUE(allocation->getDefaultGmm()->resourceParams.Usage == GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER); EXPECT_TRUE(allocation->getDefaultGmm()->resourceParams.Usage == GMM_RESOURCE_USAGE_TYPE::GMM_RESOURCE_USAGE_OCL_STATE_HEAP_BUFFER);
}
memoryManager->freeGraphicsMemory(allocation); memoryManager->freeGraphicsMemory(allocation);
} }

View File

@ -29,5 +29,5 @@ LNLTEST_F(GfxCoreHelperTestsLnl, givenCommandBufferAllocationTypeWhenGetAllocati
} }
LNLTEST_F(GfxCoreHelperTestsLnl, WhenAskingForDcFlushThenReturnTrue) { LNLTEST_F(GfxCoreHelperTestsLnl, WhenAskingForDcFlushThenReturnTrue) {
EXPECT_NE(MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, this->pDevice->getRootDeviceEnvironment()), this->pDevice->getRootDeviceEnvironment().getProductHelper().isDcFlushMitigated()); EXPECT_TRUE(MemorySynchronizationCommands<FamilyType>::getDcFlushEnable(true, this->pDevice->getRootDeviceEnvironment()));
} }

View File

@ -89,7 +89,6 @@ LNLTEST_F(LnlProductHelper, givenCompilerProductHelperWhenGetDefaultHwIpVersionT
LNLTEST_F(LnlProductHelper, whenCheckPreferredAllocationMethodThenAllocateByKmdIsReturnedExceptTagBufferAndTimestampPacketTagBuffer) { LNLTEST_F(LnlProductHelper, whenCheckPreferredAllocationMethodThenAllocateByKmdIsReturnedExceptTagBufferAndTimestampPacketTagBuffer) {
DebugManagerStateRestore restorer; DebugManagerStateRestore restorer;
debugManager.flags.AllowDcFlush.set(1);
for (auto i = 0; i < static_cast<int>(AllocationType::count); ++i) { for (auto i = 0; i < static_cast<int>(AllocationType::count); ++i) {
auto allocationType = static_cast<AllocationType>(i); auto allocationType = static_cast<AllocationType>(i);
auto preferredAllocationMethod = productHelper->getPreferredAllocationMethod(allocationType); auto preferredAllocationMethod = productHelper->getPreferredAllocationMethod(allocationType);
@ -127,13 +126,11 @@ LNLTEST_F(LnlProductHelper, givenProductHelperWhenCheckOverrideAllocationCacheab
} }
LNLTEST_F(LnlProductHelper, givenExternalHostPtrWhenMitigateDcFlushThenOverrideCacheable) { LNLTEST_F(LnlProductHelper, givenExternalHostPtrWhenMitigateDcFlushThenOverrideCacheable) {
DebugManagerStateRestore restorer;
debugManager.flags.AllowDcFlush.set(1);
AllocationData allocationData{}; AllocationData allocationData{};
allocationData.type = AllocationType::externalHostPtr; allocationData.type = AllocationType::externalHostPtr;
EXPECT_FALSE(productHelper->overrideAllocationCacheable(allocationData)); EXPECT_FALSE(productHelper->overrideAllocationCacheable(allocationData));
DebugManagerStateRestore restorer;
debugManager.flags.AllowDcFlush.set(0); debugManager.flags.AllowDcFlush.set(0);
for (auto i = 0; i < static_cast<int>(AllocationType::count); ++i) { for (auto i = 0; i < static_cast<int>(AllocationType::count); ++i) {

View File

@ -23,14 +23,8 @@ LNLTEST_F(LnlProductHelperWindows, givenProductHelperWhenCheckDirectSubmissionSu
EXPECT_TRUE(productHelper->isDirectSubmissionSupported(releaseHelper)); EXPECT_TRUE(productHelper->isDirectSubmissionSupported(releaseHelper));
} }
LNLTEST_F(LnlProductHelperWindows, givenProductHelperWhenDcFlushMitigationThenReturnTrue) {
EXPECT_TRUE(productHelper->mitigateDcFlush());
EXPECT_TRUE(productHelper->isDcFlushMitigated());
}
LNLTEST_F(LnlProductHelperWindows, givenProductHelperWhenOverridePatIndexCalledThenCorrectValueIsReturned) { LNLTEST_F(LnlProductHelperWindows, givenProductHelperWhenOverridePatIndexCalledThenCorrectValueIsReturned) {
DebugManagerStateRestore restorer; DebugManagerStateRestore restorer;
debugManager.flags.AllowDcFlush.set(1);
uint64_t expectedPatIndex = 6u; uint64_t expectedPatIndex = 6u;
EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, AllocationType::bufferHostMemory)); EXPECT_EQ(expectedPatIndex, productHelper->overridePatIndex(0u, expectedPatIndex, AllocationType::bufferHostMemory));