2020-01-17 08:56:05 +01:00
|
|
|
/*
|
2020-12-21 00:56:30 +00:00
|
|
|
* Copyright (C) 2020-2021 Intel Corporation
|
2020-01-17 08:56:05 +01:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_container/cmdcontainer.h"
|
|
|
|
|
#include "shared/source/command_stream/linear_stream.h"
|
2021-09-28 10:56:22 +00:00
|
|
|
#include "shared/source/debugger/debugger.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/execution_environment/execution_environment.h"
|
2021-06-17 11:55:28 +00:00
|
|
|
#include "shared/source/helpers/definitions/mi_flush_args.h"
|
2020-02-25 10:23:04 -08:00
|
|
|
#include "shared/source/helpers/register_offsets.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/simd_helper.h"
|
|
|
|
|
#include "shared/source/kernel/dispatch_kernel_encoder_interface.h"
|
2020-04-07 14:07:31 +02:00
|
|
|
#include "shared/source/kernel/kernel_arg_descriptor.h"
|
2020-01-17 08:56:05 +01:00
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
|
2021-05-18 02:46:21 +00:00
|
|
|
class BindlessHeapsHelper;
|
2020-06-23 12:03:43 +02:00
|
|
|
class GmmHelper;
|
2020-10-07 14:22:26 +02:00
|
|
|
class IndirectHeap;
|
2021-05-18 02:46:21 +00:00
|
|
|
struct HardwareInfo;
|
|
|
|
|
struct StateComputeModeProperties;
|
2020-06-23 12:03:43 +02:00
|
|
|
|
2020-01-17 08:56:05 +01:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeDispatchKernel {
|
|
|
|
|
using WALKER_TYPE = typename GfxFamily::WALKER_TYPE;
|
|
|
|
|
using INTERFACE_DESCRIPTOR_DATA = typename GfxFamily::INTERFACE_DESCRIPTOR_DATA;
|
|
|
|
|
using BINDING_TABLE_STATE = typename GfxFamily::BINDING_TABLE_STATE;
|
|
|
|
|
|
|
|
|
|
static void encode(CommandContainer &container,
|
2020-11-17 08:37:44 +00:00
|
|
|
const void *pThreadGroupDimensions,
|
|
|
|
|
bool isIndirect,
|
|
|
|
|
bool isPredicate,
|
|
|
|
|
DispatchKernelEncoderI *dispatchInterface,
|
|
|
|
|
uint64_t eventAddress,
|
2021-03-10 19:03:23 +00:00
|
|
|
bool isTimestampEvent,
|
2021-04-21 15:52:50 +00:00
|
|
|
bool L3FlushEnable,
|
2020-11-17 08:37:44 +00:00
|
|
|
Device *device,
|
|
|
|
|
PreemptionMode preemptionMode,
|
2021-02-10 23:01:10 +00:00
|
|
|
bool &requiresUncachedMocs,
|
2021-06-15 02:02:59 +00:00
|
|
|
bool useGlobalAtomics,
|
2021-03-18 21:12:05 +00:00
|
|
|
uint32_t &partitionCount,
|
2021-06-21 15:24:14 +00:00
|
|
|
bool isInternal,
|
|
|
|
|
bool isCooperative);
|
2020-11-17 08:37:44 +00:00
|
|
|
|
2020-04-21 09:58:33 +02:00
|
|
|
static void encodeAdditionalWalkerFields(const HardwareInfo &hwInfo, WALKER_TYPE &walkerCmd);
|
2020-01-17 08:56:05 +01:00
|
|
|
|
2021-03-19 16:39:49 -07:00
|
|
|
static void appendAdditionalIDDFields(INTERFACE_DESCRIPTOR_DATA *pInterfaceDescriptor, const HardwareInfo &hwInfo, const uint32_t threadsPerThreadGroup, uint32_t slmTotalSize, SlmPolicy slmPolicy);
|
2020-08-03 16:33:02 +02:00
|
|
|
|
2020-01-17 08:56:05 +01:00
|
|
|
static void *getInterfaceDescriptor(CommandContainer &container, uint32_t &iddOffset);
|
|
|
|
|
|
2021-09-07 21:21:19 +00:00
|
|
|
static size_t estimateEncodeDispatchKernelCmdsSize(Device *device, const Vec3<size_t> &groupStart, const Vec3<size_t> &groupCount,
|
2021-06-21 15:24:14 +00:00
|
|
|
bool isInternal, bool isCooperative);
|
2020-05-11 18:20:21 +02:00
|
|
|
|
2020-07-06 22:55:37 +02:00
|
|
|
static bool isRuntimeLocalIdsGenerationRequired(uint32_t activeChannels,
|
|
|
|
|
size_t *lws,
|
|
|
|
|
std::array<uint8_t, 3> walkOrder,
|
|
|
|
|
bool requireInputWalkOrder,
|
|
|
|
|
uint32_t &requiredWalkOrder,
|
|
|
|
|
uint32_t simd);
|
|
|
|
|
|
|
|
|
|
static bool inlineDataProgrammingRequired(const KernelDescriptor &kernelDesc);
|
2020-06-26 16:03:30 +02:00
|
|
|
|
|
|
|
|
static void encodeThreadData(WALKER_TYPE &walkerCmd,
|
2020-07-06 22:55:37 +02:00
|
|
|
const uint32_t *startWorkGroup,
|
|
|
|
|
const uint32_t *numWorkGroups,
|
|
|
|
|
const uint32_t *workGroupSizes,
|
2020-06-26 16:03:30 +02:00
|
|
|
uint32_t simd,
|
|
|
|
|
uint32_t localIdDimensions,
|
2020-07-06 22:55:37 +02:00
|
|
|
uint32_t threadsPerThreadGroup,
|
|
|
|
|
uint32_t threadExecutionMask,
|
2020-06-26 16:03:30 +02:00
|
|
|
bool localIdsGenerationByRuntime,
|
|
|
|
|
bool inlineDataProgrammingRequired,
|
|
|
|
|
bool isIndirect,
|
|
|
|
|
uint32_t requiredWorkGroupOrder);
|
2020-07-16 20:00:52 +02:00
|
|
|
|
2020-07-22 21:17:50 +02:00
|
|
|
static void programBarrierEnable(INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, uint32_t value, const HardwareInfo &hwInfo);
|
|
|
|
|
|
|
|
|
|
static void adjustInterfaceDescriptorData(INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, const HardwareInfo &hwInfo);
|
2020-11-24 16:16:55 +00:00
|
|
|
|
2020-11-27 09:22:59 +00:00
|
|
|
static void adjustBindingTablePrefetch(INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, uint32_t samplerCount, uint32_t bindingTableEntryCount);
|
|
|
|
|
|
2020-11-24 16:16:55 +00:00
|
|
|
static void adjustTimestampPacket(WALKER_TYPE &walkerCmd, const HardwareInfo &hwInfo);
|
2020-01-17 08:56:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeStates {
|
|
|
|
|
using BINDING_TABLE_STATE = typename GfxFamily::BINDING_TABLE_STATE;
|
|
|
|
|
using INTERFACE_DESCRIPTOR_DATA = typename GfxFamily::INTERFACE_DESCRIPTOR_DATA;
|
|
|
|
|
using SAMPLER_STATE = typename GfxFamily::SAMPLER_STATE;
|
2020-11-26 09:04:26 +00:00
|
|
|
using SAMPLER_BORDER_COLOR_STATE = typename GfxFamily::SAMPLER_BORDER_COLOR_STATE;
|
2020-01-17 08:56:05 +01:00
|
|
|
|
|
|
|
|
static const uint32_t alignIndirectStatePointer = MemoryConstants::cacheLineSize;
|
2020-10-06 11:54:04 +02:00
|
|
|
static const size_t alignInterfaceDescriptorData = MemoryConstants::cacheLineSize;
|
2020-01-17 08:56:05 +01:00
|
|
|
|
|
|
|
|
static uint32_t copySamplerState(IndirectHeap *dsh,
|
|
|
|
|
uint32_t samplerStateOffset,
|
|
|
|
|
uint32_t samplerCount,
|
|
|
|
|
uint32_t borderColorOffset,
|
2020-11-26 09:04:26 +00:00
|
|
|
const void *fnDynamicStateHeap,
|
2021-08-25 10:28:05 +00:00
|
|
|
BindlessHeapsHelper *bindlessHeapHelper,
|
|
|
|
|
const HardwareInfo &hwInfo);
|
2020-01-17 08:56:05 +01:00
|
|
|
|
|
|
|
|
static size_t getAdjustStateComputeModeSize();
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-25 10:23:04 -08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeMath {
|
|
|
|
|
using MI_MATH_ALU_INST_INLINE = typename GfxFamily::MI_MATH_ALU_INST_INLINE;
|
|
|
|
|
using MI_MATH = typename GfxFamily::MI_MATH;
|
|
|
|
|
|
|
|
|
|
static uint32_t *commandReserve(CommandContainer &container);
|
2020-02-25 10:23:04 -08:00
|
|
|
static void greaterThan(CommandContainer &container,
|
|
|
|
|
AluRegisters firstOperandRegister,
|
|
|
|
|
AluRegisters secondOperandRegister,
|
|
|
|
|
AluRegisters finalResultRegister);
|
2020-02-25 10:23:04 -08:00
|
|
|
static void addition(CommandContainer &container,
|
|
|
|
|
AluRegisters firstOperandRegister,
|
|
|
|
|
AluRegisters secondOperandRegister,
|
|
|
|
|
AluRegisters finalResultRegister);
|
2020-12-04 08:15:15 -08:00
|
|
|
static void bitwiseAnd(CommandContainer &container,
|
|
|
|
|
AluRegisters firstOperandRegister,
|
|
|
|
|
AluRegisters secondOperandRegister,
|
|
|
|
|
AluRegisters finalResultRegister);
|
2021-06-25 13:35:30 +00:00
|
|
|
static void bitwiseOr(CommandContainer &container,
|
|
|
|
|
AluRegisters firstOperandRegister,
|
|
|
|
|
AluRegisters secondOperandRegister,
|
|
|
|
|
AluRegisters finalResultRegister);
|
2020-02-25 10:23:04 -08:00
|
|
|
};
|
|
|
|
|
|
2020-01-17 08:56:05 +01:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeMathMMIO {
|
|
|
|
|
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
|
|
|
|
|
using MI_MATH_ALU_INST_INLINE = typename GfxFamily::MI_MATH_ALU_INST_INLINE;
|
|
|
|
|
using MI_MATH = typename GfxFamily::MI_MATH;
|
|
|
|
|
|
|
|
|
|
static const size_t size = sizeof(MI_STORE_REGISTER_MEM);
|
|
|
|
|
|
|
|
|
|
static void encodeMulRegVal(CommandContainer &container, uint32_t offset, uint32_t val, uint64_t dstAddress);
|
|
|
|
|
|
|
|
|
|
static void encodeGreaterThanPredicate(CommandContainer &container, uint64_t lhsVal, uint32_t rhsVal);
|
|
|
|
|
|
2020-12-04 08:15:15 -08:00
|
|
|
static void encodeBitwiseAndVal(CommandContainer &container,
|
|
|
|
|
uint32_t regOffset,
|
|
|
|
|
uint32_t immVal,
|
|
|
|
|
uint64_t dstAddress);
|
|
|
|
|
|
2020-02-25 10:23:04 -08:00
|
|
|
static void encodeAlu(MI_MATH_ALU_INST_INLINE *pAluParam, AluRegisters srcA, AluRegisters srcB, AluRegisters op, AluRegisters dest, AluRegisters result);
|
2020-01-17 08:56:05 +01:00
|
|
|
|
2020-02-25 10:23:04 -08:00
|
|
|
static void encodeAluSubStoreCarry(MI_MATH_ALU_INST_INLINE *pAluParam, AluRegisters regA, AluRegisters regB, AluRegisters finalResultRegister);
|
2020-01-17 08:56:05 +01:00
|
|
|
|
2020-02-25 10:23:04 -08:00
|
|
|
static void encodeAluAdd(MI_MATH_ALU_INST_INLINE *pAluParam,
|
2020-11-24 19:15:37 -08:00
|
|
|
AluRegisters firstOperandRegister,
|
|
|
|
|
AluRegisters secondOperandRegister,
|
|
|
|
|
AluRegisters finalResultRegister);
|
|
|
|
|
|
|
|
|
|
static void encodeAluAnd(MI_MATH_ALU_INST_INLINE *pAluParam,
|
2020-02-25 10:23:04 -08:00
|
|
|
AluRegisters firstOperandRegister,
|
|
|
|
|
AluRegisters secondOperandRegister,
|
|
|
|
|
AluRegisters finalResultRegister);
|
2020-01-17 08:56:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeIndirectParams {
|
|
|
|
|
using MI_LOAD_REGISTER_IMM = typename GfxFamily::MI_LOAD_REGISTER_IMM;
|
|
|
|
|
using MI_LOAD_REGISTER_MEM = typename GfxFamily::MI_LOAD_REGISTER_MEM;
|
|
|
|
|
using MI_LOAD_REGISTER_REG = typename GfxFamily::MI_LOAD_REGISTER_REG;
|
|
|
|
|
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
|
|
|
|
|
using MI_MATH = typename GfxFamily::MI_MATH;
|
|
|
|
|
using MI_MATH_ALU_INST_INLINE = typename GfxFamily::MI_MATH_ALU_INST_INLINE;
|
2020-04-07 14:07:31 +02:00
|
|
|
static void setGroupCountIndirect(CommandContainer &container, const NEO::CrossThreadDataOffset offsets[3], void *crossThreadAddress);
|
2021-06-25 13:35:30 +00:00
|
|
|
static void setWorkDimIndirect(CommandContainer &container, const NEO::CrossThreadDataOffset offset, void *crossThreadAddress, const uint32_t *groupSize);
|
2020-04-07 14:07:31 +02:00
|
|
|
static void setGlobalWorkSizeIndirect(CommandContainer &container, const NEO::CrossThreadDataOffset offsets[3], void *crossThreadAddress, const uint32_t *lws);
|
2020-01-17 08:56:05 +01:00
|
|
|
|
|
|
|
|
static size_t getCmdsSizeForIndirectParams();
|
|
|
|
|
static size_t getCmdsSizeForSetGroupSizeIndirect();
|
|
|
|
|
static size_t getCmdsSizeForSetGroupCountIndirect();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeSetMMIO {
|
|
|
|
|
using MI_LOAD_REGISTER_IMM = typename GfxFamily::MI_LOAD_REGISTER_IMM;
|
|
|
|
|
using MI_LOAD_REGISTER_MEM = typename GfxFamily::MI_LOAD_REGISTER_MEM;
|
|
|
|
|
using MI_LOAD_REGISTER_REG = typename GfxFamily::MI_LOAD_REGISTER_REG;
|
|
|
|
|
|
|
|
|
|
static const size_t sizeIMM = sizeof(MI_LOAD_REGISTER_IMM);
|
|
|
|
|
static const size_t sizeMEM = sizeof(MI_LOAD_REGISTER_MEM);
|
|
|
|
|
static const size_t sizeREG = sizeof(MI_LOAD_REGISTER_REG);
|
|
|
|
|
|
2020-10-06 10:58:18 +02:00
|
|
|
static void encodeIMM(CommandContainer &container, uint32_t offset, uint32_t data, bool remap);
|
2020-01-17 08:56:05 +01:00
|
|
|
static void encodeMEM(CommandContainer &container, uint32_t offset, uint64_t address);
|
|
|
|
|
static void encodeREG(CommandContainer &container, uint32_t dstOffset, uint32_t srcOffset);
|
2020-10-20 15:14:56 +02:00
|
|
|
|
2021-09-03 11:42:31 +00:00
|
|
|
static void encodeIMM(LinearStream &cmdStream, uint32_t offset, uint32_t data, bool remap);
|
|
|
|
|
static void encodeMEM(LinearStream &cmdStream, uint32_t offset, uint64_t address);
|
|
|
|
|
static void encodeREG(LinearStream &cmdStream, uint32_t dstOffset, uint32_t srcOffset);
|
|
|
|
|
|
2020-10-20 15:14:56 +02:00
|
|
|
static bool isRemapApplicable(uint32_t offset);
|
|
|
|
|
static void remapOffset(MI_LOAD_REGISTER_MEM *pMiLoadReg);
|
|
|
|
|
static void remapOffset(MI_LOAD_REGISTER_REG *pMiLoadReg);
|
2020-01-17 08:56:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeL3State {
|
|
|
|
|
static void encode(CommandContainer &container, bool enableSLM);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeMediaInterfaceDescriptorLoad {
|
|
|
|
|
using INTERFACE_DESCRIPTOR_DATA = typename GfxFamily::INTERFACE_DESCRIPTOR_DATA;
|
|
|
|
|
|
|
|
|
|
static void encode(CommandContainer &container);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeStateBaseAddress {
|
2020-08-03 13:13:58 +02:00
|
|
|
using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS;
|
|
|
|
|
static void encode(CommandContainer &container, STATE_BASE_ADDRESS &sbaCmd);
|
2021-06-15 02:02:59 +00:00
|
|
|
static void encode(CommandContainer &container, STATE_BASE_ADDRESS &sbaCmd, uint32_t statelessMocsIndex, bool useGlobalAtomics);
|
2021-09-28 10:56:22 +00:00
|
|
|
static void setIohAddressForDebugger(NEO::Debugger::SbaAddresses &sbaAddress, const STATE_BASE_ADDRESS &sbaCmd);
|
2021-07-08 15:08:37 +00:00
|
|
|
static size_t getRequiredSizeForStateBaseAddress(Device &device, CommandContainer &container);
|
2020-01-17 08:56:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeStoreMMIO {
|
|
|
|
|
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
|
|
|
|
|
|
|
|
|
|
static const size_t size = sizeof(MI_STORE_REGISTER_MEM);
|
2020-05-04 10:46:55 +02:00
|
|
|
static void encode(LinearStream &csr, uint32_t offset, uint64_t address);
|
2020-04-29 14:06:01 +02:00
|
|
|
static void remapOffset(MI_STORE_REGISTER_MEM *pStoreRegMem);
|
2020-01-17 08:56:05 +01:00
|
|
|
};
|
2020-06-01 15:34:10 +02:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct AppendStoreMMIO {
|
|
|
|
|
using MI_STORE_REGISTER_MEM = typename GfxFamily::MI_STORE_REGISTER_MEM;
|
|
|
|
|
static void appendRemap(MI_STORE_REGISTER_MEM *cmd);
|
|
|
|
|
};
|
2020-01-17 08:56:05 +01:00
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeSurfaceState {
|
|
|
|
|
using R_SURFACE_STATE = typename GfxFamily::RENDER_SURFACE_STATE;
|
|
|
|
|
using SURFACE_FORMAT = typename R_SURFACE_STATE::SURFACE_FORMAT;
|
|
|
|
|
using AUXILIARY_SURFACE_MODE = typename R_SURFACE_STATE::AUXILIARY_SURFACE_MODE;
|
2021-04-13 00:36:24 +00:00
|
|
|
using COHERENCY_TYPE = typename R_SURFACE_STATE::COHERENCY_TYPE;
|
2020-01-17 08:56:05 +01:00
|
|
|
|
2020-06-23 12:03:43 +02:00
|
|
|
static void encodeBuffer(void *dst, uint64_t address, size_t size, uint32_t mocs,
|
2020-10-01 12:22:54 +02:00
|
|
|
bool cpuCoherent, bool forceNonAuxMode, bool isReadOnly, uint32_t numAvailableDevices,
|
2021-03-29 17:06:29 +00:00
|
|
|
GraphicsAllocation *allocation, GmmHelper *gmmHelper, bool useGlobalAtomics, bool areMultipleSubDevicesInContext);
|
2020-09-15 20:27:18 +02:00
|
|
|
static void encodeExtraBufferParams(R_SURFACE_STATE *surfaceState, GraphicsAllocation *allocation, GmmHelper *gmmHelper,
|
2021-03-29 17:06:29 +00:00
|
|
|
bool isReadOnly, uint32_t numAvailableDevices, bool useGlobalAtomics, bool areMultipleSubDevicesInContext);
|
2020-11-25 10:17:31 +00:00
|
|
|
static void encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const HardwareInfo &hwInfo);
|
2020-01-17 08:56:05 +01:00
|
|
|
|
|
|
|
|
static constexpr uintptr_t getSurfaceBaseAddressAlignmentMask() {
|
|
|
|
|
return ~(getSurfaceBaseAddressAlignment() - 1);
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-01 13:19:02 +00:00
|
|
|
static constexpr uintptr_t getSurfaceBaseAddressAlignment() { return 4; }
|
2020-02-12 09:10:32 +01:00
|
|
|
|
|
|
|
|
static void getSshAlignedPointer(uintptr_t &ptr, size_t &offset);
|
2020-10-07 14:22:26 +02:00
|
|
|
static bool doBindingTablePrefetch();
|
|
|
|
|
|
|
|
|
|
static size_t pushBindingTableAndSurfaceStates(IndirectHeap &dstHeap, size_t bindingTableCount,
|
|
|
|
|
const void *srcKernelSsh, size_t srcKernelSshSize,
|
|
|
|
|
size_t numberOfBindingTableStates, size_t offsetOfBindingTable);
|
2021-01-27 19:55:34 +01:00
|
|
|
|
|
|
|
|
static void appendImageCompressionParams(R_SURFACE_STATE *surfaceState, GraphicsAllocation *allocation, GmmHelper *gmmHelper, bool imageFromBuffer);
|
2021-04-13 00:36:24 +00:00
|
|
|
static void setCoherencyType(R_SURFACE_STATE *surfaceState, COHERENCY_TYPE coherencyType);
|
2021-01-29 15:40:17 +00:00
|
|
|
static void setBufferAuxParamsForCCS(R_SURFACE_STATE *surfaceState);
|
|
|
|
|
static void setImageAuxParamsForCCS(R_SURFACE_STATE *surfaceState, Gmm *gmm);
|
|
|
|
|
static bool isAuxModeEnabled(R_SURFACE_STATE *surfaceState, Gmm *gmm);
|
2021-01-29 10:17:10 +00:00
|
|
|
static void setAuxParamsForMCSCCS(R_SURFACE_STATE *surfaceState);
|
|
|
|
|
static void setClearColorParams(R_SURFACE_STATE *surfaceState, Gmm *gmm);
|
|
|
|
|
static void setFlagsForMediaCompression(R_SURFACE_STATE *surfaceState, Gmm *gmm);
|
2021-05-25 16:41:54 +00:00
|
|
|
static void disableCompressionFlags(R_SURFACE_STATE *surfaceState);
|
2021-06-23 15:26:56 +00:00
|
|
|
static void appendParamsForImageFromBuffer(R_SURFACE_STATE *surfaceState);
|
2020-01-17 08:56:05 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeComputeMode {
|
2021-07-06 13:29:10 +00:00
|
|
|
static void adjustComputeMode(LinearStream &csr, void *const stateComputeModePtr, StateComputeModeProperties &properties, const HardwareInfo &hwInfo);
|
2020-03-19 10:29:36 +01:00
|
|
|
|
2020-12-21 00:56:30 +00:00
|
|
|
static void adjustPipelineSelect(CommandContainer &container, const NEO::KernelDescriptor &kernelDescriptor);
|
2020-01-17 08:56:05 +01:00
|
|
|
};
|
2020-01-24 14:58:15 +01:00
|
|
|
|
2020-03-25 10:04:42 +01:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeWA {
|
|
|
|
|
static void encodeAdditionalPipelineSelect(Device &device, LinearStream &stream, bool is3DPipeline);
|
|
|
|
|
static size_t getAdditionalPipelineSelectSize(Device &device);
|
|
|
|
|
};
|
|
|
|
|
|
2020-01-24 14:58:15 +01:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeSempahore {
|
|
|
|
|
using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT;
|
|
|
|
|
using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION;
|
|
|
|
|
|
2020-02-04 20:26:04 +01:00
|
|
|
static constexpr uint32_t invalidHardwareTag = -2;
|
|
|
|
|
|
2020-01-24 14:58:15 +01:00
|
|
|
static void programMiSemaphoreWait(MI_SEMAPHORE_WAIT *cmd,
|
|
|
|
|
uint64_t compareAddress,
|
|
|
|
|
uint32_t compareData,
|
2020-10-16 15:58:47 +02:00
|
|
|
COMPARE_OPERATION compareMode,
|
|
|
|
|
bool registerPollMode);
|
|
|
|
|
|
|
|
|
|
static void addMiSemaphoreWaitCommand(LinearStream &commandStream,
|
|
|
|
|
uint64_t compareAddress,
|
|
|
|
|
uint32_t compareData,
|
|
|
|
|
COMPARE_OPERATION compareMode,
|
|
|
|
|
bool registerPollMode);
|
2020-02-11 15:21:18 +01:00
|
|
|
|
|
|
|
|
static void addMiSemaphoreWaitCommand(LinearStream &commandStream,
|
|
|
|
|
uint64_t compareAddress,
|
|
|
|
|
uint32_t compareData,
|
|
|
|
|
COMPARE_OPERATION compareMode);
|
|
|
|
|
|
|
|
|
|
static size_t getSizeMiSemaphoreWait();
|
2020-01-24 14:58:15 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeAtomic {
|
|
|
|
|
using MI_ATOMIC = typename GfxFamily::MI_ATOMIC;
|
|
|
|
|
using ATOMIC_OPCODES = typename GfxFamily::MI_ATOMIC::ATOMIC_OPCODES;
|
|
|
|
|
using DATA_SIZE = typename GfxFamily::MI_ATOMIC::DATA_SIZE;
|
|
|
|
|
|
2020-10-01 21:08:46 +02:00
|
|
|
static void programMiAtomic(LinearStream &commandStream,
|
|
|
|
|
uint64_t writeAddress,
|
2020-01-24 14:58:15 +01:00
|
|
|
ATOMIC_OPCODES opcode,
|
2020-10-01 21:08:46 +02:00
|
|
|
DATA_SIZE dataSize,
|
|
|
|
|
uint32_t returnDataControl,
|
2021-03-04 17:54:14 +00:00
|
|
|
uint32_t csStall,
|
|
|
|
|
uint32_t operand1dword0,
|
|
|
|
|
uint32_t operand1dword1);
|
2020-10-01 21:08:46 +02:00
|
|
|
|
|
|
|
|
static void programMiAtomic(MI_ATOMIC *atomic,
|
|
|
|
|
uint64_t writeAddress,
|
|
|
|
|
ATOMIC_OPCODES opcode,
|
|
|
|
|
DATA_SIZE dataSize,
|
|
|
|
|
uint32_t returnDataControl,
|
2021-03-04 17:54:14 +00:00
|
|
|
uint32_t csStall,
|
|
|
|
|
uint32_t operand1dword0,
|
|
|
|
|
uint32_t operand1dword1);
|
|
|
|
|
|
|
|
|
|
static void setMiAtomicAddress(MI_ATOMIC &atomic, uint64_t writeAddress);
|
2020-01-24 14:58:15 +01:00
|
|
|
};
|
|
|
|
|
|
2020-01-28 13:50:19 +01:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeBatchBufferStartOrEnd {
|
|
|
|
|
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
|
|
|
|
|
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
|
|
|
|
|
|
|
|
|
|
static void programBatchBufferStart(LinearStream *commandStream,
|
|
|
|
|
uint64_t address,
|
|
|
|
|
bool secondLevel);
|
|
|
|
|
static void programBatchBufferEnd(CommandContainer &container);
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-21 15:35:08 +01:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeMiFlushDW {
|
|
|
|
|
using MI_FLUSH_DW = typename GfxFamily::MI_FLUSH_DW;
|
2021-06-17 11:55:28 +00:00
|
|
|
static void programMiFlushDw(LinearStream &commandStream, uint64_t immediateDataGpuAddress, uint64_t immediateData, MiFlushArgs &args);
|
2020-03-04 17:31:21 +01:00
|
|
|
static void programMiFlushDwWA(LinearStream &commandStream);
|
2020-02-21 15:35:08 +01:00
|
|
|
static void appendMiFlushDw(MI_FLUSH_DW *miFlushDwCmd);
|
2020-03-13 12:29:45 +01:00
|
|
|
static size_t getMiFlushDwCmdSizeForDataWrite();
|
|
|
|
|
static size_t getMiFlushDwWaSize();
|
2020-02-21 15:35:08 +01:00
|
|
|
};
|
2020-04-03 17:38:09 +02:00
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeMemoryPrefetch {
|
2021-03-24 12:02:04 +00:00
|
|
|
static void programMemoryPrefetch(LinearStream &commandStream, const GraphicsAllocation &graphicsAllocation, uint32_t size, size_t offset, const HardwareInfo &hwInfo);
|
2021-03-25 13:27:26 +00:00
|
|
|
static size_t getSizeForMemoryPrefetch(size_t size);
|
2020-04-03 17:38:09 +02:00
|
|
|
};
|
2020-11-16 17:12:08 +00:00
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeMiArbCheck {
|
|
|
|
|
using MI_ARB_CHECK = typename GfxFamily::MI_ARB_CHECK;
|
|
|
|
|
|
|
|
|
|
static void program(LinearStream &commandStream);
|
|
|
|
|
static size_t getCommandSize();
|
|
|
|
|
};
|
2021-02-26 22:02:57 +00:00
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct EncodeEnableRayTracing {
|
|
|
|
|
static void programEnableRayTracing(LinearStream &commandStream, GraphicsAllocation &backBuffer);
|
|
|
|
|
};
|
|
|
|
|
|
2020-01-24 14:58:15 +01:00
|
|
|
} // namespace NEO
|