Skip to content

Commit dc0c13c

Browse files
feature: set device allocation chunking as default
Device allocation chunking only applies for multi-tile mode for implicit scaling Related-To: NEO-9051 Signed-off-by: John Falkowski <john.falkowski@intel.com> Source: f0175b3
1 parent d8be982 commit dc0c13c

File tree

6 files changed

+38
-8
lines changed

6 files changed

+38
-8
lines changed

shared/source/debug_settings/debug_variables_base.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ DECLARE_DEBUG_VARIABLE(bool, PrintBOChunkingLogs, false, "Print some logs on BO
524524
DECLARE_DEBUG_VARIABLE(bool, EnableBOChunkingPrefetch, false, "Enables prefetching of Shared Memory chunks")
525525
DECLARE_DEBUG_VARIABLE(bool, EnableBOChunkingDevMemPrefetch, false, "Enables prefetching of Device Memory chunks")
526526
DECLARE_DEBUG_VARIABLE(bool, EnableBOChunkingPreferredLocationHint, false, "Enables preferred location advise on chunks")
527-
DECLARE_DEBUG_VARIABLE(int32_t, EnableBOChunking, 0, "Enables use of chunking of BOs in the KMD, mask: 0 = no chunking, 1 = shared allocations only, 2 = device allocations only, 3 = shared and device allocations .")
527+
DECLARE_DEBUG_VARIABLE(int32_t, EnableBOChunking, -1, "Enables use of chunking of BOs in the KMD, mask: -1 = default, 0 = no chunking, 1 = shared allocations only, 2 = multi-tile device allocations only, 3 = shared and multi-tile device allocations .")
528528
DECLARE_DEBUG_VARIABLE(int32_t, NumberOfBOChunks, 2, "Number of chunks to use. Must be a power of two)")
529529
DECLARE_DEBUG_VARIABLE(int32_t, MinimalAllocationSizeForChunking, -1, "2097152: default, >0: size in B. Minimal size an allocation should have to use chunking.")
530530
DECLARE_DEBUG_VARIABLE(int32_t, ForceAutoGrfCompilationMode, -1, "Adds build option -*-intel-enable-auto-large-GRF-mode to force kernel compilation")

shared/source/os_interface/linux/drm_memory_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2288,7 +2288,7 @@ GraphicsAllocation *DrmMemoryManager::createSharedUnifiedMemoryAllocation(const
22882288

22892289
// Dont chunk for sizes less than chunkThreshold or if debugging is enabled
22902290
if (!executionEnvironment.isDebuggingEnabled() &&
2291-
(drm.getChunkingMode() & 0x01) &&
2291+
(drm.getChunkingMode() & chunkingModeShared) &&
22922292
!(chunkingSize & (MemoryConstants::chunkThreshold - 1)) &&
22932293
size >= drm.getMinimalSizeForChunking()) {
22942294
numHandles = 1;

shared/source/os_interface/linux/drm_neo.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,11 @@ bool Drm::isChunkingAvailable() {
11571157
int ret = ioctlHelper->isChunkingAvailable();
11581158
if (ret) {
11591159
chunkingAvailable = true;
1160-
chunkingMode = DebugManager.flags.EnableBOChunking.get();
1160+
if (DebugManager.flags.EnableBOChunking.get() == -1) {
1161+
chunkingMode = chunkingModeDevice;
1162+
} else {
1163+
chunkingMode = DebugManager.flags.EnableBOChunking.get();
1164+
}
11611165
}
11621166

11631167
if (DebugManager.flags.MinimalAllocationSizeForChunking.get() != -1) {
@@ -1167,8 +1171,8 @@ bool Drm::isChunkingAvailable() {
11671171
printDebugString(DebugManager.flags.PrintBOChunkingLogs.get(), stdout,
11681172
"Chunking available: %d; enabled for: shared allocations %d, device allocations %d; minimalChunkingSize: %zd\n",
11691173
chunkingAvailable,
1170-
(chunkingMode & 0x01),
1171-
(chunkingMode & 0x02),
1174+
(chunkingMode & chunkingModeShared),
1175+
(chunkingMode & chunkingModeDevice),
11721176
minimalChunkingSize);
11731177
});
11741178
}

shared/source/os_interface/linux/drm_neo.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ enum EngineType : uint32_t;
3535

3636
namespace NEO {
3737
constexpr uint32_t contextPrivateParamBoost = 0x80000000;
38+
constexpr uint32_t chunkingModeShared = 1;
39+
constexpr uint32_t chunkingModeDevice = 2;
3840

3941
enum class AllocationType;
4042
enum class CachePolicy : uint32_t;

shared/test/common/test_files/igdrcl.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ EnableBOChunkingPrefetch = 0
522522
EnableBOChunkingDevMemPrefetch = 0
523523
EnableBOChunkingPreferredLocationHint = 0
524524
NumberOfBOChunks = 2
525-
EnableBOChunking = 0
525+
EnableBOChunking = -1
526526
MinimalAllocationSizeForChunking = -1
527527
DirectSubmissionControllerMaxTimeout = -1
528528
ExitOnSubmissionNumber = -1

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,10 +1483,34 @@ TEST(DrmSetPairTests, whenQueryingForSetPairAvailableAndNoDebugKeyThenFalseIsRet
14831483
EXPECT_EQ(0u, drm.context.setPairQueryCalled);
14841484
}
14851485

1486-
TEST(DrmChunkingTests, whenQueryingForChunkingAvailableAndNoDebugKeyThenFalseIsReturned) {
1486+
TEST(DrmChunkingTests, whenQueryingForChunkingAvailableAndDefaultDebugVariableThenTrueIsReturned) {
1487+
DebugManagerStateRestore restorer;
1488+
DebugManager.flags.UseKmdMigration.set(1);
1489+
1490+
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
1491+
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
1492+
1493+
drm.context.chunkingQueryValue = 1;
1494+
drm.context.chunkingQueryReturn = 0;
1495+
EXPECT_FALSE(drm.chunkingAvailable);
1496+
1497+
EXPECT_EQ(0u, drm.context.chunkingQueryCalled);
1498+
drm.callBaseIsChunkingAvailable = true;
1499+
EXPECT_TRUE(drm.isChunkingAvailable());
1500+
EXPECT_TRUE(drm.getChunkingAvailable());
1501+
EXPECT_EQ(1u, drm.context.chunkingQueryCalled);
1502+
EXPECT_EQ(2u, drm.getChunkingMode());
1503+
}
1504+
1505+
TEST(DrmChunkingTests, whenQueryingForChunkingAvailableAndDisableDebugVariableThenFalseIsReturned) {
1506+
DebugManagerStateRestore restorer;
1507+
DebugManager.flags.EnableBOChunking.set(0);
1508+
DebugManager.flags.UseKmdMigration.set(1);
1509+
14871510
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
14881511
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
1489-
drm.context.chunkingQueryValue = 0;
1512+
1513+
drm.context.chunkingQueryValue = 1;
14901514
drm.context.chunkingQueryReturn = 0;
14911515
EXPECT_FALSE(drm.chunkingAvailable);
14921516

0 commit comments

Comments
 (0)