mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
feature: allow to create immediate commandlist without specifying descriptor
created command list will take default descriptor which points to: - ordinal 0 - index 0 - in-order-execution - asynchronous execution - normal scheduling priority - copy offload hint enabled Related-To: NEO-14560 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
5ff380f076
commit
da7bcef07c
@@ -260,7 +260,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
|
||||
|
||||
commandList->copyThroughLockedPtrEnabled = gfxCoreHelper.copyThroughLockedPtrEnabled(hwInfo, productHelper);
|
||||
|
||||
const bool cmdListSupportsCopyOffload = !commandList->isCopyOnly(false) && commandList->isInOrderExecutionEnabled() && !productHelper.isDcFlushAllowed();
|
||||
const bool cmdListSupportsCopyOffload = !commandList->isCopyOnly(false) && commandList->isInOrderExecutionEnabled() && !productHelper.isDcFlushAllowed() && deviceImp->tryGetCopyEngineOrdinal().has_value();
|
||||
|
||||
if ((NEO::debugManager.flags.ForceCopyOperationOffloadForComputeCmdList.get() == 1 || queueProperties.copyOffloadHint) && cmdListSupportsCopyOffload) {
|
||||
commandList->enableCopyOperationOffload(productFamily, device, desc);
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "level_zero/core/source/event/event.h"
|
||||
#include "level_zero/core/source/fabric/fabric.h"
|
||||
#include "level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h"
|
||||
#include "level_zero/core/source/helpers/default_descriptors.h"
|
||||
#include "level_zero/core/source/helpers/properties_parser.h"
|
||||
#include "level_zero/core/source/image/image.h"
|
||||
#include "level_zero/core/source/module/module.h"
|
||||
@@ -288,11 +289,17 @@ ze_result_t DeviceImp::createInternalCommandList(const ze_command_list_desc_t *d
|
||||
|
||||
ze_result_t DeviceImp::createCommandListImmediate(const ze_command_queue_desc_t *desc,
|
||||
ze_command_list_handle_t *phCommandList) {
|
||||
if (!this->isQueueGroupOrdinalValid(desc->ordinal)) {
|
||||
|
||||
ze_command_queue_desc_t commandQueueDesc = DefaultDescriptors::commandQueueDesc;
|
||||
|
||||
if (desc) {
|
||||
commandQueueDesc = *desc;
|
||||
}
|
||||
|
||||
if (!this->isQueueGroupOrdinalValid(commandQueueDesc.ordinal)) {
|
||||
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
ze_command_queue_desc_t commandQueueDesc = *desc;
|
||||
adjustCommandQueueDesc(commandQueueDesc.ordinal, commandQueueDesc.index);
|
||||
|
||||
NEO::EngineGroupType engineGroupType = getEngineGroupTypeForOrdinal(commandQueueDesc.ordinal);
|
||||
@@ -301,7 +308,7 @@ ze_result_t DeviceImp::createCommandListImmediate(const ze_command_queue_desc_t
|
||||
ze_result_t returnValue = ZE_RESULT_SUCCESS;
|
||||
*phCommandList = CommandList::createImmediate(productFamily, this, &commandQueueDesc, false, engineGroupType, returnValue);
|
||||
if (returnValue == ZE_RESULT_SUCCESS) {
|
||||
CommandList::fromHandle(*phCommandList)->setOrdinal(desc->ordinal);
|
||||
CommandList::fromHandle(*phCommandList)->setOrdinal(commandQueueDesc.ordinal);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
@@ -431,6 +438,12 @@ uint32_t DeviceImp::getCopyQueueGroupsFromSubDevice(uint32_t numberOfSubDeviceCo
|
||||
}
|
||||
|
||||
uint32_t DeviceImp::getCopyEngineOrdinal() const {
|
||||
auto retVal = tryGetCopyEngineOrdinal();
|
||||
UNRECOVERABLE_IF(!retVal.has_value());
|
||||
return retVal.value();
|
||||
}
|
||||
|
||||
std::optional<uint32_t> DeviceImp::tryGetCopyEngineOrdinal() const {
|
||||
auto &engineGroups = neoDevice->getRegularEngineGroups();
|
||||
uint32_t i = 0;
|
||||
for (; i < static_cast<uint32_t>(engineGroups.size()); i++) {
|
||||
@@ -439,9 +452,10 @@ uint32_t DeviceImp::getCopyEngineOrdinal() const {
|
||||
}
|
||||
}
|
||||
|
||||
UNRECOVERABLE_IF(this->subDeviceCopyEngineGroups.size() == 0);
|
||||
|
||||
return i;
|
||||
if (this->subDeviceCopyEngineGroups.size() != 0) {
|
||||
return i;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
ze_result_t DeviceImp::getCommandQueueGroupProperties(uint32_t *pCount,
|
||||
|
||||
@@ -180,6 +180,7 @@ struct DeviceImp : public Device, NEO::NonCopyableAndNonMovableClass {
|
||||
uint32_t queryDeviceNodeMask();
|
||||
NEO::EngineGroupType getInternalEngineGroupType();
|
||||
uint32_t getCopyEngineOrdinal() const;
|
||||
std::optional<uint32_t> tryGetCopyEngineOrdinal() const;
|
||||
|
||||
protected:
|
||||
ze_result_t getGlobalTimestampsUsingSubmission(uint64_t *hostTimestamp, uint64_t *deviceTimestamp);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2022-2024 Intel Corporation
|
||||
# Copyright (C) 2022-2025 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@@ -9,6 +9,8 @@ target_sources(${L0_STATIC_LIB_NAME}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/api_handle_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/api_specific_config_l0.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/default_descriptors.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/default_descriptors.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/error_code_helper_l0.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/error_code_helper_l0.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/implicit_scaling_l0.cpp
|
||||
|
||||
31
level_zero/core/source/helpers/default_descriptors.cpp
Normal file
31
level_zero/core/source/helpers/default_descriptors.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/core/source/helpers/default_descriptors.h"
|
||||
|
||||
#include "level_zero/ze_intel_gpu.h"
|
||||
|
||||
namespace L0 {
|
||||
namespace DefaultDescriptors {
|
||||
|
||||
static const zex_intel_queue_copy_operations_offload_hint_exp_desc_t copyOffloadHint = {
|
||||
.stype = ZEX_INTEL_STRUCTURE_TYPE_QUEUE_COPY_OPERATIONS_OFFLOAD_HINT_EXP_PROPERTIES,
|
||||
.pNext = nullptr,
|
||||
.copyOffloadEnabled = true};
|
||||
|
||||
const ze_command_queue_desc_t commandQueueDesc = {
|
||||
.stype = ze_structure_type_t::ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC,
|
||||
.pNext = ©OffloadHint,
|
||||
.ordinal = 0,
|
||||
.index = 0,
|
||||
.flags = static_cast<ze_command_queue_flags_t>(ZE_COMMAND_QUEUE_FLAG_IN_ORDER),
|
||||
.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS,
|
||||
.priority = ZE_COMMAND_QUEUE_PRIORITY_NORMAL,
|
||||
};
|
||||
} // namespace DefaultDescriptors
|
||||
|
||||
} // namespace L0
|
||||
16
level_zero/core/source/helpers/default_descriptors.h
Normal file
16
level_zero/core/source/helpers/default_descriptors.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include <level_zero/ze_api.h>
|
||||
|
||||
namespace L0 {
|
||||
|
||||
namespace DefaultDescriptors {
|
||||
extern const ze_command_queue_desc_t commandQueueDesc;
|
||||
}
|
||||
} // namespace L0
|
||||
Reference in New Issue
Block a user