feature: Add keys to override sync mode for immediate command list

Added OverrideImmediateCmdListSynchronousMode to override synchronous
mode for immediate command list

Related-To: NEO-10316
Signed-off-by: Yoon, Young Jin <young.jin.yoon@intel.com>
This commit is contained in:
Yoon, Young Jin
2024-02-07 18:02:03 +00:00
committed by Compute-Runtime-Automation
parent 0b64240deb
commit 97ef964bc4
4 changed files with 50 additions and 5 deletions

View File

@@ -157,6 +157,12 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
bool internalUsage, NEO::EngineGroupType engineGroupType,
ze_result_t &returnValue) {
ze_command_queue_desc_t cmdQdesc = *desc;
int32_t overrideImmediateCmdListSyncMode = NEO::debugManager.flags.OverrideImmediateCmdListSynchronousMode.get();
if (overrideImmediateCmdListSyncMode != -1) {
cmdQdesc.mode = static_cast<ze_command_queue_mode_t>(overrideImmediateCmdListSyncMode);
}
CommandListAllocatorFn allocator = nullptr;
if (productFamily < IGFX_MAX_PRODUCT) {
allocator = commandListFactoryImmediate[productFamily];
@@ -179,7 +185,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
engineGroupType = deviceImp->getInternalEngineGroupType();
}
} else {
returnValue = device->getCsrForOrdinalAndIndexWithPriority(&csr, desc->ordinal, desc->index, desc->priority);
returnValue = device->getCsrForOrdinalAndIndexWithPriority(&csr, cmdQdesc.ordinal, cmdQdesc.index, cmdQdesc.priority);
if (returnValue != ZE_RESULT_SUCCESS) {
return commandList;
}
@@ -191,7 +197,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
commandList->csr = csr;
commandList->internalUsage = internalUsage;
commandList->cmdListType = CommandListType::typeImmediate;
commandList->isSyncModeQueue = (desc->mode == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS);
commandList->isSyncModeQueue = (cmdQdesc.mode == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS);
if (!internalUsage) {
auto &productHelper = device->getProductHelper();
@@ -209,7 +215,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
csr->initDirectSubmission();
returnValue = commandList->initialize(device, engineGroupType, 0);
if ((desc->flags & ZE_COMMAND_QUEUE_FLAG_IN_ORDER) || (NEO::debugManager.flags.ForceInOrderImmediateCmdListExecution.get() == 1)) {
if ((cmdQdesc.flags & ZE_COMMAND_QUEUE_FLAG_IN_ORDER) || (NEO::debugManager.flags.ForceInOrderImmediateCmdListExecution.get() == 1)) {
commandList->enableInOrderExecution();
}
@@ -219,7 +225,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
return commandList;
}
auto commandQueue = CommandQueue::create(productFamily, device, csr, desc, commandList->isCopyOnly(), internalUsage, true, returnValue);
auto commandQueue = CommandQueue::create(productFamily, device, csr, &cmdQdesc, commandList->isCopyOnly(), internalUsage, true, returnValue);
if (!commandQueue) {
commandList->destroy();
commandList = nullptr;
@@ -230,7 +236,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
commandList->isTbxMode = csr->isTbxMode();
commandList->commandListPreemptionMode = device->getDevicePreemptionMode();
commandList->isBcsSplitNeeded = deviceImp->bcsSplit.setupDevice(productFamily, internalUsage, desc, csr);
commandList->isBcsSplitNeeded = deviceImp->bcsSplit.setupDevice(productFamily, internalUsage, &cmdQdesc, csr);
commandList->copyThroughLockedPtrEnabled = gfxCoreHelper.copyThroughLockedPtrEnabled(hwInfo, device->getProductHelper());

View File

@@ -975,6 +975,43 @@ TEST_F(CommandListCreate, whenCreatingImmediateCommandListWithASyncModeThenItHas
EXPECT_NE(nullptr, static_cast<CommandList *>(commandList.get())->cmdQImmediate);
}
TEST_F(CommandListCreate, givenAsynchronousOverrideWhenCreatingImmediateCommandListWithSyncModeThenAynchronousCommandQueueIsCreated) {
DebugManagerStateRestore restore;
debugManager.flags.OverrideImmediateCmdListSynchronousMode.set(2);
ze_command_queue_desc_t desc = {};
desc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::renderCompute, returnValue));
ASSERT_NE(nullptr, commandList);
auto whiteBoxCmdList = static_cast<CommandList *>(commandList.get());
EXPECT_EQ(device, commandList->getDevice());
EXPECT_TRUE(commandList->isImmediateType());
EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate);
EXPECT_FALSE(whiteBoxCmdList->isSyncModeQueue);
EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS, static_cast<CommandQueueImp *>(whiteBoxCmdList->cmdQImmediate)->getCommandQueueMode());
}
TEST_F(CommandListCreate, givenSynchronousOverrideWhenCreatingImmediateCommandListWithAsyncModeThenSynchronousCommandQueueIsCreated) {
DebugManagerStateRestore restore;
debugManager.flags.OverrideImmediateCmdListSynchronousMode.set(1);
ze_command_queue_desc_t desc = {};
desc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::renderCompute, returnValue));
ASSERT_NE(nullptr, commandList);
auto whiteBoxCmdList = static_cast<CommandList *>(commandList.get());
EXPECT_EQ(device, commandList->getDevice());
EXPECT_TRUE(commandList->isImmediateType());
EXPECT_NE(nullptr, whiteBoxCmdList->cmdQImmediate);
EXPECT_TRUE(whiteBoxCmdList->isSyncModeQueue);
EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS, static_cast<CommandQueueImp *>(whiteBoxCmdList->cmdQImmediate)->getCommandQueueMode());
}
TEST_F(CommandListCreate, whenCreatingImmCmdListWithSyncModeAndAppendSignalEventThenUpdateTaskCountNeededFlagIsDisabled) {
ze_command_queue_desc_t desc = {};
desc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;

View File

@@ -173,6 +173,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, ForceExecutionTile, -1, "-1: default, 0+: given
DECLARE_DEBUG_VARIABLE(int32_t, OverrideTimestampPacketSize, -1, "-1: default, >0: size in bytes. 4 and 8 supported for experiments")
DECLARE_DEBUG_VARIABLE(int32_t, OverrideMaxWorkGroupCount, -1, "-1: default, >0: Max WG size")
DECLARE_DEBUG_VARIABLE(int32_t, OverrideCmdQueueSynchronousMode, -1, "Overrides all command queues synchronous mode: -1: do not override, 0: implicit driver behavior, 1: synchronous, 2: asynchronous")
DECLARE_DEBUG_VARIABLE(int32_t, OverrideImmediateCmdListSynchronousMode, -1, "Overrides all immediate command lists synchronous mode: -1: do not override, 0: implicit driver behavior, 1: synchronous, 2: asynchronous")
DECLARE_DEBUG_VARIABLE(int32_t, EnableStatelessCompression, -1, "-1: default, 0: disable, 1: Enable E2EC in SBA for all stateless accesses")
DECLARE_DEBUG_VARIABLE(int32_t, EnableMultiTileCompression, -1, "-1: default, 0: disable, 1: enable, Enables compression in multi tile scenarios.")
DECLARE_DEBUG_VARIABLE(int32_t, OverrideGmmResourceUsageField, -1, "-1: default, >=0: gmm.resourceParams.Usage is set to this value")

View File

@@ -359,6 +359,7 @@ EnableCmdQRoundRobindBcsEngineAssignLimit = -1
EnableCmdQRoundRobindBcsEngineAssignStartingValue = -1
ForceBCSForInternalCopyEngine = -1
OverrideCmdQueueSynchronousMode = -1
OverrideImmediateCmdListSynchronousMode = -1
UseAtomicsForSelfCleanupSection = -1
HBMSizePerTileInGigabytes = 0
OverrideSystolicPipelineSelect = -1