mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 15:53:45 +08:00
feature: enable defer backing by default
Related-To: NEO-13403 Signed-off-by: Bellekallu Rajkiran <bellekallu.rajkiran@intel.com> Signed-off-by: Narendra Bagria <narendra.bagria@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
84c7c6612b
commit
34d4e526e9
@@ -499,8 +499,8 @@ DECLARE_DEBUG_VARIABLE(bool, ForceSamplerLowFilteringPrecision, false, "Force Lo
|
|||||||
DECLARE_DEBUG_VARIABLE(bool, EnablePrivateBO, false, "Enable PRELIM_I915_GEM_CREATE_EXT_VM_PRIVATE extension creating VM_PRIVATE BOs")
|
DECLARE_DEBUG_VARIABLE(bool, EnablePrivateBO, false, "Enable PRELIM_I915_GEM_CREATE_EXT_VM_PRIVATE extension creating VM_PRIVATE BOs")
|
||||||
DECLARE_DEBUG_VARIABLE(bool, EnableAIL, true, "Enables AIL")
|
DECLARE_DEBUG_VARIABLE(bool, EnableAIL, true, "Enables AIL")
|
||||||
DECLARE_DEBUG_VARIABLE(bool, EnableReservingInSvmRange, true, "Enables reserving virtual memory in the SVM range")
|
DECLARE_DEBUG_VARIABLE(bool, EnableReservingInSvmRange, true, "Enables reserving virtual memory in the SVM range")
|
||||||
DECLARE_DEBUG_VARIABLE(bool, EnableDeferBacking, false, "Enables defer backing on xe kmd")
|
|
||||||
DECLARE_DEBUG_VARIABLE(bool, DisableProgrammableMetricsSupport, false, "Disable Programmable Metrics support")
|
DECLARE_DEBUG_VARIABLE(bool, DisableProgrammableMetricsSupport, false, "Disable Programmable Metrics support")
|
||||||
|
DECLARE_DEBUG_VARIABLE(int32_t, EnableDeferBacking, -1, "Enables defer backing on xe kmd, -1:default(enabled), 0:disable, 1:enable")
|
||||||
DECLARE_DEBUG_VARIABLE(int64_t, VmBindWaitUserFenceTimeout, -1, "-1: default, >0: time in ns for wait function timeout")
|
DECLARE_DEBUG_VARIABLE(int64_t, VmBindWaitUserFenceTimeout, -1, "-1: default, >0: time in ns for wait function timeout")
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, ForceRunAloneContext, -1, "Control creation of run-alone HW context, -1:default, 0:disable, 1:enable")
|
DECLARE_DEBUG_VARIABLE(int32_t, ForceRunAloneContext, -1, "Control creation of run-alone HW context, -1:default, 0:disable, 1:enable")
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, AddClGlSharing, -1, "Add cl-gl extension")
|
DECLARE_DEBUG_VARIABLE(int32_t, AddClGlSharing, -1, "Add cl-gl extension")
|
||||||
|
|||||||
@@ -268,6 +268,11 @@ bool IoctlHelperXe::initialize() {
|
|||||||
assignValue(tileIdToMediaGtId, gt.tile_id, gt.gt_id);
|
assignValue(tileIdToMediaGtId, gt.tile_id, gt.gt_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (debugManager.flags.EnableDeferBacking.get() != -1) {
|
||||||
|
enableDeferBacking = debugManager.flags.EnableDeferBacking.get();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -650,7 +655,7 @@ int IoctlHelperXe::createGemExt(const MemRegionsVec &memClassInstances, size_t a
|
|||||||
create.placement = static_cast<uint32_t>(memoryInstances.to_ulong());
|
create.placement = static_cast<uint32_t>(memoryInstances.to_ulong());
|
||||||
create.cpu_caching = this->getCpuCachingMode(isCoherent, isSysMemOnly);
|
create.cpu_caching = this->getCpuCachingMode(isCoherent, isSysMemOnly);
|
||||||
|
|
||||||
if (debugManager.flags.EnableDeferBacking.get()) {
|
if (enableDeferBacking) {
|
||||||
create.flags |= DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING;
|
create.flags |= DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -696,7 +701,7 @@ uint32_t IoctlHelperXe::createGem(uint64_t size, uint32_t memoryBanks, std::opti
|
|||||||
create.placement = static_cast<uint32_t>(memoryInstances.to_ulong());
|
create.placement = static_cast<uint32_t>(memoryInstances.to_ulong());
|
||||||
create.cpu_caching = this->getCpuCachingMode(isCoherent, isSysMemOnly);
|
create.cpu_caching = this->getCpuCachingMode(isCoherent, isSysMemOnly);
|
||||||
|
|
||||||
if (debugManager.flags.EnableDeferBacking.get()) {
|
if (enableDeferBacking) {
|
||||||
create.flags |= DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING;
|
create.flags |= DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1653,11 +1658,7 @@ bool IoctlHelperXe::isImmediateVmBindRequired() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IoctlHelperXe::makeResidentBeforeLockNeeded() const {
|
bool IoctlHelperXe::makeResidentBeforeLockNeeded() const {
|
||||||
auto makeResidentBeforeLockNeeded = false;
|
return enableDeferBacking;
|
||||||
if (debugManager.flags.EnableDeferBacking.get()) {
|
|
||||||
makeResidentBeforeLockNeeded = true;
|
|
||||||
}
|
|
||||||
return makeResidentBeforeLockNeeded;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void IoctlHelperXe::insertEngineToContextParams(ContextParamEngines<> &contextParamEngines, uint32_t engineId, const EngineClassInstance *engineClassInstance, uint32_t tileId, bool hasVirtualEngines) {
|
void IoctlHelperXe::insertEngineToContextParams(ContextParamEngines<> &contextParamEngines, uint32_t engineId, const EngineClassInstance *engineClassInstance, uint32_t tileId, bool hasVirtualEngines) {
|
||||||
|
|||||||
@@ -227,6 +227,8 @@ class IoctlHelperXe : public IoctlHelper {
|
|||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<EuDebugInterface> euDebugInterface;
|
std::unique_ptr<EuDebugInterface> euDebugInterface;
|
||||||
|
|
||||||
|
bool enableDeferBacking = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename... XeLogArgs>
|
template <typename... XeLogArgs>
|
||||||
|
|||||||
@@ -648,7 +648,7 @@ EnableTimestampPoolAllocator = -1
|
|||||||
PipelinedEuThreadArbitration = -1
|
PipelinedEuThreadArbitration = -1
|
||||||
ExperimentalUSMAllocationReuseCleaner = -1
|
ExperimentalUSMAllocationReuseCleaner = -1
|
||||||
DummyPageBackingEnabled = 0
|
DummyPageBackingEnabled = 0
|
||||||
EnableDeferBacking = 0
|
EnableDeferBacking = -1
|
||||||
ForceLowLatencyHint = -1
|
ForceLowLatencyHint = -1
|
||||||
EmitMemAdvisePriorToCopyForNonUsm = -1
|
EmitMemAdvisePriorToCopyForNonUsm = -1
|
||||||
TreatNonUsmForTransfersAsSharedSystem = -1
|
TreatNonUsmForTransfersAsSharedSystem = -1
|
||||||
|
|||||||
@@ -138,9 +138,6 @@ TEST_F(IoctlHelperXeGemCreateExtTests, givenIoctlHelperXeWhenCallingGemCreateExt
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(IoctlHelperXeGemCreateExtTests, givenIoctlHelperXeWhenCallingGemCreateExtWithOnlySystemRegionAndCoherencyThenWriteBackCPUCachingIsUsed) {
|
TEST_F(IoctlHelperXeGemCreateExtTests, givenIoctlHelperXeWhenCallingGemCreateExtWithOnlySystemRegionAndCoherencyThenWriteBackCPUCachingIsUsed) {
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
debugManager.flags.EnableDeferBacking.set(1);
|
|
||||||
|
|
||||||
MemRegionsVec memRegions = {systemMemory};
|
MemRegionsVec memRegions = {systemMemory};
|
||||||
bool isCoherent = true;
|
bool isCoherent = true;
|
||||||
|
|
||||||
@@ -149,10 +146,24 @@ TEST_F(IoctlHelperXeGemCreateExtTests, givenIoctlHelperXeWhenCallingGemCreateExt
|
|||||||
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING), (drm->createParamsFlags & DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING));
|
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING), (drm->createParamsFlags & DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(IoctlHelperXeGemCreateExtTests, givenIoctlHelperXeAndDeferBackingIsDisabledWhenCallingGemCreateExtThenVerifyGemCreateFlagsAreNotSet) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
debugManager.flags.EnableDeferBacking.set(0);
|
||||||
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
||||||
|
xeIoctlHelper->initialize();
|
||||||
|
MemRegionsVec memRegions = {systemMemory};
|
||||||
|
bool isCoherent = true;
|
||||||
|
|
||||||
|
EXPECT_NE(0, xeIoctlHelper->createGemExt(memRegions, allocSize, handle, patIndex, std::nullopt, pairHandle, isChunked, numOfChunks, std::nullopt, std::nullopt, isCoherent));
|
||||||
|
EXPECT_EQ(0u, drm->createParamsFlags);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndNoLocalMemoryThenProperValuesSet) {
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndNoLocalMemoryThenProperValuesSet) {
|
||||||
DebugManagerStateRestore restorer;
|
DebugManagerStateRestore restorer;
|
||||||
debugManager.flags.EnableLocalMemory.set(0);
|
debugManager.flags.EnableLocalMemory.set(0);
|
||||||
debugManager.flags.EnableDeferBacking.set(1);
|
debugManager.flags.EnableDeferBacking.set(0);
|
||||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
||||||
@@ -171,7 +182,7 @@ TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndNoLocalMemoryThe
|
|||||||
EXPECT_TRUE(xeIoctlHelper->bindInfo.empty());
|
EXPECT_TRUE(xeIoctlHelper->bindInfo.empty());
|
||||||
|
|
||||||
EXPECT_EQ(size, drm->createParamsSize);
|
EXPECT_EQ(size, drm->createParamsSize);
|
||||||
EXPECT_EQ(static_cast<uint32_t>(DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING), (drm->createParamsFlags & DRM_XE_GEM_CREATE_FLAG_DEFER_BACKING));
|
EXPECT_EQ(0u, drm->createParamsFlags);
|
||||||
EXPECT_EQ(DRM_XE_GEM_CPU_CACHING_WC, drm->createParamsCpuCaching);
|
EXPECT_EQ(DRM_XE_GEM_CPU_CACHING_WC, drm->createParamsCpuCaching);
|
||||||
EXPECT_EQ(1u, drm->createParamsPlacement);
|
EXPECT_EQ(1u, drm->createParamsPlacement);
|
||||||
|
|
||||||
@@ -183,7 +194,6 @@ TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndNoLocalMemoryThe
|
|||||||
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateWhenMemoryBanksZeroThenProperValuesSet) {
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateWhenMemoryBanksZeroThenProperValuesSet) {
|
||||||
DebugManagerStateRestore restorer;
|
DebugManagerStateRestore restorer;
|
||||||
debugManager.flags.EnableLocalMemory.set(0);
|
debugManager.flags.EnableLocalMemory.set(0);
|
||||||
debugManager.flags.EnableDeferBacking.set(1);
|
|
||||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
||||||
@@ -214,7 +224,6 @@ TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateWhenMemoryBanksZero
|
|||||||
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndLocalMemoryThenProperValuesSet) {
|
TEST_F(IoctlHelperXeTest, givenIoctlHelperXeWhenCallGemCreateAndLocalMemoryThenProperValuesSet) {
|
||||||
DebugManagerStateRestore restorer;
|
DebugManagerStateRestore restorer;
|
||||||
debugManager.flags.EnableLocalMemory.set(1);
|
debugManager.flags.EnableLocalMemory.set(1);
|
||||||
debugManager.flags.EnableDeferBacking.set(1);
|
|
||||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
||||||
@@ -3007,15 +3016,24 @@ TEST_F(IoctlHelperXeTest, whenQueryDeviceIdAndRevisionAndSharedSystemUsmSupportD
|
|||||||
EXPECT_FALSE(drm->isSharedSystemAllocEnabled());
|
EXPECT_FALSE(drm->isSharedSystemAllocEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(IoctlHelperXeTest, givenXeIoctlHelperAndDeferBackingFlagSetToTrueWhenMakeResidentBeforeLockNeededIsCalledThenVerifyTrueIsReturned) {
|
TEST_F(IoctlHelperXeTest, givenXeIoctlHelperWhenMakeResidentBeforeLockNeededIsCalledThenVerifyTrueIsReturned) {
|
||||||
DebugManagerStateRestore restorer;
|
|
||||||
debugManager.flags.EnableDeferBacking.set(1);
|
|
||||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
DrmMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
auto xeIoctlHelper = std::make_unique<IoctlHelperXe>(drm);
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
||||||
|
xeIoctlHelper->initialize();
|
||||||
EXPECT_TRUE(xeIoctlHelper->makeResidentBeforeLockNeeded());
|
EXPECT_TRUE(xeIoctlHelper->makeResidentBeforeLockNeeded());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(IoctlHelperXeTest, givenXeIoctlHelperAndDeferBackingFlagSetToFalseWhenMakeResidentBeforeLockNeededIsCalledThenVerifyTrueIsReturned) {
|
||||||
|
DebugManagerStateRestore restorer;
|
||||||
|
debugManager.flags.EnableDeferBacking.set(0);
|
||||||
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
|
auto drm = DrmMockXe::create(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||||
|
auto xeIoctlHelper = static_cast<MockIoctlHelperXe *>(drm->getIoctlHelper());
|
||||||
|
xeIoctlHelper->initialize();
|
||||||
|
EXPECT_FALSE(xeIoctlHelper->makeResidentBeforeLockNeeded());
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(IoctlHelperXeTest, givenXeIoctlHelperWhenCreateDrmContextAndLowLatencyHintNotAvailableThenNoFlagIsSet) {
|
TEST_F(IoctlHelperXeTest, givenXeIoctlHelperWhenCreateDrmContextAndLowLatencyHintNotAvailableThenNoFlagIsSet) {
|
||||||
class MockLinuxOsContext : public OsContextLinux {
|
class MockLinuxOsContext : public OsContextLinux {
|
||||||
public:
|
public:
|
||||||
|
|||||||
Reference in New Issue
Block a user