mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Add flags to control addresing mode of direct submission allocations
Related-To: NEO-4338 Change-Id: I40ff0110d0f414a0e2d0167e86d9a148b17a0921 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
b9ffd012be
commit
2dde71fa74
@ -739,6 +739,78 @@ TEST(MemoryManagerTest, givenDirectSemaphorePlacementSetWhenOverrideToSystemThen
|
||||
EXPECT_EQ(1u, allocationData.flags.useSystemMemory);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenDirectBufferAddressingWhenOverrideToNo48BitThenExpect48BitFlagFalse) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.DirectSubmissionBufferAddressing.set(0);
|
||||
AllocationData allocationData;
|
||||
AllocationProperties properties(0, 0x1000, GraphicsAllocation::AllocationType::RING_BUFFER);
|
||||
allocationData.flags.resource48Bit = 1;
|
||||
MockMemoryManager::overrideAllocationData(allocationData, properties);
|
||||
|
||||
EXPECT_EQ(0u, allocationData.flags.resource48Bit);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenDirectBufferAddressingWhenOverrideTo48BitThenExpect48BitFlagTrue) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.DirectSubmissionBufferAddressing.set(1);
|
||||
AllocationData allocationData;
|
||||
AllocationProperties properties(0, 0x1000, GraphicsAllocation::AllocationType::RING_BUFFER);
|
||||
allocationData.flags.resource48Bit = 0;
|
||||
MockMemoryManager::overrideAllocationData(allocationData, properties);
|
||||
|
||||
EXPECT_EQ(1u, allocationData.flags.resource48Bit);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenDirectBufferAddressingDefaultWhenNoOverrideThenExpect48BitFlagSame) {
|
||||
AllocationData allocationData;
|
||||
AllocationProperties properties(0, 0x1000, GraphicsAllocation::AllocationType::RING_BUFFER);
|
||||
allocationData.flags.resource48Bit = 0;
|
||||
MockMemoryManager::overrideAllocationData(allocationData, properties);
|
||||
|
||||
EXPECT_EQ(0u, allocationData.flags.resource48Bit);
|
||||
|
||||
allocationData.flags.resource48Bit = 1;
|
||||
MockMemoryManager::overrideAllocationData(allocationData, properties);
|
||||
|
||||
EXPECT_EQ(1u, allocationData.flags.resource48Bit);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenDirectSemaphoreAddressingWhenOverrideToNo48BitThenExpect48BitFlagFalse) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.DirectSubmissionSemaphoreAddressing.set(0);
|
||||
AllocationData allocationData;
|
||||
AllocationProperties properties(0, 0x1000, GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER);
|
||||
allocationData.flags.resource48Bit = 1;
|
||||
MockMemoryManager::overrideAllocationData(allocationData, properties);
|
||||
|
||||
EXPECT_EQ(0u, allocationData.flags.resource48Bit);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenDirectSemaphoreAddressingWhenOverrideTo48BitThenExpect48BitFlagTrue) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.DirectSubmissionSemaphoreAddressing.set(1);
|
||||
AllocationData allocationData;
|
||||
AllocationProperties properties(0, 0x1000, GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER);
|
||||
allocationData.flags.resource48Bit = 0;
|
||||
MockMemoryManager::overrideAllocationData(allocationData, properties);
|
||||
|
||||
EXPECT_EQ(1u, allocationData.flags.resource48Bit);
|
||||
}
|
||||
|
||||
TEST(MemoryManagerTest, givenDirectSemaphoreAddressingDefaultWhenNoOverrideThenExpect48BitFlagSame) {
|
||||
AllocationData allocationData;
|
||||
AllocationProperties properties(0, 0x1000, GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER);
|
||||
allocationData.flags.resource48Bit = 0;
|
||||
MockMemoryManager::overrideAllocationData(allocationData, properties);
|
||||
|
||||
EXPECT_EQ(0u, allocationData.flags.resource48Bit);
|
||||
|
||||
allocationData.flags.resource48Bit = 1;
|
||||
MockMemoryManager::overrideAllocationData(allocationData, properties);
|
||||
|
||||
EXPECT_EQ(1u, allocationData.flags.resource48Bit);
|
||||
}
|
||||
|
||||
using MemoryManagerGetAlloctionDataHaveToBeForcedTo48BitTest = testing::TestWithParam<std::tuple<GraphicsAllocation::AllocationType, bool>>;
|
||||
|
||||
TEST_P(MemoryManagerGetAlloctionDataHaveToBeForcedTo48BitTest, givenAllocationTypesHaveToBeForcedTo48BitThenAllocationDataResource48BitIsSet) {
|
||||
|
@ -138,4 +138,6 @@ WddmResidencyLogger = 0
|
||||
DirectSubmissionEnableDebugBuffer = 0
|
||||
DirectSubmissionDisableCacheFlush = 0
|
||||
DirectSubmissionDisableMonitorFence = 0
|
||||
ForceFineGrainedSVMSupport = -1
|
||||
ForceFineGrainedSVMSupport = -1
|
||||
DirectSubmissionBufferAddressing = -1
|
||||
DirectSubmissionSemaphoreAddressing = -1
|
@ -83,6 +83,8 @@ DECLARE_DEBUG_VARIABLE(int32_t, PrintDriverDiagnostics, -1, "prints driver diagn
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, EnableDirectSubmission, -1, "-1: default (disabled), 0: disable, 1:enable. Enables direct submission of command buffers bypassing KMD")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionBufferPlacement, -1, "-1: do not override, 0: non-system, 1: system")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionSemaphorePlacement, -1, "-1: do not override, 0: non-system, 1: system")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionBufferAddressing, -1, "-1: do not override, 0: not use 48bit, 1: use 48bit")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionSemaphoreAddressing, -1, "-1: do not override, 0: not use 48bit, 1: use 48bit")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionDisableCpuCacheFlush, -1, "-1: do not override, 0: disable, 1: enable")
|
||||
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionEnableDebugBuffer, 0, "0: diagnostic feature disabled - dispatch regular workload, 1: dispatch diagnostic buffer - mode 1 - single SDI command, 2: dispatch diagnostic buffer - mode 2 - no command")
|
||||
DECLARE_DEBUG_VARIABLE(bool, DirectSubmissionDisableCacheFlush, false, "Disable dispatching cache flush commands")
|
||||
|
@ -588,26 +588,45 @@ bool MemoryManager::isCopyRequired(ImageInfo &imgInfo, const void *hostPtr) {
|
||||
|
||||
void MemoryManager::overrideAllocationData(AllocationData &allocationData, const AllocationProperties &properties) {
|
||||
int32_t directRingPlacement = DebugManager.flags.DirectSubmissionBufferPlacement.get();
|
||||
if (properties.allocationType == GraphicsAllocation::AllocationType::RING_BUFFER &&
|
||||
directRingPlacement != -1) {
|
||||
if (directRingPlacement == 0) {
|
||||
allocationData.flags.requiresCpuAccess = true;
|
||||
allocationData.flags.useSystemMemory = false;
|
||||
} else {
|
||||
allocationData.flags.requiresCpuAccess = false;
|
||||
allocationData.flags.useSystemMemory = true;
|
||||
int32_t directRingAddressing = DebugManager.flags.DirectSubmissionBufferAddressing.get();
|
||||
if (properties.allocationType == GraphicsAllocation::AllocationType::RING_BUFFER) {
|
||||
if (directRingPlacement != -1) {
|
||||
if (directRingPlacement == 0) {
|
||||
allocationData.flags.requiresCpuAccess = true;
|
||||
allocationData.flags.useSystemMemory = false;
|
||||
} else {
|
||||
allocationData.flags.requiresCpuAccess = false;
|
||||
allocationData.flags.useSystemMemory = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (directRingAddressing != -1) {
|
||||
if (directRingAddressing == 0) {
|
||||
allocationData.flags.resource48Bit = false;
|
||||
} else {
|
||||
allocationData.flags.resource48Bit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
int32_t directSemaphorePlacement = DebugManager.flags.DirectSubmissionSemaphorePlacement.get();
|
||||
if (properties.allocationType == GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER &&
|
||||
directSemaphorePlacement != -1) {
|
||||
if (directSemaphorePlacement == 0) {
|
||||
allocationData.flags.requiresCpuAccess = true;
|
||||
allocationData.flags.useSystemMemory = false;
|
||||
} else {
|
||||
allocationData.flags.requiresCpuAccess = false;
|
||||
allocationData.flags.useSystemMemory = true;
|
||||
int32_t directSemaphoreAddressing = DebugManager.flags.DirectSubmissionSemaphoreAddressing.get();
|
||||
if (properties.allocationType == GraphicsAllocation::AllocationType::SEMAPHORE_BUFFER) {
|
||||
if (directSemaphorePlacement != -1) {
|
||||
if (directSemaphorePlacement == 0) {
|
||||
allocationData.flags.requiresCpuAccess = true;
|
||||
allocationData.flags.useSystemMemory = false;
|
||||
} else {
|
||||
allocationData.flags.requiresCpuAccess = false;
|
||||
allocationData.flags.useSystemMemory = true;
|
||||
}
|
||||
}
|
||||
if (directSemaphoreAddressing != -1) {
|
||||
if (directSemaphoreAddressing == 0) {
|
||||
allocationData.flags.resource48Bit = false;
|
||||
} else {
|
||||
allocationData.flags.resource48Bit = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace NEO
|
||||
} // namespace NEO
|
||||
|
Reference in New Issue
Block a user