Debian Codegraph @

opencl/test/unit_test/gen12lp/tgllp/kernel_tests_tgllp.cpp

raw
1 /*
2 * Copyright (C) 2020-2023 Intel Corporation
3 *
4 * SPDX-License-Identifier: MIT
5 *
6 */
7
8 #include "shared/source/gen12lp/hw_cmds_tgllp.h"
9 #include "shared/source/gen12lp/hw_info_tgllp.h"
10 #include "shared/source/os_interface/product_helper.h"
11 #include "shared/test/common/mocks/mock_device.h"
12 #include "shared/test/common/mocks/mock_execution_environment.h"
13 #include "shared/test/common/test_macros/header/per_product_test_definitions.h"
14 #include "shared/test/common/test_macros/test.h"
15
16 #include "opencl/source/helpers/hardware_commands_helper.h"
17 #include "opencl/test/unit_test/mocks/mock_cl_device.h"
18 #include "opencl/test/unit_test/mocks/mock_kernel.h"
19
20 using namespace NEO;
21
22 using KernelTgllpTests = ::testing::Test;
23
24 TGLLPTEST_F(KernelTgllpTests, GivenUseOffsetToSkipSetFFIDGPWorkaroundActiveWhenSettingKernelStartOffsetThenAdditionalOffsetIsSet) {
25 const uint64_t defaultKernelStartOffset = 0;
26 const uint64_t additionalOffsetDueToFfid = 0x1234;
27
28 MockExecutionEnvironment mockExecutionEnvironment{};
29 auto hwInfo = *mockExecutionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
30 const auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
31
32 unsigned short steppings[] = {REVISION_A0, REVISION_A1};
33 for (auto stepping : steppings) {
34
35 hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(stepping, hwInfo);
36 auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
37 MockKernelWithInternals mockKernelWithInternals{*device};
38 mockKernelWithInternals.kernelInfo.kernelDescriptor.entryPoints.skipSetFFIDGP = additionalOffsetDueToFfid;
39
40 for (auto isCcsUsed : ::testing::Bool()) {
41 uint64_t kernelStartOffset = mockKernelWithInternals.mockKernel->getKernelStartAddress(false, false, isCcsUsed, false);
42
43 if (stepping == REVISION_A0 && isCcsUsed) {
44 EXPECT_EQ(defaultKernelStartOffset + additionalOffsetDueToFfid, kernelStartOffset);
45 } else {
46 EXPECT_EQ(defaultKernelStartOffset, kernelStartOffset);
47 }
48 }
49 }
50 }