2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2023-01-10 18:06:08 +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
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2022-06-29 19:17:47 +00:00
|
|
|
#include "shared/source/gen8/hw_cmds.h"
|
2020-04-02 11:28:38 +02:00
|
|
|
#include "shared/source/helpers/constants.h"
|
2023-01-10 18:06:08 +00:00
|
|
|
#include "shared/source/helpers/hw_helper.h"
|
2022-06-10 13:16:04 +00:00
|
|
|
#include "shared/source/os_interface/hw_info_config.h"
|
2021-01-21 13:10:13 +01:00
|
|
|
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
2021-10-14 16:53:11 +00:00
|
|
|
#include "shared/test/common/helpers/hw_helper_tests.h"
|
2023-01-16 16:40:13 +00:00
|
|
|
#include "shared/test/common/mocks/mock_device.h"
|
2023-01-20 03:04:15 +00:00
|
|
|
#include "shared/test/common/mocks/mock_execution_environment.h"
|
2022-06-29 19:17:47 +00:00
|
|
|
#include "shared/test/common/test_macros/header/per_product_test_definitions.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2022-12-08 12:22:35 +00:00
|
|
|
using GfxCoreHelperTestGen8 = GfxCoreHelperTest;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2022-12-08 12:22:35 +00:00
|
|
|
GEN8TEST_F(GfxCoreHelperTestGen8, WhenGettingMaxBarriersPerSliceThenCorrectSizeIsReturned) {
|
|
|
|
|
auto &helper = getHelper<GfxCoreHelper>();
|
2017-12-21 00:45:38 +01:00
|
|
|
|
|
|
|
|
EXPECT_EQ(16u, helper.getMaxBarrierRegisterPerSlice());
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-08 12:22:35 +00:00
|
|
|
GEN8TEST_F(GfxCoreHelperTestGen8, WhenGettingPitchAlignmentForImageThenCorrectValueIsReturned) {
|
|
|
|
|
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
|
|
|
|
|
EXPECT_EQ(4u, gfxCoreHelper.getPitchAlignmentForImage(pDevice->getRootDeviceEnvironment()));
|
2019-08-23 00:23:10 +02:00
|
|
|
}
|
|
|
|
|
|
2022-12-08 12:22:35 +00:00
|
|
|
GEN8TEST_F(GfxCoreHelperTestGen8, WhenAdjustingDefaultEngineTypeThenEngineTypeIsSet) {
|
2019-05-08 17:16:25 +02:00
|
|
|
auto engineType = hardwareInfo.capabilityTable.defaultEngineType;
|
2022-12-08 12:22:35 +00:00
|
|
|
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
|
|
|
|
|
gfxCoreHelper.adjustDefaultEngineType(&hardwareInfo);
|
2019-05-08 17:16:25 +02:00
|
|
|
EXPECT_EQ(engineType, hardwareInfo.capabilityTable.defaultEngineType);
|
2018-01-09 14:25:30 +01:00
|
|
|
}
|
2018-02-19 09:50:17 +01:00
|
|
|
|
2022-12-08 12:22:35 +00:00
|
|
|
GEN8TEST_F(GfxCoreHelperTestGen8, whenGetGpgpuEnginesThenReturnThreeEngines) {
|
2023-01-10 18:06:08 +00:00
|
|
|
auto &gfxCoreHelper = getHelper<GfxCoreHelper>();
|
2023-01-25 16:13:28 +00:00
|
|
|
auto gpgpuEngines = gfxCoreHelper.getGpgpuEngineInstances(pDevice->getRootDeviceEnvironment());
|
2023-01-10 18:06:08 +00:00
|
|
|
EXPECT_EQ(3u, gpgpuEngines.size());
|
|
|
|
|
EXPECT_EQ(aub_stream::ENGINE_RCS, gpgpuEngines[0].first);
|
|
|
|
|
EXPECT_EQ(aub_stream::ENGINE_RCS, gpgpuEngines[1].first);
|
|
|
|
|
EXPECT_EQ(aub_stream::ENGINE_RCS, gpgpuEngines[2].first);
|
2021-12-13 12:45:24 +00:00
|
|
|
EXPECT_EQ(3u, pDevice->allEngines.size());
|
2019-01-10 13:57:40 +01:00
|
|
|
}
|
2020-03-19 15:08:02 +01:00
|
|
|
|
|
|
|
|
using MemorySynchronizatiopCommandsTestsGen8 = ::testing::Test;
|
|
|
|
|
GEN8TEST_F(MemorySynchronizatiopCommandsTestsGen8, WhenProgrammingCacheFlushThenExpectConstantCacheFieldSet) {
|
|
|
|
|
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
|
|
|
|
std::unique_ptr<uint8_t> buffer(new uint8_t[128]);
|
2023-01-20 03:04:15 +00:00
|
|
|
MockExecutionEnvironment mockExecutionEnvironment{};
|
2020-03-19 15:08:02 +01:00
|
|
|
LinearStream stream(buffer.get(), 128);
|
2023-01-20 03:04:15 +00:00
|
|
|
MemorySynchronizationCommands<FamilyType>::addFullCacheFlush(stream, *mockExecutionEnvironment.rootDeviceEnvironments[0]);
|
2020-04-26 21:48:59 +02:00
|
|
|
PIPE_CONTROL *pipeControl = genCmdCast<PIPE_CONTROL *>(buffer.get());
|
|
|
|
|
ASSERT_NE(nullptr, pipeControl);
|
2020-03-19 15:08:02 +01:00
|
|
|
EXPECT_TRUE(pipeControl->getConstantCacheInvalidationEnable());
|
|
|
|
|
}
|
2022-06-10 13:16:04 +00:00
|
|
|
|
2022-12-12 16:43:41 +00:00
|
|
|
using ProductHelperTestGen8 = Test<DeviceFixture>;
|
|
|
|
|
GEN8TEST_F(ProductHelperTestGen8, givenHwInfosWhenIsMatrixMultiplyAccumulateSupportedThenReturnFalse) {
|
|
|
|
|
EXPECT_FALSE(ProductHelper::get(productFamily)->isMatrixMultiplyAccumulateSupported(*defaultHwInfo));
|
2022-06-10 13:16:04 +00:00
|
|
|
}
|