2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-01-06 01:00:12 +08:00
|
|
|
* Copyright (C) 2018-2021 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/helpers/pipeline_select_helper.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2020-11-17 18:42:29 +08:00
|
|
|
#include "opencl/source/kernel/kernel_execution_type.h"
|
|
|
|
|
2021-03-31 22:11:31 +08:00
|
|
|
#include "engine_group_types.h"
|
2020-02-06 23:06:00 +08:00
|
|
|
#include "engine_node.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "igfxfmid.h"
|
|
|
|
|
2018-01-17 15:37:47 +08:00
|
|
|
#include <cstddef>
|
2018-11-14 15:40:37 +08:00
|
|
|
#include <cstdint>
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2018-01-16 18:30:53 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
struct HardwareInfo;
|
|
|
|
class Device;
|
2018-11-14 15:40:37 +08:00
|
|
|
struct DispatchFlags;
|
2018-01-08 22:58:02 +08:00
|
|
|
class GraphicsAllocation;
|
2017-12-21 07:45:38 +08:00
|
|
|
class LinearStream;
|
2019-09-10 22:13:11 +08:00
|
|
|
struct PipelineSelectArgs;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
struct PreambleHelper {
|
2018-02-20 15:11:24 +08:00
|
|
|
using MI_LOAD_REGISTER_IMM = typename GfxFamily::MI_LOAD_REGISTER_IMM;
|
|
|
|
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
2019-10-01 17:51:31 +08:00
|
|
|
using VFE_STATE_TYPE = typename GfxFamily::VFE_STATE_TYPE;
|
2018-02-20 15:11:24 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
static void programL3(LinearStream *pCommandStream, uint32_t l3Config);
|
2019-08-19 21:01:00 +08:00
|
|
|
static void programPipelineSelect(LinearStream *pCommandStream,
|
2019-09-10 22:13:11 +08:00
|
|
|
const PipelineSelectArgs &pipelineSelectArgs,
|
2019-08-19 21:01:00 +08:00
|
|
|
const HardwareInfo &hwInfo);
|
2017-12-21 07:45:38 +08:00
|
|
|
static void programThreadArbitration(LinearStream *pCommandStream, uint32_t requiredThreadArbitrationPolicy);
|
2018-03-29 15:06:33 +08:00
|
|
|
static void programPreemption(LinearStream *pCommandStream, Device &device, GraphicsAllocation *preemptionCsr);
|
2021-03-31 22:11:31 +08:00
|
|
|
static void addPipeControlBeforeVfeCmd(LinearStream *pCommandStream, const HardwareInfo *hwInfo, EngineGroupType engineGroupType);
|
2021-01-06 01:00:12 +08:00
|
|
|
static void appendProgramVFEState(const HardwareInfo &hwInfo, KernelExecutionType kernelExecutionType, uint32_t additionalKernelExecInfo, void *cmd);
|
2021-03-31 22:11:31 +08:00
|
|
|
static void *programVFEState(LinearStream *pCommandStream,
|
|
|
|
const HardwareInfo &hwInfo,
|
|
|
|
uint32_t scratchSize,
|
|
|
|
uint64_t scratchAddress,
|
|
|
|
uint32_t maxFrontEndThreads,
|
|
|
|
EngineGroupType engineGroupType,
|
|
|
|
uint32_t additionalKernelExecInfo,
|
|
|
|
KernelExecutionType kernelExecutionType);
|
|
|
|
static uint64_t getScratchSpaceAddressOffsetForVfeState(LinearStream *pCommandStream, void *pVfeState);
|
2019-10-07 19:11:12 +08:00
|
|
|
static void programAdditionalFieldsInVfeState(VFE_STATE_TYPE *mediaVfeState, const HardwareInfo &hwInfo);
|
2018-03-29 15:06:33 +08:00
|
|
|
static void programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config,
|
2020-11-27 03:02:18 +08:00
|
|
|
uint32_t requiredThreadArbitrationPolicy, GraphicsAllocation *preemptionCsr);
|
2018-04-13 17:50:57 +08:00
|
|
|
static void programKernelDebugging(LinearStream *pCommandStream);
|
2020-06-24 20:53:51 +08:00
|
|
|
static void programSemaphoreDelay(LinearStream *pCommandStream);
|
2017-12-21 07:45:38 +08:00
|
|
|
static uint32_t getL3Config(const HardwareInfo &hwInfo, bool useSLM);
|
2019-08-06 05:57:15 +08:00
|
|
|
static bool isL3Configurable(const HardwareInfo &hwInfo);
|
2018-02-20 15:11:24 +08:00
|
|
|
static size_t getAdditionalCommandsSize(const Device &device);
|
2018-04-20 19:55:54 +08:00
|
|
|
static size_t getThreadArbitrationCommandsSize();
|
2019-05-16 23:17:53 +08:00
|
|
|
static size_t getVFECommandsSize();
|
2018-04-13 17:50:57 +08:00
|
|
|
static size_t getKernelDebuggingCommandsSize(bool debuggingActive);
|
2017-12-21 07:45:38 +08:00
|
|
|
static void programGenSpecificPreambleWorkArounds(LinearStream *pCommandStream, const HardwareInfo &hwInfo);
|
|
|
|
static uint32_t getUrbEntryAllocationSize();
|
2019-09-10 22:13:11 +08:00
|
|
|
static size_t getCmdSizeForPipelineSelect(const HardwareInfo &hwInfo);
|
2020-06-24 20:53:51 +08:00
|
|
|
static size_t getSemaphoreDelayCommandSize();
|
2020-10-06 17:54:04 +08:00
|
|
|
static uint32_t getScratchSizeValueToProgramMediaVfeState(uint32_t scratchSize);
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
template <PRODUCT_FAMILY ProductFamily>
|
|
|
|
static uint32_t getL3ConfigHelper(bool useSLM);
|
|
|
|
|
|
|
|
template <PRODUCT_FAMILY ProductFamily>
|
|
|
|
struct L3CNTLREGConfig {
|
|
|
|
static const uint32_t valueForSLM;
|
|
|
|
static const uint32_t valueForNoSLM;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <PRODUCT_FAMILY ProductFamily>
|
|
|
|
uint32_t getL3ConfigHelper(bool useSLM) {
|
|
|
|
if (!useSLM) {
|
|
|
|
return L3CNTLREGConfig<ProductFamily>::valueForNoSLM;
|
|
|
|
}
|
|
|
|
return L3CNTLREGConfig<ProductFamily>::valueForSLM;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
struct L3CNTLRegisterOffset {
|
|
|
|
static const uint32_t registerOffset;
|
|
|
|
};
|
2018-02-20 15:11:24 +08:00
|
|
|
|
2019-10-01 19:28:37 +08:00
|
|
|
template <typename GfxFamily>
|
2019-12-11 22:30:14 +08:00
|
|
|
struct DebugModeRegisterOffset {
|
|
|
|
enum {
|
|
|
|
registerOffset = 0x20ec,
|
|
|
|
debugEnabledValue = (1 << 6) | (1 << 22)
|
|
|
|
};
|
|
|
|
};
|
2018-04-13 17:50:57 +08:00
|
|
|
|
2020-10-19 22:04:58 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
struct TdDebugControlRegisterOffset {
|
|
|
|
enum {
|
|
|
|
registerOffset = 0xe400,
|
|
|
|
debugEnabledValue = (1 << 4) | (1 << 7)
|
|
|
|
};
|
|
|
|
};
|
2018-04-13 17:50:57 +08:00
|
|
|
|
2020-12-11 03:05:25 +08:00
|
|
|
template <typename GfxFamily>
|
|
|
|
struct GlobalSipRegister {
|
|
|
|
enum {
|
|
|
|
registerOffset = 0xE42C,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|