mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-27 07:44:16 +08:00
This change gives fine grain control over front end configuration for each kernel. As it gives possible to inject FE command in command queue and return to exact place in command list. Programming commands in queue makes patching commands in command lists not needed as that operation is costly. And it allows to program context information for each command list too. Related-To: NEO-5019 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
78 lines
2.6 KiB
C++
78 lines
2.6 KiB
C++
/*
|
|
* Copyright (C) 2020-2022 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "shared/source/command_stream/preemption_mode.h"
|
|
|
|
#include <level_zero/ze_api.h>
|
|
|
|
#include <atomic>
|
|
|
|
struct _ze_command_queue_handle_t {};
|
|
|
|
namespace NEO {
|
|
class CommandStreamReceiver;
|
|
}
|
|
|
|
namespace L0 {
|
|
struct Device;
|
|
|
|
struct CommandQueue : _ze_command_queue_handle_t {
|
|
template <typename Type>
|
|
struct Allocator {
|
|
static CommandQueue *allocate(Device *device, NEO::CommandStreamReceiver *csr, const ze_command_queue_desc_t *desc) {
|
|
return new Type(device, csr, desc);
|
|
}
|
|
};
|
|
|
|
virtual ~CommandQueue() = default;
|
|
|
|
virtual ze_result_t createFence(const ze_fence_desc_t *desc, ze_fence_handle_t *phFence) = 0;
|
|
virtual ze_result_t destroy() = 0;
|
|
virtual ze_result_t executeCommandLists(uint32_t numCommandLists,
|
|
ze_command_list_handle_t *phCommandLists,
|
|
ze_fence_handle_t hFence, bool performMigration) = 0;
|
|
virtual ze_result_t executeCommands(uint32_t numCommands,
|
|
void *phCommands,
|
|
ze_fence_handle_t hFence) = 0;
|
|
virtual ze_result_t synchronize(uint64_t timeout) = 0;
|
|
|
|
static CommandQueue *create(uint32_t productFamily, Device *device, NEO::CommandStreamReceiver *csr,
|
|
const ze_command_queue_desc_t *desc, bool isCopyOnly, bool isInternal, ze_result_t &resultValue);
|
|
|
|
static CommandQueue *fromHandle(ze_command_queue_handle_t handle) {
|
|
return static_cast<CommandQueue *>(handle);
|
|
}
|
|
|
|
ze_command_queue_handle_t toHandle() { return this; }
|
|
|
|
bool peekIsCopyOnlyCommandQueue() const { return this->isCopyOnlyCommandQueue; }
|
|
|
|
protected:
|
|
uint32_t partitionCount = 1;
|
|
uint32_t activeSubDevices = 1;
|
|
bool preemptionCmdSyncProgramming = true;
|
|
bool commandQueueDebugCmdsProgrammed = false;
|
|
bool isCopyOnlyCommandQueue = false;
|
|
bool internalUsage = false;
|
|
bool multiReturnPointCommandList = false;
|
|
};
|
|
|
|
using CommandQueueAllocatorFn = CommandQueue *(*)(Device *device, NEO::CommandStreamReceiver *csr,
|
|
const ze_command_queue_desc_t *desc);
|
|
extern CommandQueueAllocatorFn commandQueueFactory[];
|
|
|
|
template <uint32_t productFamily, typename CommandQueueType>
|
|
struct CommandQueuePopulateFactory {
|
|
CommandQueuePopulateFactory() {
|
|
commandQueueFactory[productFamily] = CommandQueue::Allocator<CommandQueueType>::allocate;
|
|
}
|
|
};
|
|
|
|
} // namespace L0
|