2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2023-01-12 19:31:00 +00:00
|
|
|
* Copyright (C) 2018-2023 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
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2023-01-20 17:45:04 +00:00
|
|
|
#include "shared/source/command_container/encode_surface_state.h"
|
2022-06-29 19:17:47 +00:00
|
|
|
#include "shared/source/gen9/hw_cmds.h"
|
2020-03-03 11:59:49 +01:00
|
|
|
#include "shared/source/gen9/reg_configs.h"
|
2023-02-01 16:23:01 +00:00
|
|
|
#include "shared/source/helpers/gfx_core_helper.h"
|
2021-10-21 14:50:10 +00:00
|
|
|
#include "shared/test/common/fixtures/memory_management_fixture.h"
|
2022-08-10 17:00:50 +00:00
|
|
|
#include "shared/test/common/helpers/static_size3.h"
|
2022-06-29 19:17:47 +00:00
|
|
|
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
|
|
|
|
|
#include "shared/test/common/test_macros/test.h"
|
2020-03-03 11:59:49 +01:00
|
|
|
|
2020-02-22 22:50:57 +01:00
|
|
|
#include "opencl/source/command_queue/command_queue_hw.h"
|
2020-05-28 14:05:12 +02:00
|
|
|
#include "opencl/test/unit_test/fixtures/cl_device_fixture.h"
|
2021-10-13 08:58:23 +00:00
|
|
|
#include "opencl/test/unit_test/helpers/cl_hw_parse.h"
|
2023-01-12 19:31:00 +00:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
|
2020-02-23 15:20:22 +01:00
|
|
|
#include "opencl/test/unit_test/mocks/mock_kernel.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
|
|
|
|
2022-08-16 14:51:17 +00:00
|
|
|
using Gen9EnqueueTest = Test<ClDeviceFixture>;
|
2017-12-21 00:45:38 +01:00
|
|
|
GEN9TEST_F(Gen9EnqueueTest, givenKernelRequiringIndependentForwardProgressWhenKernelIsSubmittedThenRoundRobinPolicyIsProgrammed) {
|
|
|
|
|
MockContext mc;
|
2022-07-25 15:30:11 +00:00
|
|
|
CommandQueueHw<Gen9Family> cmdQ{&mc, pClDevice, 0, false};
|
2020-11-19 12:30:44 +01:00
|
|
|
|
|
|
|
|
SPatchExecutionEnvironment sPatchExecEnv = {};
|
|
|
|
|
sPatchExecEnv.SubgroupIndependentForwardProgressRequired = true;
|
|
|
|
|
MockKernelWithInternals mockKernel(*pClDevice, sPatchExecEnv);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
cmdQ.enqueueKernel(mockKernel.mockKernel, 1, nullptr, StatickSize3<1, 1, 1>(), nullptr, 0, nullptr, nullptr);
|
|
|
|
|
|
2021-10-13 08:58:23 +00:00
|
|
|
ClHardwareParse hwParser;
|
2017-12-21 00:45:38 +01:00
|
|
|
hwParser.parseCommands<FamilyType>(cmdQ);
|
|
|
|
|
|
2018-02-20 08:11:24 +01:00
|
|
|
auto cmd = findMmioCmd<FamilyType>(hwParser.cmdList.begin(), hwParser.cmdList.end(), DebugControlReg2::address);
|
2017-12-21 00:45:38 +01:00
|
|
|
ASSERT_NE(nullptr, cmd);
|
2023-04-26 13:17:21 +00:00
|
|
|
EXPECT_EQ(DebugControlReg2::getRegData(ThreadArbitrationPolicy::RoundRobin), cmd->getDataDword());
|
2018-02-20 08:11:24 +01:00
|
|
|
EXPECT_EQ(1U, countMmio<FamilyType>(hwParser.cmdList.begin(), hwParser.cmdList.end(), DebugControlReg2::address));
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
2023-04-26 13:17:21 +00:00
|
|
|
GEN9TEST_F(Gen9EnqueueTest, givenKernelNotRequiringIndependentForwardProgressWhenKernelIsSubmittedThenDefaultPolicyIsProgrammed) {
|
|
|
|
|
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
|
2017-12-21 00:45:38 +01:00
|
|
|
MockContext mc;
|
2022-07-25 15:30:11 +00:00
|
|
|
CommandQueueHw<Gen9Family> cmdQ{&mc, pClDevice, 0, false};
|
2020-11-19 12:30:44 +01:00
|
|
|
|
|
|
|
|
SPatchExecutionEnvironment sPatchExecEnv = {};
|
|
|
|
|
sPatchExecEnv.SubgroupIndependentForwardProgressRequired = false;
|
|
|
|
|
MockKernelWithInternals mockKernel(*pClDevice, sPatchExecEnv);
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
cmdQ.enqueueKernel(mockKernel.mockKernel, 1, nullptr, StatickSize3<1, 1, 1>(), nullptr, 0, nullptr, nullptr);
|
|
|
|
|
|
2021-10-13 08:58:23 +00:00
|
|
|
ClHardwareParse hwParser;
|
2017-12-21 00:45:38 +01:00
|
|
|
hwParser.parseCommands<FamilyType>(cmdQ);
|
|
|
|
|
|
2018-02-20 08:11:24 +01:00
|
|
|
auto cmd = findMmioCmd<FamilyType>(hwParser.cmdList.begin(), hwParser.cmdList.end(), DebugControlReg2::address);
|
2017-12-21 00:45:38 +01:00
|
|
|
ASSERT_NE(nullptr, cmd);
|
2023-04-26 13:17:21 +00:00
|
|
|
EXPECT_EQ(DebugControlReg2::getRegData(gfxCoreHelper.getDefaultThreadArbitrationPolicy()), cmd->getDataDword());
|
2018-02-20 08:11:24 +01:00
|
|
|
EXPECT_EQ(1U, countMmio<FamilyType>(hwParser.cmdList.begin(), hwParser.cmdList.end(), DebugControlReg2::address));
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|