Add debug flag to force system memory placement.

-remove not needed Report64BitIdentifier
Signed-off-by: Michal Mrozek <michal.mrozek@intel.com>

Change-Id: Ic6ae96e2a575a088742f3b08eb40c5b400f93088
This commit is contained in:
Michal Mrozek
2020-04-06 18:47:34 +02:00
committed by sys_ocldev
parent 9311a9763d
commit 7b5778c048
5 changed files with 40 additions and 16 deletions

View File

@@ -127,6 +127,39 @@ TEST(MemoryManagerGetAlloctionDataTest, givenDebugModeToForceBuffersToSystemMemo
EXPECT_FALSE(allocData.flags.useSystemMemory);
}
TEST(MemoryManagerGetAlloctionDataTest, givenDebugModeWhenCertainAllocationTypesAreSelectedThenSystemPlacementIsChoosen) {
DebugManagerStateRestore restorer;
auto allocationType = GraphicsAllocation::AllocationType::BUFFER;
auto mask = 1llu << (static_cast<int64_t>(allocationType) - 1);
DebugManager.flags.ForceSystemMemoryPlacement.set(mask);
AllocationData allocData;
AllocationProperties properties(0, true, 0, allocationType, false);
MockMemoryManager mockMemoryManager;
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
EXPECT_TRUE(allocData.flags.useSystemMemory);
allocData.flags.useSystemMemory = false;
allocationType = GraphicsAllocation::AllocationType::WRITE_COMBINED;
mask |= 1llu << (static_cast<int64_t>(allocationType) - 1);
DebugManager.flags.ForceSystemMemoryPlacement.set(mask);
AllocationProperties properties2(0, true, 0, allocationType, false);
MockMemoryManager::getAllocationData(allocData, properties2, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties2));
EXPECT_TRUE(allocData.flags.useSystemMemory);
allocData.flags.useSystemMemory = false;
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
EXPECT_TRUE(allocData.flags.useSystemMemory);
allocData.flags.useSystemMemory = false;
DebugManager.flags.ForceSystemMemoryPlacement.set(8llu);
MockMemoryManager::getAllocationData(allocData, properties, nullptr, mockMemoryManager.createStorageInfoFromProperties(properties));
EXPECT_FALSE(allocData.flags.useSystemMemory);
}
typedef MemoryManagerGetAlloctionDataTest MemoryManagerGetAlloctionData32BitAnd64kbPagesAllowedTest;
TEST_P(MemoryManagerGetAlloctionData32BitAnd64kbPagesAllowedTest, givenAllocationTypesWith32BitAnd64kbPagesAllowedWhenAllocationDataIsQueriedThenProperFlagsAreSet) {

View File

@@ -60,10 +60,6 @@ void DebugSettingsManager<DebugLevel>::dumpNonDefaultFlag(const char *variableNa
template <DebugFunctionalityLevel DebugLevel>
void DebugSettingsManager<DebugLevel>::dumpFlags() const {
if (flags.Report64BitIdentifier.get()) {
std::cout << "Report64BitIdentifier flag value = " << flags.Report64BitIdentifier.get() << std::endl;
}
if (flags.PrintDebugSettings.get() == false) {
return;
}

View File

@@ -151,9 +151,9 @@ DECLARE_DEBUG_VARIABLE(int32_t, RenderCompressedBuffersEnabled, -1, "-1: default
DECLARE_DEBUG_VARIABLE(int32_t, EnableSharedSystemUsmSupport, -1, "-1: default, 0: shared system memory disabled, 1: shared system memory enabled")
DECLARE_DEBUG_VARIABLE(int32_t, EnablePassInlineData, -1, "-1: default, 0: Do not allow to pass inline data 1: Enable passing of inline data")
DECLARE_DEBUG_VARIABLE(int32_t, ForceFineGrainedSVMSupport, -1, "-1: default, 0: Do not report Fine Grained SVM capabilties 1: Report SVM Fine Grained capabilities if device supports SVM")
DECLARE_DEBUG_VARIABLE(int64_t, Report64BitIdentifier, 0, ">0: print this value during initialization to ensure that 64 bit debug variables are working properly.")
/*DRIVER TOGGLES*/
DECLARE_DEBUG_VARIABLE(int64_t, ForceSystemMemoryPlacement, 0, "0: default, >0: (bitmask) for given Graphics Allocation Type, force system memory placement")
DECLARE_DEBUG_VARIABLE(int32_t, ForceOCLVersion, 0, "Force specific OpenCL API version")
DECLARE_DEBUG_VARIABLE(int32_t, ForcePreemptionMode, -1, "Keep this variable in sync with PreemptionMode enum. -1 - devices default mode, 1 - disable, 2 - midBatch, 3 - threadGroup, 4 - midThread")
DECLARE_DEBUG_VARIABLE(int32_t, NodeOrdinal, -1, "-1: default do not override, 0: ENGINE_RCS")

View File

@@ -305,6 +305,12 @@ bool MemoryManager::getAllocationData(AllocationData &allocationData, const Allo
}
}
if (DebugManager.flags.ForceSystemMemoryPlacement.get()) {
if ((1llu << (static_cast<int64_t>(properties.allocationType) - 1)) & DebugManager.flags.ForceSystemMemoryPlacement.get()) {
allocationData.flags.useSystemMemory = true;
}
}
switch (properties.allocationType) {
case GraphicsAllocation::AllocationType::COMMAND_BUFFER:
case GraphicsAllocation::AllocationType::DEVICE_QUEUE_BUFFER:

View File

@@ -112,17 +112,6 @@ TEST(DebugSettingsManager, givenReaderImplInDebugManagerWhenSettingDifferentRead
EXPECT_EQ(readerImpl2, debugManager.getReaderImpl());
}
TEST(DebugSettingsManager, givenReport64BitIdetntifierFlagWhenDumpFlagsThen64BitValueIsPrinted) {
testing::internal::CaptureStdout();
FullyEnabledTestDebugManager debugManager;
debugManager.flags.Report64BitIdentifier.set(0xffffffffeeeeeeee);
debugManager.dumpFlags();
std::string output = testing::internal::GetCapturedStdout();
EXPECT_FALSE(output.compare("Report64BitIdentifier flag value = -286331154\n"));
}
TEST(DebugSettingsManager, givenPrintDebugSettingsEnabledWhenCallingDumpFlagsThenFlagsAreWrittenToDumpFile) {
testing::internal::CaptureStdout();
FullyEnabledTestDebugManager debugManager;