Skip to content

Commit 590418a

Browse files
Revert "performance: Limit tlb flush WA scope on DG2 Linux"
This reverts commit 0b85a9f. Signed-off-by: Compute-Runtime-Validation <[email protected]>
1 parent 2d62c4e commit 590418a

16 files changed

+15
-67
lines changed

shared/source/os_interface/linux/drm_buffer_object.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include "shared/source/command_stream/task_count_helper.h"
1111
#include "shared/source/helpers/common_types.h"
1212
#include "shared/source/helpers/constants.h"
13-
#include "shared/source/memory_manager/allocation_type.h"
1413
#include "shared/source/memory_manager/definitions/engine_limits.h"
1514
#include "shared/source/memory_manager/memory_operations_status.h"
1615
#include "shared/source/os_interface/linux/cache_info.h"
@@ -214,14 +213,6 @@ class BufferObject {
214213

215214
bool isChunked = false;
216215

217-
void setIsImage(AllocationType type) {
218-
this->isImageAllocation = type == AllocationType::image;
219-
}
220-
221-
bool isImage() const {
222-
return this->isImageAllocation;
223-
}
224-
225216
protected:
226217
MOCKABLE_VIRTUAL MemoryOperationsStatus evictUnusedAllocations(bool waitForCompletion, bool isLockNeeded);
227218

@@ -239,7 +230,6 @@ class BufferObject {
239230
bool allowCapture = false;
240231
bool requiresImmediateBinding = false;
241232
bool requiresExplicitResidency = false;
242-
bool isImageAllocation = false;
243233

244234
MOCKABLE_VIRTUAL void fillExecObject(ExecObject &execObject, OsContext *osContext, uint32_t vmHandleId, uint32_t drmContextId);
245235
void printBOBindingResult(OsContext *osContext, uint32_t vmHandleId, bool bind, int retVal);

shared/source/os_interface/linux/drm_memory_manager.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,6 @@ GraphicsAllocation *DrmMemoryManager::allocateGraphicsMemoryForImageImpl(const A
678678
return nullptr;
679679
}
680680
bo->setAddress(gpuRange);
681-
bo->setIsImage(allocationData.type);
682681

683682
[[maybe_unused]] auto ret2 = bo->setTiling(ioctlHelper->getDrmParamValue(DrmParam::tilingY), static_cast<uint32_t>(allocationData.imgInfo->rowPitch));
684683
DEBUG_BREAK_IF(ret2 != true);
@@ -1068,7 +1067,6 @@ GraphicsAllocation *DrmMemoryManager::createGraphicsAllocationFromSharedHandle(o
10681067
drmAllocation->setDefaultGmm(gmm);
10691068

10701069
bo->setPatIndex(drm.getPatIndex(gmm, properties.allocationType, CacheRegion::defaultRegion, CachePolicy::writeBack, false, MemoryPoolHelper::isSystemMemoryPool(memoryPool)));
1071-
bo->setIsImage(properties.allocationType);
10721070
}
10731071

10741072
if (!reuseSharedAllocation) {
@@ -1899,7 +1897,6 @@ BufferObject *DrmMemoryManager::createBufferObjectInMemoryRegion(uint32_t rootDe
18991897
}
19001898

19011899
bo->setAddress(gpuAddress);
1902-
bo->setIsImage(allocationType);
19031900

19041901
return bo;
19051902
}

shared/source/os_interface/linux/drm_neo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ uint32_t Drm::getVirtualMemoryAddressSpace(uint32_t vmId) const {
688688
}
689689

690690
void Drm::setNewResourceBoundToVM(BufferObject *bo, uint32_t vmHandleId) {
691-
if (!this->rootDeviceEnvironment.getProductHelper().isTlbFlushRequired(*this->getHardwareInfo(), bo->isImage())) {
691+
if (!this->rootDeviceEnvironment.getProductHelper().isTlbFlushRequired()) {
692692
return;
693693
}
694694
const auto &engines = this->rootDeviceEnvironment.executionEnvironment.memoryManager->getRegisteredEngines(bo->getRootDeviceIndex());

shared/source/os_interface/product_helper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class ProductHelper {
159159
virtual bool isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ, TaskCountType queueTaskCount, const CommandStreamReceiver &queueCsr) const = 0;
160160
virtual bool isMidThreadPreemptionDisallowedForRayTracingKernels() const = 0;
161161
virtual bool isBufferPoolAllocatorSupported() const = 0;
162-
virtual bool isTlbFlushRequired(const HardwareInfo &hwInfo, bool precondition) const = 0;
162+
virtual bool isTlbFlushRequired() const = 0;
163163
virtual bool isDummyBlitWaRequired() const = 0;
164164
virtual bool isDetectIndirectAccessInKernelSupported(const KernelDescriptor &kernelDescriptor, const bool isPrecompiled) const = 0;
165165
virtual bool isLinearStoragePreferred(bool isImage1d, bool forceLinearStorage) const = 0;

shared/source/os_interface/product_helper.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void ProductHelperHw<gfxProduct>::adjustSamplerState(void *sampler, const Hardwa
6161
}
6262

6363
template <PRODUCT_FAMILY gfxProduct>
64-
bool ProductHelperHw<gfxProduct>::isTlbFlushRequired(const HardwareInfo &hwInfo, bool precondition) const {
64+
bool ProductHelperHw<gfxProduct>::isTlbFlushRequired() const {
6565
bool tlbFlushRequired = true;
6666
if (debugManager.flags.ForceTlbFlush.get() != -1) {
6767
tlbFlushRequired = !!debugManager.flags.ForceTlbFlush.get();

shared/source/os_interface/product_helper_hw.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class ProductHelperHw : public ProductHelper {
112112
bool isResolveDependenciesByPipeControlsSupported(const HardwareInfo &hwInfo, bool isOOQ, TaskCountType queueTaskCount, const CommandStreamReceiver &queueCsr) const override;
113113
bool isMidThreadPreemptionDisallowedForRayTracingKernels() const override;
114114
bool isBufferPoolAllocatorSupported() const override;
115-
bool isTlbFlushRequired(const HardwareInfo &hwInfo, bool precondition) const override;
115+
bool isTlbFlushRequired() const override;
116116
bool isDummyBlitWaRequired() const override;
117117
bool isDetectIndirectAccessInKernelSupported(const KernelDescriptor &kernelDescriptor, const bool isPrecompiled) const override;
118118
bool isLinearStoragePreferred(bool isImage1d, bool forceLinearStorage) const override;

shared/source/os_interface/windows/wddm/wddm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1349,7 +1349,7 @@ void Wddm::populateIpVersion(HardwareInfo &hwInfo) {
13491349
}
13501350

13511351
void Wddm::setNewResourceBoundToPageTable() {
1352-
if (!this->rootDeviceEnvironment.getProductHelper().isTlbFlushRequired(*this->getHardwareInfo(), true)) {
1352+
if (!this->rootDeviceEnvironment.getProductHelper().isTlbFlushRequired()) {
13531353
return;
13541354
}
13551355
this->forEachContextWithinWddm([](const EngineControl &engine) { engine.osContext->setNewResourceBound(); });

shared/source/xe_hpc_core/pvc/os_agnostic_product_helper_pvc.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ bool ProductHelperHw<gfxProduct>::isBlitCopyRequiredForLocalMemory(const RootDev
138138
}
139139

140140
template <>
141-
bool ProductHelperHw<gfxProduct>::isTlbFlushRequired(const HardwareInfo &hwInfo, bool precondition) const {
141+
bool ProductHelperHw<gfxProduct>::isTlbFlushRequired() const {
142142
bool tlbFlushRequired = false;
143143
if (debugManager.flags.ForceTlbFlush.get() != -1) {
144144
tlbFlushRequired = !!debugManager.flags.ForceTlbFlush.get();

shared/source/xe_hpg_core/linux/product_helper_dg2.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,6 @@ int ProductHelperHw<gfxProduct>::configureHardwareCustom(HardwareInfo *hwInfo, O
4646
return 0;
4747
}
4848

49-
template <>
50-
bool ProductHelperHw<gfxProduct>::isTlbFlushRequired(const HardwareInfo &hwInfo, bool precondition) const {
51-
bool tlbFlushRequired = !DG2::isG10(hwInfo) && precondition;
52-
if (debugManager.flags.ForceTlbFlush.get() != -1) {
53-
tlbFlushRequired = !!debugManager.flags.ForceTlbFlush.get();
54-
}
55-
return tlbFlushRequired;
56-
}
57-
5849
template <>
5950
bool ProductHelperHw<gfxProduct>::getUuid(NEO::DriverModel *driverModel, const uint32_t subDeviceCount, const uint32_t deviceIndex, std::array<uint8_t, ProductHelper::uuidSize> &uuid) const {
6051
if (driverModel->getDriverModelType() != DriverModelType::drm) {

shared/test/unit_test/os_interface/linux/drm_buffer_object_tests.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,6 @@ TEST_F(DrmBufferObjectTest, whenExecFailsThenValidateHostPtrFails) {
140140
EXPECT_EQ(EINVAL, ret);
141141
}
142142

143-
TEST_F(DrmBufferObjectTest, whenSetImageAllocTypeForBOThenReturnProperValue) {
144-
TestedBufferObject bo(0u, this->mock.get());
145-
EXPECT_FALSE(bo.isImage());
146-
bo.setIsImage(AllocationType::kernelIsa);
147-
EXPECT_FALSE(bo.isImage());
148-
bo.setIsImage(AllocationType::image);
149-
EXPECT_TRUE(bo.isImage());
150-
}
151-
152143
TEST_F(DrmBufferObjectTest, givenResidentBOWhenPrintExecutionBufferIsSetToTrueThenDebugInformationAboutBOIsPrinted) {
153144
mock->ioctlExpected.total = 1;
154145
DebugManagerStateRestore restore;

shared/test/unit_test/os_interface/linux/drm_residency_handler_prelim_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ TEST_F(DrmMemoryOperationsHandlerBindMultiRootDeviceTest, whenSetNewResourceBoun
131131

132132
for (const auto &engine : device->getAllEngines()) {
133133
auto osContexLinux = static_cast<MockOsContextLinux *>(engine.osContext);
134-
if (osContexLinux->getDeviceBitfield().test(1u) && executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]->getProductHelper().isTlbFlushRequired(*executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]->getHardwareInfo(), true)) {
134+
if (osContexLinux->getDeviceBitfield().test(1u) && executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]->getProductHelper().isTlbFlushRequired()) {
135135
EXPECT_TRUE(osContexLinux->isTlbFlushRequired());
136136
} else {
137137
EXPECT_FALSE(osContexLinux->isTlbFlushRequired());
@@ -150,7 +150,7 @@ TEST_F(DrmMemoryOperationsHandlerBindMultiRootDeviceTest, whenSetNewResourceBoun
150150

151151
for (const auto &engine : devices[1]->getAllEngines()) {
152152
auto osContexLinux = static_cast<MockOsContextLinux *>(engine.osContext);
153-
if (osContexLinux->getDeviceBitfield().test(0u) && executionEnvironment->rootDeviceEnvironments[1]->getProductHelper().isTlbFlushRequired(*executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]->getHardwareInfo(), true)) {
153+
if (osContexLinux->getDeviceBitfield().test(0u) && executionEnvironment->rootDeviceEnvironments[1]->getProductHelper().isTlbFlushRequired()) {
154154
EXPECT_TRUE(osContexLinux->isTlbFlushRequired());
155155
} else {
156156
EXPECT_FALSE(osContexLinux->isTlbFlushRequired());
@@ -168,7 +168,7 @@ TEST_F(DrmMemoryOperationsHandlerBindMultiRootDeviceTest, whenSetNewResourceBoun
168168

169169
for (const auto &engine : device->getAllEngines()) {
170170
auto osContexLinux = static_cast<MockOsContextLinux *>(engine.osContext);
171-
if (osContexLinux->getDeviceBitfield().test(1u) && executionEnvironment->rootDeviceEnvironments[1]->getProductHelper().isTlbFlushRequired(*executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]->getHardwareInfo(), true)) {
171+
if (osContexLinux->getDeviceBitfield().test(1u) && executionEnvironment->rootDeviceEnvironments[1]->getProductHelper().isTlbFlushRequired()) {
172172
EXPECT_TRUE(osContexLinux->isTlbFlushRequired());
173173
} else {
174174
EXPECT_FALSE(osContexLinux->isTlbFlushRequired());

shared/test/unit_test/os_interface/product_helper_tests.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,15 +455,13 @@ HWTEST2_F(ProductHelperTest, givenProductHelperWhenAskedIfIsTimestampWaitSupport
455455
}
456456

457457
HWTEST2_F(ProductHelperTest, givenProductHelperWhenAskedIfIsTlbFlushRequiredThenTrueIsReturned, IsNotXeHpgOrXeHpcCore) {
458-
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, false));
459-
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, true));
458+
EXPECT_TRUE(productHelper->isTlbFlushRequired());
460459
}
461460

462461
HWTEST2_F(ProductHelperTest, givenProductHelperAndForceTlbFlushNotSetWhenAskedIfIsTlbFlushRequiredThenFalseIsReturned, IsNotPVC) {
463462
DebugManagerStateRestore restore{};
464463
debugManager.flags.ForceTlbFlush.set(0);
465-
EXPECT_FALSE(productHelper->isTlbFlushRequired(pInHwInfo, true));
466-
EXPECT_FALSE(productHelper->isTlbFlushRequired(pInHwInfo, false));
464+
EXPECT_FALSE(productHelper->isTlbFlushRequired());
467465
}
468466

469467
HWTEST_F(ProductHelperTest, givenLockableAllocationWhenGettingIsBlitCopyRequiredForLocalMemoryThenCorrectValuesAreReturned) {

shared/test/unit_test/os_interface/windows/wddm_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ TEST(WddmNewRsourceTest, whenSetNewResourcesBoundToPageTableThenSetInContextFrom
169169
}
170170
engines = executionEnvironment.memoryManager->getRegisteredEngines(1);
171171
for (const auto &engine : engines) {
172-
EXPECT_EQ(engine.osContext->peekTlbFlushCounter(), executionEnvironment.rootDeviceEnvironments[1]->getProductHelper().isTlbFlushRequired(*defaultHwInfo, true));
172+
EXPECT_EQ(engine.osContext->peekTlbFlushCounter(), executionEnvironment.rootDeviceEnvironments[1]->getProductHelper().isTlbFlushRequired());
173173
}
174174

175175
executionEnvironment.memoryManager->unregisterEngineForCsr(csr1.get());

shared/test/unit_test/xe_hpc_core/pvc/test_product_helper_pvc.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,13 @@ PVCTEST_F(PvcProductHelper, whenGettingAubstreamProductFamilyThenProperEnumValue
3030
}
3131

3232
PVCTEST_F(PvcProductHelper, whenCheckIsTlbFlushRequiredThenReturnProperValue) {
33-
EXPECT_FALSE(productHelper->isTlbFlushRequired(*defaultHwInfo, true));
34-
EXPECT_FALSE(productHelper->isTlbFlushRequired(*defaultHwInfo, false));
33+
EXPECT_FALSE(productHelper->isTlbFlushRequired());
3534
}
3635

3736
PVCTEST_F(PvcProductHelper, whenForceTlbFlushSetAndCheckIsTlbFlushRequiredThenReturnProperValue) {
3837
DebugManagerStateRestore restore;
3938
debugManager.flags.ForceTlbFlush.set(1);
40-
EXPECT_TRUE(productHelper->isTlbFlushRequired(*defaultHwInfo, false));
41-
EXPECT_TRUE(productHelper->isTlbFlushRequired(*defaultHwInfo, true));
39+
EXPECT_TRUE(productHelper->isTlbFlushRequired());
4240
}
4341

4442
PVCTEST_F(PvcProductHelper, givenPVCRevId3AndAboveWhenGettingThreadEuRatioForScratchThen16IsReturned) {

shared/test/unit_test/xe_hpg_core/dg2/linux/product_helper_tests_dg2.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
*/
77

88
#include "shared/source/os_interface/os_interface.h"
9-
#include "shared/source/xe_hpg_core/hw_cmds_dg2.h"
109
#include "shared/source/xe_hpg_core/hw_info_xe_hpg_core.h"
11-
#include "shared/test/common/helpers/debug_manager_state_restore.h"
1210
#include "shared/test/common/helpers/default_hw_info.h"
1311
#include "shared/test/common/helpers/gtest_helpers.h"
1412
#include "shared/test/common/libult/linux/drm_mock.h"
@@ -45,18 +43,3 @@ DG2TEST_F(Dg2ProductHelperLinux, GivenDg2WhenConfigureHardwareCustomThenKmdNotif
4543
EXPECT_TRUE(pInHwInfo.capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForDirectSubmission);
4644
EXPECT_EQ(20ll, pInHwInfo.capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForDirectSubmissionMicroseconds);
4745
}
48-
49-
DG2TEST_F(Dg2ProductHelperLinux, whenCheckIsTlbFlushRequiredThenReturnProperValue) {
50-
EXPECT_EQ(productHelper->isTlbFlushRequired(pInHwInfo, true), !DG2::isG10(pInHwInfo));
51-
EXPECT_FALSE(productHelper->isTlbFlushRequired(pInHwInfo, false));
52-
}
53-
54-
DG2TEST_F(Dg2ProductHelperLinux, whenForceTlbFlushSetAndCheckIsTlbFlushRequiredThenReturnProperValue) {
55-
DebugManagerStateRestore restore;
56-
debugManager.flags.ForceTlbFlush.set(1);
57-
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, false));
58-
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, true));
59-
debugManager.flags.ForceTlbFlush.set(0);
60-
EXPECT_FALSE(productHelper->isTlbFlushRequired(pInHwInfo, false));
61-
EXPECT_FALSE(productHelper->isTlbFlushRequired(pInHwInfo, true));
62-
}

shared/test/unit_test/xe_hpg_core/mtl/windows/product_helper_tests_mtl_windows.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ using namespace NEO;
1414
using MtlProductHelperWindows = ProductHelperTestWindows;
1515

1616
MTLTEST_F(MtlProductHelperWindows, whenCheckIsTlbFlushRequiredThenReturnProperValue) {
17-
EXPECT_TRUE(productHelper->isTlbFlushRequired(pInHwInfo, false));
17+
EXPECT_TRUE(productHelper->isTlbFlushRequired());
1818
}
1919

2020
MTLTEST_F(MtlProductHelperWindows, whenCheckingIsTimestampWaitSupportedForEventsThenReturnTrue) {

0 commit comments

Comments
 (0)