Files
compute-runtime/opencl/test/unit_test/gen12lp/tgllp/kernel_tests_tgllp.cpp
Kamil Kopryk fa8579602f refactor: rename product helper files n/n
Related-To: NEO-7703
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
2023-03-10 13:24:38 +01:00

51 lines
2.1 KiB
C++

/*
* Copyright (C) 2020-2023 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/gen12lp/hw_cmds_tgllp.h"
#include "shared/source/gen12lp/hw_info_tgllp.h"
#include "shared/source/os_interface/product_helper.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
#include "shared/test/common/test_macros/test.h"
#include "opencl/source/helpers/hardware_commands_helper.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_kernel.h"
using namespace NEO;
using KernelTgllpTests = ::testing::Test;
TGLLPTEST_F(KernelTgllpTests, GivenUseOffsetToSkipSetFFIDGPWorkaroundActiveWhenSettingKernelStartOffsetThenAdditionalOffsetIsSet) {
const uint64_t defaultKernelStartOffset = 0;
const uint64_t additionalOffsetDueToFfid = 0x1234;
MockExecutionEnvironment mockExecutionEnvironment{};
auto hwInfo = *mockExecutionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
const auto &productHelper = mockExecutionEnvironment.rootDeviceEnvironments[0]->getHelper<ProductHelper>();
unsigned short steppings[] = {REVISION_A0, REVISION_A1};
for (auto stepping : steppings) {
hwInfo.platform.usRevId = productHelper.getHwRevIdFromStepping(stepping, hwInfo);
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
MockKernelWithInternals mockKernelWithInternals{*device};
mockKernelWithInternals.kernelInfo.kernelDescriptor.entryPoints.skipSetFFIDGP = additionalOffsetDueToFfid;
for (auto isCcsUsed : ::testing::Bool()) {
uint64_t kernelStartOffset = mockKernelWithInternals.mockKernel->getKernelStartAddress(false, false, isCcsUsed, false);
if (stepping == REVISION_A0 && isCcsUsed) {
EXPECT_EQ(defaultKernelStartOffset + additionalOffsetDueToFfid, kernelStartOffset);
} else {
EXPECT_EQ(defaultKernelStartOffset, kernelStartOffset);
}
}
}
}