Skip to content

Commit a230c76

Browse files
feature: Adjust PATs for dc flush mitigation
Related-To: NEO-10556 Signed-off-by: Lukasz Jobczyk <[email protected]>
1 parent 189d35b commit a230c76

File tree

7 files changed

+48
-12
lines changed

7 files changed

+48
-12
lines changed

shared/source/gmm_helper/cache_settings_helper.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,7 @@ bool CacheSettingsHelper::preferNoCpuAccess(GMM_RESOURCE_USAGE_TYPE_ENUM gmmReso
4747
}
4848

4949
GMM_RESOURCE_USAGE_TYPE_ENUM CacheSettingsHelper::getDefaultUsageTypeWithCachingEnabled(AllocationType allocationType, const ProductHelper &productHelper) {
50-
if (productHelper.isDcFlushMitigated() &&
51-
(allocationType == AllocationType::externalHostPtr ||
52-
allocationType == AllocationType::bufferHostMemory ||
53-
allocationType == AllocationType::mapAllocation ||
54-
allocationType == AllocationType::svmCpu ||
55-
allocationType == AllocationType::svmZeroCopy ||
56-
allocationType == AllocationType::internalHostMemory ||
57-
allocationType == AllocationType::timestampPacketTagBuffer ||
58-
allocationType == AllocationType::tagBuffer)) {
50+
if (productHelper.overridePatAndUsageForDcFlushMitigation(allocationType)) {
5951
return getDefaultUsageTypeWithCachingDisabled(allocationType, productHelper);
6052
}
6153

shared/source/os_interface/product_helper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ class ProductHelper {
129129
virtual bool isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const = 0;
130130
virtual bool isDcFlushAllowed() const = 0;
131131
virtual bool isDcFlushMitigated() const = 0;
132+
virtual bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const = 0;
132133
virtual uint32_t computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const = 0;
133134
virtual bool getUuid(NEO::DriverModel *driverModel, const uint32_t subDeviceCount, const uint32_t deviceIndex, std::array<uint8_t, ProductHelper::uuidSize> &uuid) const = 0;
134135
virtual bool isFlushTaskAllowed() const = 0;

shared/source/os_interface/product_helper.inl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,20 @@ bool ProductHelperHw<gfxProduct>::isDcFlushMitigated() const {
400400
return this->isDcFlushAllowed() != dcFlushAllowed;
401401
}
402402

403+
template <PRODUCT_FAMILY gfxProduct>
404+
bool ProductHelperHw<gfxProduct>::overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const {
405+
return this->isDcFlushMitigated() &&
406+
(allocationType == AllocationType::externalHostPtr ||
407+
allocationType == AllocationType::bufferHostMemory ||
408+
allocationType == AllocationType::mapAllocation ||
409+
allocationType == AllocationType::svmCpu ||
410+
allocationType == AllocationType::svmZeroCopy ||
411+
allocationType == AllocationType::internalHostMemory ||
412+
allocationType == AllocationType::timestampPacketTagBuffer ||
413+
allocationType == AllocationType::tagBuffer ||
414+
allocationType == AllocationType::gpuTimestampDeviceBuffer);
415+
}
416+
403417
template <PRODUCT_FAMILY gfxProduct>
404418
uint32_t ProductHelperHw<gfxProduct>::computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const {
405419
return hwInfo.gtSystemInfo.MaxSubSlicesSupported;

shared/source/os_interface/product_helper_hw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class ProductHelperHw : public ProductHelper {
7474
bool isTile64With3DSurfaceOnBCSSupported(const HardwareInfo &hwInfo) const override;
7575
bool isDcFlushAllowed() const override;
7676
bool isDcFlushMitigated() const override;
77+
bool overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const override;
7778
uint32_t computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const override;
7879
bool getUuid(NEO::DriverModel *driverModel, uint32_t subDeviceCount, uint32_t deviceIndex, std::array<uint8_t, ProductHelper::uuidSize> &uuid) const override;
7980
bool isFlushTaskAllowed() const override;

shared/test/common/mocks/mock_product_helper.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ bool ProductHelperHw<IGFX_UNKNOWN>::isDcFlushMitigated() const {
276276
return false;
277277
}
278278

279+
template <>
280+
bool ProductHelperHw<IGFX_UNKNOWN>::overridePatAndUsageForDcFlushMitigation(AllocationType allocationType) const {
281+
return false;
282+
}
283+
279284
template <>
280285
uint32_t ProductHelperHw<IGFX_UNKNOWN>::computeMaxNeededSubSliceSpace(const HardwareInfo &hwInfo) const {
281286
return hwInfo.gtSystemInfo.MaxSubSlicesSupported;

shared/test/unit_test/gmm_helper/gmm_helper_tests.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ TEST(GmmTest, givenAllocationTypeAndMitigatedDcFlushWhenGettingUsageTypeThenRetu
745745
case AllocationType::svmZeroCopy:
746746
case AllocationType::internalHostMemory:
747747
case AllocationType::timestampPacketTagBuffer:
748+
case AllocationType::gpuTimestampDeviceBuffer:
748749
case AllocationType::bufferHostMemory:
749750
case AllocationType::tagBuffer:
750751
expectedUsage = uncachedGmmUsageType;
@@ -793,9 +794,6 @@ TEST(GmmTest, givenAllocationTypeAndMitigatedDcFlushWhenGettingUsageTypeThenRetu
793794
}
794795

795796
EXPECT_EQ(expectedUsage, usage);
796-
if (expectedUsage != usage) {
797-
std::cout << "fail";
798-
}
799797
}
800798
}
801799

shared/test/unit_test/os_interface/product_helper_tests.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,31 @@ HWTEST_F(ProductHelperTest, givenVariousValuesWhenGettingAubStreamSteppingFromHw
309309
EXPECT_EQ(AubMemDump::SteppingValues::A, mockProductHelper.getAubStreamSteppingFromHwRevId(pInHwInfo));
310310
}
311311

312+
HWTEST_F(ProductHelperTest, givenDcFlushMitigationWhenOverridePatAndUsageForDcFlushMitigationThenReturnCorrectValue) {
313+
DebugManagerStateRestore restorer;
314+
for (auto i = 0; i < static_cast<int>(AllocationType::count); ++i) {
315+
auto allocationType = static_cast<AllocationType>(i);
316+
EXPECT_FALSE(productHelper->overridePatAndUsageForDcFlushMitigation(allocationType));
317+
}
318+
debugManager.flags.AllowDcFlush.set(0);
319+
for (auto i = 0; i < static_cast<int>(AllocationType::count); ++i) {
320+
auto allocationType = static_cast<AllocationType>(i);
321+
if (allocationType == AllocationType::externalHostPtr ||
322+
allocationType == AllocationType::bufferHostMemory ||
323+
allocationType == AllocationType::mapAllocation ||
324+
allocationType == AllocationType::svmCpu ||
325+
allocationType == AllocationType::svmZeroCopy ||
326+
allocationType == AllocationType::internalHostMemory ||
327+
allocationType == AllocationType::timestampPacketTagBuffer ||
328+
allocationType == AllocationType::tagBuffer ||
329+
allocationType == AllocationType::gpuTimestampDeviceBuffer) {
330+
EXPECT_EQ(productHelper->overridePatAndUsageForDcFlushMitigation(allocationType), productHelper->isDcFlushMitigated());
331+
} else {
332+
EXPECT_FALSE(productHelper->overridePatAndUsageForDcFlushMitigation(allocationType));
333+
}
334+
}
335+
}
336+
312337
HWTEST_F(ProductHelperTest, givenProductHelperWhenAskedForDefaultEngineTypeAdjustmentThenFalseIsReturned) {
313338

314339
EXPECT_FALSE(productHelper->isDefaultEngineTypeAdjustmentRequired(pInHwInfo));

0 commit comments

Comments
 (0)