mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Enable thread-group preemption for GEN12LP
Related-To: NEO-3880 Change-Id: Ia8ffc54f923578d3e7334d414e0087feff42eb7d Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
52a0ddf0f4
commit
aa7058a2a9
@ -1273,6 +1273,7 @@ typedef struct tagMI_LOAD_REGISTER_IMM {
|
||||
TheStructure.Common.DwordLength = DWORD_LENGTH_EXCLUDES_DWORD_0_1;
|
||||
TheStructure.Common.MiCommandOpcode = MI_COMMAND_OPCODE_MI_LOAD_REGISTER_IMM;
|
||||
TheStructure.Common.CommandType = COMMAND_TYPE_MI_COMMAND;
|
||||
TheStructure.Common.MmioRemapEnable = true; // this field is manually set
|
||||
}
|
||||
static tagMI_LOAD_REGISTER_IMM sInit(void) {
|
||||
MI_LOAD_REGISTER_IMM state;
|
||||
|
@ -65,8 +65,6 @@ class PreemptionHelper {
|
||||
template <typename GfxFamily>
|
||||
struct PreemptionConfig {
|
||||
static const uint32_t mmioAddress;
|
||||
static const uint32_t maskVal;
|
||||
static const uint32_t maskShift;
|
||||
static const uint32_t mask;
|
||||
|
||||
static const uint32_t threadGroupVal;
|
||||
|
@ -136,4 +136,19 @@ template <typename GfxFamily>
|
||||
void PreemptionHelper::programInterfaceDescriptorDataPreemption(INTERFACE_DESCRIPTOR_DATA<GfxFamily> *idd, PreemptionMode preemptionMode) {
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
constexpr uint32_t PreemptionConfig<GfxFamily>::mmioAddress = 0x2580;
|
||||
|
||||
template <typename GfxFamily>
|
||||
constexpr uint32_t PreemptionConfig<GfxFamily>::mask = ((1 << 1) | (1 << 2)) << 16;
|
||||
|
||||
template <typename GfxFamily>
|
||||
constexpr uint32_t PreemptionConfig<GfxFamily>::threadGroupVal = (1 << 1);
|
||||
|
||||
template <typename GfxFamily>
|
||||
constexpr uint32_t PreemptionConfig<GfxFamily>::cmdLevelVal = (1 << 2);
|
||||
|
||||
template <typename GfxFamily>
|
||||
constexpr uint32_t PreemptionConfig<GfxFamily>::midThreadVal = 0;
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -13,18 +13,6 @@ namespace NEO {
|
||||
|
||||
typedef ICLFamily GfxFamily;
|
||||
|
||||
template <>
|
||||
struct PreemptionConfig<GfxFamily> {
|
||||
static constexpr uint32_t mmioAddress = 0x2580;
|
||||
static constexpr uint32_t maskVal = (1 << 1) | (1 << 2);
|
||||
static constexpr uint32_t maskShift = 16;
|
||||
static constexpr uint32_t mask = maskVal << maskShift;
|
||||
|
||||
static constexpr uint32_t threadGroupVal = (1 << 1);
|
||||
static constexpr uint32_t cmdLevelVal = (1 << 2);
|
||||
static constexpr uint32_t midThreadVal = 0;
|
||||
};
|
||||
|
||||
template <>
|
||||
size_t PreemptionHelper::getPreemptionWaCsSize<GfxFamily>(const Device &device) {
|
||||
return 0;
|
||||
|
@ -6,41 +6,13 @@
|
||||
*/
|
||||
|
||||
#include "runtime/command_stream/preemption.h"
|
||||
#include "runtime/command_stream/preemption.inl"
|
||||
#include "runtime/gen12lp/hw_cmds.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
typedef TGLLPFamily GfxFamily;
|
||||
|
||||
template <>
|
||||
size_t PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <>
|
||||
void PreemptionHelper::programCmdStream<GfxFamily>(LinearStream &cmdStream, PreemptionMode newPreemptionMode,
|
||||
PreemptionMode oldPreemptionMode, GraphicsAllocation *preemptionCsr) {
|
||||
}
|
||||
|
||||
template <>
|
||||
size_t PreemptionHelper::getRequiredPreambleSize<GfxFamily>(const Device &device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <>
|
||||
size_t PreemptionHelper::getRequiredStateSipCmdSize<GfxFamily>(const Device &device) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <>
|
||||
void PreemptionHelper::programCsrBaseAddress<GfxFamily>(LinearStream &preambleCmdStream, Device &device,
|
||||
const GraphicsAllocation *preemptionCsr) {
|
||||
}
|
||||
|
||||
template <>
|
||||
void PreemptionHelper::programStateSip<GfxFamily>(LinearStream &preambleCmdStream, Device &device) {
|
||||
}
|
||||
|
||||
template <>
|
||||
size_t PreemptionHelper::getPreemptionWaCsSize<GfxFamily>(const Device &device) {
|
||||
return 0;
|
||||
@ -54,6 +26,14 @@ template <>
|
||||
void PreemptionHelper::applyPreemptionWaCmdsEnd<GfxFamily>(LinearStream *pCommandStream, const Device &device) {
|
||||
}
|
||||
|
||||
template void PreemptionHelper::programCmdStream<GfxFamily>(LinearStream &cmdStream, PreemptionMode newPreemptionMode,
|
||||
PreemptionMode oldPreemptionMode, GraphicsAllocation *preemptionCsr);
|
||||
template size_t PreemptionHelper::getRequiredPreambleSize<GfxFamily>(const Device &device);
|
||||
template void PreemptionHelper::programCsrBaseAddress<GfxFamily>(LinearStream &preambleCmdStream, Device &device, const GraphicsAllocation *preemptionCsr);
|
||||
template void PreemptionHelper::programStateSip<GfxFamily>(LinearStream &preambleCmdStream, Device &device);
|
||||
template size_t PreemptionHelper::getRequiredStateSipCmdSize<GfxFamily>(const Device &device);
|
||||
template size_t PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode newPreemptionMode, PreemptionMode oldPreemptionMode);
|
||||
|
||||
template <>
|
||||
void PreemptionHelper::programInterfaceDescriptorDataPreemption<GfxFamily>(INTERFACE_DESCRIPTOR_DATA<GfxFamily> *idd, PreemptionMode preemptionMode) {
|
||||
using INTERFACE_DESCRIPTOR_DATA = typename GfxFamily::INTERFACE_DESCRIPTOR_DATA;
|
||||
|
@ -16,18 +16,6 @@ namespace NEO {
|
||||
|
||||
typedef SKLFamily GfxFamily;
|
||||
|
||||
template <>
|
||||
struct PreemptionConfig<GfxFamily> {
|
||||
static constexpr uint32_t mmioAddress = 0x2580;
|
||||
static constexpr uint32_t maskVal = (1 << 1) | (1 << 2);
|
||||
static constexpr uint32_t maskShift = 16;
|
||||
static constexpr uint32_t mask = maskVal << maskShift;
|
||||
|
||||
static constexpr uint32_t threadGroupVal = (1 << 1);
|
||||
static constexpr uint32_t cmdLevelVal = (1 << 2);
|
||||
static constexpr uint32_t midThreadVal = 0;
|
||||
};
|
||||
|
||||
template void PreemptionHelper::programCmdStream<GfxFamily>(LinearStream &cmdStream, PreemptionMode newPreemptionMode,
|
||||
PreemptionMode oldPreemptionMode, GraphicsAllocation *preemptionCsr);
|
||||
|
||||
|
@ -169,3 +169,25 @@ GEN12LPTEST_F(HwHelperTestsGen12LpBuffer, givenBufferThenCheckResourceCompatibil
|
||||
|
||||
EXPECT_EQ(CL_SUCCESS, errCode);
|
||||
}
|
||||
|
||||
using LriHelperTestsGen12Lp = ::testing::Test;
|
||||
|
||||
GEN12LPTEST_F(LriHelperTestsGen12Lp, whenProgrammingLriCommandThenExpectMmioRemapEnable) {
|
||||
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
||||
std::unique_ptr<uint8_t> buffer(new uint8_t[128]);
|
||||
|
||||
LinearStream stream(buffer.get(), 128);
|
||||
uint32_t address = 0x8888;
|
||||
uint32_t data = 0x1234;
|
||||
|
||||
auto expectedLri = FamilyType::cmdInitLoadRegisterImm;
|
||||
expectedLri.setRegisterOffset(address);
|
||||
expectedLri.setDataDword(data);
|
||||
expectedLri.setMmioRemapEnable(true);
|
||||
|
||||
auto lri = LriHelper<FamilyType>::program(&stream, address, data);
|
||||
|
||||
EXPECT_EQ(sizeof(MI_LOAD_REGISTER_IMM), stream.getUsed());
|
||||
EXPECT_EQ(lri, stream.getCpuBase());
|
||||
EXPECT_TRUE(memcmp(lri, &expectedLri, sizeof(MI_LOAD_REGISTER_IMM)) == 0);
|
||||
}
|
||||
|
@ -17,8 +17,11 @@ using Gen12LpPreemptionTests = DevicePreemptionTests;
|
||||
template <>
|
||||
PreemptionTestHwDetails GetPreemptionTestHwDetails<TGLLPFamily>() {
|
||||
PreemptionTestHwDetails ret;
|
||||
ret.defaultRegValue = 0;
|
||||
ret.regAddress = 0u;
|
||||
ret.modeToRegValueMap[PreemptionMode::ThreadGroup] = DwordBuilder::build(1, true) | DwordBuilder::build(2, true, false);
|
||||
ret.modeToRegValueMap[PreemptionMode::MidBatch] = DwordBuilder::build(2, true) | DwordBuilder::build(1, true, false);
|
||||
ret.modeToRegValueMap[PreemptionMode::MidThread] = DwordBuilder::build(2, true, false) | DwordBuilder::build(1, true, false);
|
||||
ret.defaultRegValue = ret.modeToRegValueMap[PreemptionMode::MidBatch];
|
||||
ret.regAddress = 0x2580u;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user