2019-09-19 01:32:33 +08:00
|
|
|
/*
|
2025-04-14 20:58:01 +08:00
|
|
|
* Copyright (C) 2020-2025 Intel Corporation
|
2019-09-19 01:32:33 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2025-04-14 20:58:01 +08:00
|
|
|
#include "shared/source/command_stream/linear_stream.h"
|
2020-06-10 18:52:05 +08:00
|
|
|
#include "shared/source/command_stream/preemption.h"
|
2023-02-15 21:02:48 +08:00
|
|
|
#include "shared/source/gen12lp/hw_cmds_base.h"
|
|
|
|
#include "shared/source/gen12lp/hw_info_gen12lp.h"
|
2023-02-02 00:23:01 +08:00
|
|
|
#include "shared/source/helpers/gfx_core_helper.h"
|
2021-01-21 20:10:13 +08:00
|
|
|
#include "shared/test/common/mocks/mock_device.h"
|
2023-02-15 21:02:48 +08:00
|
|
|
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
|
2022-08-09 22:26:49 +08:00
|
|
|
#include "shared/test/unit_test/fixtures/preemption_fixture.h"
|
2020-06-02 16:14:02 +08:00
|
|
|
|
2019-09-19 01:32:33 +08:00
|
|
|
using namespace NEO;
|
|
|
|
|
2020-06-10 18:47:58 +08:00
|
|
|
template <>
|
2022-07-25 23:30:11 +08:00
|
|
|
PreemptionTestHwDetails getPreemptionTestHwDetails<Gen12LpFamily>() {
|
2020-06-10 18:47:58 +08:00
|
|
|
PreemptionTestHwDetails ret;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-09-19 01:32:33 +08:00
|
|
|
using Gen12LpPreemptionTests = DevicePreemptionTests;
|
|
|
|
|
2020-04-28 22:48:23 +08:00
|
|
|
GEN12LPTEST_F(Gen12LpPreemptionTests, WhenProgrammingPreemptionThenExpectLoarRegisterCommandRemapFlagEnabled) {
|
|
|
|
using MI_LOAD_REGISTER_IMM = typename FamilyType::MI_LOAD_REGISTER_IMM;
|
|
|
|
|
|
|
|
const size_t bufferSize = 128;
|
|
|
|
uint8_t buffer[bufferSize];
|
|
|
|
LinearStream cmdStream(buffer, bufferSize);
|
|
|
|
|
|
|
|
PreemptionHelper::programCmdStream<FamilyType>(cmdStream, PreemptionMode::ThreadGroup, PreemptionMode::Initial, nullptr);
|
|
|
|
auto lriCommand = genCmdCast<MI_LOAD_REGISTER_IMM *>(cmdStream.getCpuBase());
|
|
|
|
ASSERT_NE(nullptr, lriCommand);
|
|
|
|
EXPECT_TRUE(lriCommand->getMmioRemapEnable());
|
|
|
|
}
|