2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2020-01-14 21:32:11 +08:00
|
|
|
* Copyright (C) 2017-2020 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/command_stream/linear_stream.h"
|
|
|
|
#include "shared/source/helpers/ptr_math.h"
|
|
|
|
#include "shared/source/indirect_heap/indirect_heap.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 05:50:57 +08:00
|
|
|
#include "opencl/source/device_queue/device_queue.h"
|
|
|
|
#include "opencl/source/kernel/kernel.h"
|
|
|
|
#include "opencl/source/program/program.h"
|
|
|
|
#include "opencl/source/scheduler/scheduler_kernel.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2020-07-30 21:02:11 +08:00
|
|
|
#include "hw_cmds.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2019-02-25 16:42:15 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
class DeviceQueueHw : public DeviceQueue {
|
|
|
|
using BaseClass = DeviceQueue;
|
|
|
|
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
|
|
|
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
|
|
|
|
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
|
|
|
|
using INTERFACE_DESCRIPTOR_DATA = typename GfxFamily::INTERFACE_DESCRIPTOR_DATA;
|
|
|
|
using BINDING_TABLE_STATE = typename GfxFamily::BINDING_TABLE_STATE;
|
|
|
|
using RENDER_SURFACE_STATE = typename GfxFamily::RENDER_SURFACE_STATE;
|
|
|
|
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
|
2017-12-20 20:24:19 +08:00
|
|
|
using MI_LOAD_REGISTER_REG = typename GfxFamily::MI_LOAD_REGISTER_REG;
|
|
|
|
using MI_LOAD_REGISTER_IMM = typename GfxFamily::MI_LOAD_REGISTER_IMM;
|
|
|
|
using MI_MATH = typename GfxFamily::MI_MATH;
|
|
|
|
using MI_MATH_ALU_INST_INLINE = typename GfxFamily::MI_MATH_ALU_INST_INLINE;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
public:
|
|
|
|
DeviceQueueHw(Context *context,
|
2020-01-14 21:32:11 +08:00
|
|
|
ClDevice *device,
|
2017-12-21 07:45:38 +08:00
|
|
|
cl_queue_properties &properties) : BaseClass(context, device, properties) {
|
|
|
|
allocateSlbBuffer();
|
|
|
|
offsetDsh = colorCalcStateSize + (uint32_t)sizeof(INTERFACE_DESCRIPTOR_DATA) * interfaceDescriptorEntries * numberOfIDTables;
|
|
|
|
igilQueue = reinterpret_cast<IGIL_CommandQueue *>(queueBuffer->getUnderlyingBuffer());
|
|
|
|
}
|
|
|
|
|
|
|
|
static DeviceQueue *create(Context *context,
|
2020-01-14 21:32:11 +08:00
|
|
|
ClDevice *device,
|
2017-12-21 07:45:38 +08:00
|
|
|
cl_queue_properties &properties) {
|
|
|
|
return new (std::nothrow) DeviceQueueHw<GfxFamily>(context, device, properties);
|
|
|
|
}
|
|
|
|
|
|
|
|
IndirectHeap *getIndirectHeap(IndirectHeap::Type type) override;
|
|
|
|
|
|
|
|
LinearStream *getSlbCS() { return &slbCS; }
|
|
|
|
void resetDSH();
|
|
|
|
|
|
|
|
size_t setSchedulerCrossThreadData(SchedulerKernel &scheduler);
|
|
|
|
|
2019-11-13 22:37:52 +08:00
|
|
|
void setupIndirectState(IndirectHeap &surfaceStateHeap, IndirectHeap &dynamicStateHeap, Kernel *parentKernel, uint32_t parentIDCount, bool isCcsUsed) override;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-08-23 19:50:46 +08:00
|
|
|
void addExecutionModelCleanUpSection(Kernel *parentKernel, TagNode<HwTimeStamps> *hwTimeStamp, uint64_t tagAddress, uint32_t taskCount) override;
|
2017-12-21 07:45:38 +08:00
|
|
|
void resetDeviceQueue() override;
|
2019-11-13 22:37:52 +08:00
|
|
|
void dispatchScheduler(LinearStream &commandStream, SchedulerKernel &scheduler, PreemptionMode preemptionMode, IndirectHeap *ssh, IndirectHeap *dsh, bool isCcsUsed) override;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
uint32_t getSchedulerReturnInstance() {
|
|
|
|
return igilQueue->m_controls.m_SchedulerEarlyReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
static size_t getCSPrefetchSize();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void allocateSlbBuffer();
|
|
|
|
size_t getMinimumSlbSize();
|
|
|
|
size_t getWaCommandsSize();
|
|
|
|
void addArbCheckCmdWa();
|
|
|
|
void addMiAtomicCmdWa(uint64_t atomicOpPlaceholder);
|
|
|
|
void addLriCmdWa(bool setArbCheck);
|
|
|
|
void addLriCmd(bool setArbCheck);
|
|
|
|
void addPipeControlCmdWa(bool isNoopCmd = false);
|
|
|
|
void initPipeControl(PIPE_CONTROL *pc);
|
|
|
|
void buildSlbDummyCommands();
|
2018-05-30 22:13:53 +08:00
|
|
|
void addDcFlushToPipeControlWa(PIPE_CONTROL *pc);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
void addProfilingEndCmds(uint64_t timestampAddress);
|
2017-12-20 20:24:19 +08:00
|
|
|
static size_t getProfilingEndCmdsSize();
|
|
|
|
|
|
|
|
MOCKABLE_VIRTUAL void addMediaStateClearCmds();
|
|
|
|
static size_t getMediaStateClearCmdsSize();
|
|
|
|
|
|
|
|
static size_t getExecutionModelCleanupSectionSize();
|
2019-11-13 22:37:52 +08:00
|
|
|
static uint64_t getBlockKernelStartPointer(const Device &device, const KernelInfo *blockInfo, bool isCcsUsed);
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
LinearStream slbCS;
|
|
|
|
IGIL_CommandQueue *igilQueue = nullptr;
|
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|