XeHPC Implicit scaling: put command/ring/semaphore buffer to first memory bank

In direct submission scenario command/ring/semaphore buffer allocations
are placed in the same memory bank to ensure that their memory is updated in
correct order

Related-To: NEO-6698
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-03-16 18:41:29 +00:00
committed by Compute-Runtime-Automation
parent aa7ba69746
commit 3792481d33
7 changed files with 337 additions and 5 deletions

View File

@@ -282,6 +282,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionNewResourceTlbFlush, -1, "-1: dr
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionDisableMonitorFence, -1, "Disable dispatching monitor fence commands")
DECLARE_DEBUG_VARIABLE(int32_t, EnableDirectSubmissionController, -1, "Enable direct submission terminating after given timeout, -1: default, 0: disabled, 1: enabled")
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionControllerTimeout, -1, "Set direct submission controller timeout, -1: default 5 ms, >=0: timeout in ms")
DECLARE_DEBUG_VARIABLE(int32_t, DirectSubmissionForceLocalMemoryStorageMode, -1, "Force first memory bank storage for command/ring/semaphore buffer, -1: default - for multiOsContextCapable engine, 0: disabled, 1: for multiOsContextCapable engine, 2: for all engines")
/* IMPLICIT SCALING */
DECLARE_DEBUG_VARIABLE(int32_t, EnableWalkerPartition, -1, "-1: default, 0: disable, 1: enable, Enables Walker Partitioning via WPARID.")

View File

@@ -66,7 +66,7 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::allocateResources() {
const AllocationProperties commandStreamAllocationProperties{device.getRootDeviceIndex(),
true, allocationSize,
AllocationType::RING_BUFFER,
isMultiOsContextCapable, osContext.getDeviceBitfield()};
isMultiOsContextCapable, false, osContext.getDeviceBitfield()};
ringBuffer = memoryManager->allocateGraphicsMemoryWithProperties(commandStreamAllocationProperties);
UNRECOVERABLE_IF(ringBuffer == nullptr);
allocations.push_back(ringBuffer);
@@ -78,7 +78,7 @@ bool DirectSubmissionHw<GfxFamily, Dispatcher>::allocateResources() {
const AllocationProperties semaphoreAllocationProperties{device.getRootDeviceIndex(),
true, MemoryConstants::pageSize,
AllocationType::SEMAPHORE_BUFFER,
isMultiOsContextCapable, osContext.getDeviceBitfield()};
isMultiOsContextCapable, false, osContext.getDeviceBitfield()};
semaphores = memoryManager->allocateGraphicsMemoryWithProperties(semaphoreAllocationProperties);
UNRECOVERABLE_IF(semaphores == nullptr);
allocations.push_back(semaphores);

View File

@@ -153,6 +153,34 @@ StorageInfo MemoryManager::createStorageInfoFromProperties(const AllocationPrope
default:
break;
}
bool forceLocalMemoryForDirectSubmission = properties.flags.multiOsContextCapable;
switch (DebugManager.flags.DirectSubmissionForceLocalMemoryStorageMode.get()) {
case 0:
forceLocalMemoryForDirectSubmission = false;
break;
case 2:
forceLocalMemoryForDirectSubmission = true;
break;
default:
break;
}
if (forceLocalMemoryForDirectSubmission) {
if (properties.allocationType == AllocationType::COMMAND_BUFFER ||
properties.allocationType == AllocationType::RING_BUFFER ||
properties.allocationType == AllocationType::SEMAPHORE_BUFFER) {
storageInfo.memoryBanks = {};
for (auto bank = 0u; bank < deviceCount; bank++) {
if (allTilesValue.test(bank)) {
storageInfo.memoryBanks.set(bank);
break;
}
}
UNRECOVERABLE_IF(storageInfo.memoryBanks.none());
}
}
return storageInfo;
}
uint32_t StorageInfo::getNumBanks() const {

View File

@@ -239,6 +239,28 @@ void HwHelperHw<Family>::setExtraAllocationData(AllocationData &allocationData,
allocationData.flags.useSystemMemory = false;
}
bool forceLocalMemoryForDirectSubmission = properties.flags.multiOsContextCapable;
switch (DebugManager.flags.DirectSubmissionForceLocalMemoryStorageMode.get()) {
case 0:
forceLocalMemoryForDirectSubmission = false;
break;
case 2:
forceLocalMemoryForDirectSubmission = true;
break;
default:
break;
}
if (forceLocalMemoryForDirectSubmission) {
if (properties.allocationType == AllocationType::COMMAND_BUFFER ||
properties.allocationType == AllocationType::RING_BUFFER ||
properties.allocationType == AllocationType::SEMAPHORE_BUFFER) {
allocationData.flags.useSystemMemory = false;
allocationData.flags.requiresCpuAccess = true;
allocationData.flags.resource48Bit = true;
}
}
allocationData.cacheRegion = properties.cacheRegion;
if (allocationData.flags.requiresCpuAccess && !allocationData.flags.useSystemMemory &&