2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2019-02-12 17:27:13 +01:00
|
|
|
* Copyright (C) 2018-2019 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2019-08-22 16:51:02 +02:00
|
|
|
#include "core/command_stream/linear_stream.h"
|
2019-07-12 16:50:14 +02:00
|
|
|
#include "core/command_stream/preemption_mode.h"
|
2019-02-12 17:27:13 +01:00
|
|
|
#include "runtime/helpers/hw_info.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2019-02-12 17:27:13 +01:00
|
|
|
#include "sku_info.h"
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2017-12-21 00:45:38 +01:00
|
|
|
class Kernel;
|
|
|
|
|
class Device;
|
|
|
|
|
class GraphicsAllocation;
|
|
|
|
|
struct MultiDispatchInfo;
|
|
|
|
|
|
2019-11-25 16:45:52 +01:00
|
|
|
struct PreemptionFlags {
|
|
|
|
|
PreemptionFlags() {
|
|
|
|
|
data = 0;
|
|
|
|
|
}
|
|
|
|
|
union {
|
|
|
|
|
struct {
|
|
|
|
|
uint32_t disabledMidThreadPreemptionKernel : 1;
|
|
|
|
|
uint32_t vmeKernel : 1;
|
|
|
|
|
uint32_t deviceSupportsVmePreemption : 1;
|
|
|
|
|
uint32_t disablePerCtxtPreemptionGranularityControl : 1;
|
|
|
|
|
uint32_t usesFencesForReadWriteImages : 1;
|
|
|
|
|
uint32_t disableLSQCROPERFforOCL : 1;
|
|
|
|
|
uint32_t schedulerKernel : 1;
|
|
|
|
|
uint32_t reserved : 25;
|
|
|
|
|
} flags;
|
|
|
|
|
uint32_t data;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
class PreemptionHelper {
|
|
|
|
|
public:
|
2018-03-01 22:43:04 +01:00
|
|
|
template <typename CmdFamily>
|
|
|
|
|
using INTERFACE_DESCRIPTOR_DATA = typename CmdFamily::INTERFACE_DESCRIPTOR_DATA;
|
|
|
|
|
|
2019-11-25 16:45:52 +01:00
|
|
|
static PreemptionMode taskPreemptionMode(Device &device, const PreemptionFlags &flags);
|
2017-12-21 00:45:38 +01:00
|
|
|
static PreemptionMode taskPreemptionMode(Device &device, const MultiDispatchInfo &multiDispatchInfo);
|
2019-11-25 16:45:52 +01:00
|
|
|
static bool allowThreadGroupPreemption(const PreemptionFlags &flags);
|
|
|
|
|
static bool allowMidThreadPreemption(const PreemptionFlags &flags);
|
2017-12-21 00:45:38 +01:00
|
|
|
static void adjustDefaultPreemptionMode(RuntimeCapabilityTable &deviceCapabilities, bool allowMidThread, bool allowThreadGroup, bool allowMidBatch);
|
|
|
|
|
|
2019-11-25 16:45:52 +01:00
|
|
|
static void setPreemptionLevelFlags(PreemptionFlags &flags, Device &device, Kernel *kernel);
|
|
|
|
|
|
2018-01-08 15:58:02 +01:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
static size_t getRequiredPreambleSize(const Device &device);
|
2018-11-05 11:52:19 +01:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
static size_t getRequiredStateSipCmdSize(const Device &device);
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
static void programCsrBaseAddress(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr);
|
2018-01-08 15:58:02 +01:00
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2018-11-05 11:52:19 +01:00
|
|
|
static void programStateSip(LinearStream &preambleCmdStream, Device &device);
|
2018-01-08 15:58:02 +01:00
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
template <typename GfxFamily>
|
2018-01-08 15:58:02 +01:00
|
|
|
static size_t getRequiredCmdStreamSize(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2018-01-08 15:58:02 +01:00
|
|
|
static void programCmdStream(LinearStream &cmdStream, PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode,
|
2019-07-31 08:57:00 +02:00
|
|
|
GraphicsAllocation *preemptionCsr);
|
2018-01-02 12:10:34 +01:00
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
static size_t getPreemptionWaCsSize(const Device &device);
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
static void applyPreemptionWaCmdsBegin(LinearStream *pCommandStream, const Device &device);
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
static void applyPreemptionWaCmdsEnd(LinearStream *pCommandStream, const Device &device);
|
2018-02-06 11:58:05 +01:00
|
|
|
|
|
|
|
|
static PreemptionMode getDefaultPreemptionMode(const HardwareInfo &hwInfo);
|
2018-03-01 22:43:04 +01:00
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
static void programInterfaceDescriptorDataPreemption(INTERFACE_DESCRIPTOR_DATA<GfxFamily> *idd, PreemptionMode preemptionMode);
|
2017-12-21 00:45:38 +01:00
|
|
|
};
|
2018-02-12 13:41:08 +01:00
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct PreemptionConfig {
|
|
|
|
|
static const uint32_t mmioAddress;
|
|
|
|
|
static const uint32_t mask;
|
|
|
|
|
|
|
|
|
|
static const uint32_t threadGroupVal;
|
|
|
|
|
static const uint32_t cmdLevelVal;
|
|
|
|
|
static const uint32_t midThreadVal;
|
|
|
|
|
};
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|