feature: enable copy offload api

Related-To: NEO-11376

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2024-06-12 09:25:42 +00:00
committed by Compute-Runtime-Automation
parent 037957a7ae
commit 2e9bb26708
4 changed files with 40 additions and 1 deletions

View File

@@ -251,7 +251,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
commandList->enableSynchronizedDispatch(queueProperties.synchronizedDispatchMode);
}
if ((NEO::debugManager.flags.ForceCopyOperationOffloadForComputeCmdList.get() == 1) && !commandList->isCopyOnly() && commandList->isInOrderExecutionEnabled()) {
if ((NEO::debugManager.flags.ForceCopyOperationOffloadForComputeCmdList.get() == 1 || queueProperties.copyOffloadHint) && !commandList->isCopyOnly() && commandList->isInOrderExecutionEnabled()) {
commandList->enableCopyOperationOffload(productFamily, device, desc);
}

View File

@@ -374,6 +374,8 @@ QueueProperties CommandQueue::extractQueueProperties(const ze_command_queue_desc
if (syncDispatchMode.has_value()) {
queueProperties.synchronizedDispatchMode = syncDispatchMode.value();
}
} else if (baseProperties->stype == ZEX_INTEL_STRUCTURE_TYPE_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_PROPERTIES) {
queueProperties.copyOffloadHint = static_cast<const zex_intel_queue_copy_operations_offload_hint_exp_desc_t *>(desc.pNext)->copyOffloadEnabled;
}
baseProperties = static_cast<const ze_base_desc_t *>(baseProperties->pNext);

View File

@@ -35,6 +35,7 @@ struct Device;
struct QueueProperties {
NEO::SynchronizedDispatchMode synchronizedDispatchMode = NEO::SynchronizedDispatchMode::disabled;
bool interruptHint = false;
bool copyOffloadHint = false;
};
struct CommandQueue : _ze_command_queue_handle_t {

View File

@@ -6922,6 +6922,42 @@ HWTEST2_F(CopyOffloadInOrderTests, givenDebugFlagSetWhenCreatingCmdListThenEnabl
}
}
HWTEST2_F(CopyOffloadInOrderTests, givenQueueDescriptorWhenCreatingCmdListThenEnableCopyOffload, IsAtLeastXeHpCore) {
NEO::debugManager.flags.ForceCopyOperationOffloadForComputeCmdList.set(-1);
ze_command_list_handle_t cmdListHandle;
zex_intel_queue_copy_operations_offload_hint_exp_desc_t copyOffloadDesc = {ZEX_INTEL_STRUCTURE_TYPE_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_PROPERTIES};
copyOffloadDesc.copyOffloadEnabled = true;
ze_command_queue_desc_t cmdQueueDesc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
cmdQueueDesc.priority = ZE_COMMAND_QUEUE_PRIORITY_NORMAL;
cmdQueueDesc.flags = ZE_COMMAND_QUEUE_FLAG_IN_ORDER;
cmdQueueDesc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
cmdQueueDesc.pNext = &copyOffloadDesc;
{
EXPECT_EQ(ZE_RESULT_SUCCESS, zeCommandListCreateImmediate(context, device, &cmdQueueDesc, &cmdListHandle));
auto cmdList = static_cast<WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>> *>(CommandList::fromHandle(cmdListHandle));
EXPECT_TRUE(cmdList->copyOperationOffloadEnabled);
EXPECT_NE(nullptr, cmdList->cmdQImmediateCopyOffload);
zeCommandListDestroy(cmdListHandle);
}
{
copyOffloadDesc.copyOffloadEnabled = false;
EXPECT_EQ(ZE_RESULT_SUCCESS, zeCommandListCreateImmediate(context, device, &cmdQueueDesc, &cmdListHandle));
auto cmdList = static_cast<WhiteBox<L0::CommandListCoreFamilyImmediate<gfxCoreFamily>> *>(CommandList::fromHandle(cmdListHandle));
EXPECT_FALSE(cmdList->copyOperationOffloadEnabled);
EXPECT_EQ(nullptr, cmdList->cmdQImmediateCopyOffload);
zeCommandListDestroy(cmdListHandle);
}
}
HWTEST2_F(CopyOffloadInOrderTests, givenCopyOffloadEnabledWhenProgrammingHwCmdsThenUserCopyCommands, IsAtLeastXeHpCore) {
using XY_COPY_BLT = typename std::remove_const<decltype(FamilyType::cmdInitXyCopyBlt)>::type;