mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
fix: Enqueue blocking support for L0
Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5afc63df93
commit
c617048f1a
@@ -205,6 +205,9 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
|
||||
commandList->internalUsage = internalUsage;
|
||||
commandList->cmdListType = CommandListType::typeImmediate;
|
||||
commandList->isSyncModeQueue = (cmdQdesc.mode == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS);
|
||||
if (NEO::debugManager.flags.MakeEachEnqueueBlocking.get()) {
|
||||
commandList->isSyncModeQueue |= true;
|
||||
}
|
||||
|
||||
if (!internalUsage) {
|
||||
auto &productHelper = device->getProductHelper();
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "shared/source/command_stream/submission_status.h"
|
||||
#include "shared/source/command_stream/task_count_helper.h"
|
||||
#include "shared/source/command_stream/wait_status.h"
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/helpers/completion_stamp.h"
|
||||
#include "shared/source/utilities/stackvec.h"
|
||||
|
||||
@@ -92,7 +93,11 @@ struct CommandQueueImp : public CommandQueue {
|
||||
}
|
||||
|
||||
bool isSynchronousMode() const {
|
||||
return getCommandQueueMode() == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
|
||||
bool syncMode = getCommandQueueMode() == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
|
||||
if (NEO::debugManager.flags.MakeEachEnqueueBlocking.get()) {
|
||||
syncMode |= true;
|
||||
}
|
||||
return syncMode;
|
||||
}
|
||||
|
||||
virtual bool getPreemptionCmdProgramming() = 0;
|
||||
|
||||
@@ -986,7 +986,7 @@ TEST_F(CommandListCreate, whenCreatingImmediateCommandListWithASyncModeThenItHas
|
||||
EXPECT_NE(nullptr, static_cast<CommandList *>(commandList.get())->cmdQImmediate);
|
||||
}
|
||||
|
||||
TEST_F(CommandListCreate, givenAsynchronousOverrideWhenCreatingImmediateCommandListWithSyncModeThenAynchronousCommandQueueIsCreated) {
|
||||
TEST_F(CommandListCreate, givenAsynchronousOverrideWhenCreatingImmediateCommandListWithSyncModeThenAsynchronousCommandQueueIsCreated) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.OverrideImmediateCmdListSynchronousMode.set(2);
|
||||
ze_command_queue_desc_t desc = {};
|
||||
@@ -1004,6 +1004,24 @@ TEST_F(CommandListCreate, givenAsynchronousOverrideWhenCreatingImmediateCommandL
|
||||
EXPECT_EQ(ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS, static_cast<CommandQueueImp *>(whiteBoxCmdList->cmdQImmediate)->getCommandQueueMode());
|
||||
}
|
||||
|
||||
TEST_F(CommandListCreate, givenMakeEnqueueBlockingWhenCreatingImmediateCommandListWithASyncModeThenASynchronousCommandQueueIsCreatedButisSyncModeIsTrue) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.MakeEachEnqueueBlocking.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_ASYNCHRONOUS, static_cast<CommandQueueImp *>(whiteBoxCmdList->cmdQImmediate)->getCommandQueueMode());
|
||||
}
|
||||
|
||||
TEST_F(CommandListCreate, givenSynchronousOverrideWhenCreatingImmediateCommandListWithAsyncModeThenSynchronousCommandQueueIsCreated) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.OverrideImmediateCmdListSynchronousMode.set(1);
|
||||
|
||||
@@ -2259,5 +2259,39 @@ TEST_F(DeviceCreateCommandQueueTest, givenDeviceWhenCreateCommandQueueForValidOr
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(DeviceCreateCommandQueueTest, givenMakeEachEnqueueBlockingSetToOneWhenIsSynchronousModeIsCalledThenReturnsTrue) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.MakeEachEnqueueBlocking.set(1);
|
||||
|
||||
ze_command_queue_desc_t desc{};
|
||||
desc.ordinal = 0u;
|
||||
desc.index = 0u;
|
||||
desc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
|
||||
|
||||
ze_command_queue_handle_t commandQueueHandle = {};
|
||||
|
||||
device->createCommandQueue(&desc, &commandQueueHandle);
|
||||
auto commandQueueImp = static_cast<CommandQueueImp *>(L0::CommandQueue::fromHandle(commandQueueHandle));
|
||||
EXPECT_TRUE(commandQueueImp->isSynchronousMode());
|
||||
commandQueueImp->destroy();
|
||||
}
|
||||
|
||||
TEST_F(DeviceCreateCommandQueueTest, givenMakeEachEnqueueBlockingSetToZeroWhenIsSynchronousModeIsCalledThenReturnsFalse) {
|
||||
DebugManagerStateRestore restore;
|
||||
debugManager.flags.MakeEachEnqueueBlocking.set(0);
|
||||
|
||||
ze_command_queue_desc_t desc{};
|
||||
desc.ordinal = 0u;
|
||||
desc.index = 0u;
|
||||
desc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
|
||||
|
||||
ze_command_queue_handle_t commandQueueHandle = {};
|
||||
|
||||
device->createCommandQueue(&desc, &commandQueueHandle);
|
||||
auto commandQueueImp = static_cast<CommandQueueImp *>(L0::CommandQueue::fromHandle(commandQueueHandle));
|
||||
EXPECT_FALSE(commandQueueImp->isSynchronousMode());
|
||||
commandQueueImp->destroy();
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
} // namespace L0
|
||||
|
||||
Reference in New Issue
Block a user