2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2019-01-28 13:44:59 +01:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 12:29:07 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
#include "runtime/command_stream/command_stream_receiver.h"
|
2019-02-27 10:06:14 +01:00
|
|
|
#include "runtime/execution_environment/execution_environment.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "runtime/gen_common/hw_cmds.h"
|
2019-01-25 10:20:32 +01:00
|
|
|
#include "runtime/helpers/csr_deps.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
#include "runtime/helpers/dirty_state_helpers.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "runtime/helpers/hw_info.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
#include "runtime/helpers/options.h"
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
class DeviceCommandStreamReceiver;
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
class CommandStreamReceiverHw : public CommandStreamReceiver {
|
|
|
|
|
typedef typename GfxFamily::MI_BATCH_BUFFER_START MI_BATCH_BUFFER_START;
|
|
|
|
|
typedef typename GfxFamily::PIPE_CONTROL PIPE_CONTROL;
|
|
|
|
|
|
|
|
|
|
public:
|
2019-02-27 10:06:14 +01:00
|
|
|
static CommandStreamReceiver *create(ExecutionEnvironment &executionEnvironment) {
|
|
|
|
|
return new CommandStreamReceiverHw<GfxFamily>(executionEnvironment);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
2019-02-27 10:06:14 +01:00
|
|
|
CommandStreamReceiverHw(ExecutionEnvironment &executionEnvironment);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-11-26 14:04:52 +01:00
|
|
|
FlushStamp flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
CompletionStamp flushTask(LinearStream &commandStream, size_t commandStreamStart,
|
2018-04-17 13:50:50 +02:00
|
|
|
const IndirectHeap &dsh, const IndirectHeap &ioh, const IndirectHeap &ssh,
|
2018-08-01 10:01:41 +02:00
|
|
|
uint32_t taskLevel, DispatchFlags &dispatchFlags, Device &device) override;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
void flushBatchedSubmissions() override;
|
|
|
|
|
|
|
|
|
|
static void addBatchBufferEnd(LinearStream &commandStream, void **patchLocation);
|
2018-07-05 11:23:28 +02:00
|
|
|
void addBatchBufferStart(MI_BATCH_BUFFER_START *commandBufferMemory, uint64_t startAddress, bool secondary);
|
2017-12-21 00:45:38 +01:00
|
|
|
static void alignToCacheLine(LinearStream &commandStream);
|
|
|
|
|
|
2018-08-29 13:39:27 +02:00
|
|
|
size_t getRequiredStateBaseAddressSize() const;
|
2018-08-07 09:07:50 +02:00
|
|
|
size_t getRequiredCmdStreamSize(const DispatchFlags &dispatchFlags, Device &device);
|
|
|
|
|
size_t getRequiredCmdStreamSizeAligned(const DispatchFlags &dispatchFlags, Device &device);
|
2018-08-16 11:18:05 +02:00
|
|
|
size_t getRequiredCmdSizeForPreamble(Device &device) const;
|
2018-04-13 11:05:09 +02:00
|
|
|
size_t getCmdSizeForPreemption(const DispatchFlags &dispatchFlags) const;
|
2019-08-07 19:33:40 +02:00
|
|
|
size_t getCmdSizeForEpilogue(const DispatchFlags &dispatchFlags) const;
|
2019-08-08 11:44:23 +02:00
|
|
|
size_t getCmdSizeForEpilogueCommands(const DispatchFlags &dispatchFlags) const;
|
2018-04-13 11:05:09 +02:00
|
|
|
size_t getCmdSizeForL3Config() const;
|
|
|
|
|
size_t getCmdSizeForPipelineSelect() const;
|
2018-09-21 14:06:35 +02:00
|
|
|
size_t getCmdSizeForComputeMode();
|
2018-01-19 13:29:25 +01:00
|
|
|
size_t getCmdSizeForMediaSampler(bool mediaSamplerRequired) const;
|
2019-10-11 12:54:10 +08:00
|
|
|
size_t getCmdSizeForEngineMode(const DispatchFlags &dispatchFlags) const;
|
2018-09-21 14:06:35 +02:00
|
|
|
void programComputeMode(LinearStream &csr, DispatchFlags &dispatchFlags);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-11-26 14:04:52 +01:00
|
|
|
void waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait, bool useQuickKmdSleep, bool forcePowerSavingMode) override;
|
2019-02-27 10:06:14 +01:00
|
|
|
const HardwareInfo &peekHwInfo() const { return *executionEnvironment.getHardwareInfo(); }
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-03-14 11:07:51 +01:00
|
|
|
void collectStateBaseAddresPatchInfo(
|
2018-04-04 11:34:46 +02:00
|
|
|
uint64_t commandBufferAddress,
|
2018-03-14 11:07:51 +01:00
|
|
|
uint64_t commandOffset,
|
|
|
|
|
const LinearStream &dsh,
|
|
|
|
|
const LinearStream &ioh,
|
|
|
|
|
const LinearStream &ssh,
|
2018-04-04 11:34:46 +02:00
|
|
|
uint64_t generalStateBase);
|
2018-03-14 11:07:51 +01:00
|
|
|
|
2018-04-10 10:26:59 +02:00
|
|
|
void resetKmdNotifyHelper(KmdNotifyHelper *newHelper);
|
|
|
|
|
|
2018-06-06 10:34:51 +02:00
|
|
|
CommandStreamReceiverType getType() override {
|
|
|
|
|
return CommandStreamReceiverType::CSR_HW;
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-28 11:54:59 +01:00
|
|
|
uint32_t blitBuffer(const BlitProperties &blitProperties) override;
|
2019-04-03 15:59:31 +02:00
|
|
|
|
2019-09-12 17:30:13 +02:00
|
|
|
bool isMultiOsContextCapable() const override;
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
protected:
|
2019-07-31 08:57:00 +02:00
|
|
|
void programPreemption(LinearStream &csr, DispatchFlags &dispatchFlags);
|
2017-12-21 00:45:38 +01:00
|
|
|
void programL3(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t &newL3Config);
|
2018-08-16 11:18:05 +02:00
|
|
|
void programPreamble(LinearStream &csr, Device &device, DispatchFlags &dispatchFlags, uint32_t &newL3Config);
|
2019-09-10 16:13:11 +02:00
|
|
|
void programPipelineSelect(LinearStream &csr, PipelineSelectArgs &pipelineSelectArgs);
|
2019-08-07 19:33:40 +02:00
|
|
|
void programEpilogue(LinearStream &csr, void **batchBufferEndLocation, DispatchFlags &dispatchFlags);
|
2019-08-08 11:44:23 +02:00
|
|
|
void programEpliogueCommands(LinearStream &csr, const DispatchFlags &dispatchFlags);
|
2018-01-19 13:29:25 +01:00
|
|
|
void programMediaSampler(LinearStream &csr, DispatchFlags &dispatchFlags);
|
2018-11-05 11:52:19 +01:00
|
|
|
void programStateSip(LinearStream &cmdStream, Device &device);
|
2019-05-29 15:37:54 +02:00
|
|
|
void programVFEState(LinearStream &csr, DispatchFlags &dispatchFlags, uint32_t maxFrontEndThreads);
|
2019-10-03 14:38:49 +02:00
|
|
|
void programStallingPipeControlForBarrier(LinearStream &cmdStream, DispatchFlags &dispatchFlags);
|
2017-12-21 00:45:38 +01:00
|
|
|
virtual void initPageTableManagerRegisters(LinearStream &csr){};
|
2019-10-11 12:54:10 +08:00
|
|
|
void programEngineModeCommands(LinearStream &csr, const DispatchFlags &dispatchFlags);
|
|
|
|
|
void programEngineModeEpliogue(LinearStream &csr, const DispatchFlags &dispatchFlags);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2018-05-21 10:57:28 +02:00
|
|
|
void addClearSLMWorkAround(typename GfxFamily::PIPE_CONTROL *pCmd);
|
2017-12-21 00:45:38 +01:00
|
|
|
PIPE_CONTROL *addPipeControlCmd(LinearStream &commandStream);
|
2019-07-19 12:45:56 +02:00
|
|
|
PIPE_CONTROL *addPipeControlBeforeStateBaseAddress(LinearStream &commandStream);
|
2018-09-03 16:44:42 +02:00
|
|
|
size_t getSshHeapSize();
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
uint64_t getScratchPatchAddress();
|
2019-03-29 00:49:23 +01:00
|
|
|
void createScratchSpaceController();
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
static void emitNoop(LinearStream &commandStream, size_t bytesToUpdate);
|
|
|
|
|
|
2019-01-28 13:44:59 +01:00
|
|
|
bool detectInitProgrammingFlagsRequired(const DispatchFlags &dispatchFlags) const;
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
HeapDirtyState dshState;
|
|
|
|
|
HeapDirtyState iohState;
|
|
|
|
|
HeapDirtyState sshState;
|
|
|
|
|
|
|
|
|
|
CsrSizeRequestFlags csrSizeRequestFlags = {};
|
|
|
|
|
};
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|