2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2019-12-23 21:28:33 +08:00
|
|
|
* Copyright (C) 2017-2020 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-04-02 17:28:38 +08:00
|
|
|
#include "shared/source/helpers/constants.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/helpers/get_gpgpu_engines_tests.inl"
|
|
|
|
#include "opencl/test/unit_test/helpers/hw_helper_tests.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-01-10 20:57:40 +08:00
|
|
|
using HwHelperTestGen8 = HwHelperTest;
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-01-10 20:57:40 +08:00
|
|
|
GEN8TEST_F(HwHelperTestGen8, getMaxBarriersPerSliceReturnsCorrectSize) {
|
2017-12-21 07:45:38 +08:00
|
|
|
auto &helper = HwHelper::get(renderCoreFamily);
|
|
|
|
|
|
|
|
EXPECT_EQ(16u, helper.getMaxBarrierRegisterPerSlice());
|
|
|
|
}
|
|
|
|
|
2019-01-10 20:57:40 +08:00
|
|
|
GEN8TEST_F(HwHelperTestGen8, setCapabilityCoherencyFlag) {
|
2017-12-21 07:45:38 +08:00
|
|
|
auto &helper = HwHelper::get(renderCoreFamily);
|
|
|
|
|
|
|
|
bool coherency = false;
|
2019-05-08 23:16:25 +08:00
|
|
|
helper.setCapabilityCoherencyFlag(&hardwareInfo, coherency);
|
2017-12-21 07:45:38 +08:00
|
|
|
EXPECT_TRUE(coherency);
|
|
|
|
}
|
|
|
|
|
2019-08-23 06:23:10 +08:00
|
|
|
GEN8TEST_F(HwHelperTestGen8, getPitchAlignmentForImage) {
|
|
|
|
auto &helper = HwHelper::get(renderCoreFamily);
|
|
|
|
EXPECT_EQ(4u, helper.getPitchAlignmentForImage(&hardwareInfo));
|
|
|
|
}
|
|
|
|
|
2019-01-10 20:57:40 +08:00
|
|
|
GEN8TEST_F(HwHelperTestGen8, adjustDefaultEngineType) {
|
2019-05-08 23:16:25 +08:00
|
|
|
auto engineType = hardwareInfo.capabilityTable.defaultEngineType;
|
2018-01-09 21:25:30 +08:00
|
|
|
auto &helper = HwHelper::get(renderCoreFamily);
|
2019-05-08 23:16:25 +08:00
|
|
|
helper.adjustDefaultEngineType(&hardwareInfo);
|
|
|
|
EXPECT_EQ(engineType, hardwareInfo.capabilityTable.defaultEngineType);
|
2018-01-09 21:25:30 +08:00
|
|
|
}
|
2018-02-19 16:50:17 +08:00
|
|
|
|
2019-01-10 20:57:40 +08:00
|
|
|
GEN8TEST_F(HwHelperTestGen8, givenGen8PlatformWhenSetupHardwareCapabilitiesIsCalledThenSpecificImplementationIsUsed) {
|
2018-02-19 16:50:17 +08:00
|
|
|
auto &helper = HwHelper::get(renderCoreFamily);
|
|
|
|
HardwareCapabilities hwCaps = {0};
|
2019-05-08 23:16:25 +08:00
|
|
|
helper.setupHardwareCapabilities(&hwCaps, hardwareInfo);
|
2018-02-19 16:50:17 +08:00
|
|
|
|
|
|
|
EXPECT_EQ(2048u, hwCaps.image3DMaxHeight);
|
|
|
|
EXPECT_EQ(2048u, hwCaps.image3DMaxWidth);
|
2018-06-08 22:42:29 +08:00
|
|
|
EXPECT_EQ(2 * MemoryConstants::gigaByte - 8 * MemoryConstants::megaByte, hwCaps.maxMemAllocSize);
|
2018-07-10 19:22:11 +08:00
|
|
|
EXPECT_FALSE(hwCaps.isStatelesToStatefullWithOffsetSupported);
|
2018-08-23 17:29:39 +08:00
|
|
|
}
|
|
|
|
|
2020-01-21 16:35:12 +08:00
|
|
|
GEN8TEST_F(HwHelperTestGen8, whenGetGpgpuEnginesThenReturnTwoThreeEngines) {
|
2020-02-21 22:25:04 +08:00
|
|
|
whenGetGpgpuEnginesThenReturnTwoRcsEngines<FamilyType>(pDevice->getHardwareInfo());
|
2020-01-21 16:35:12 +08:00
|
|
|
EXPECT_EQ(3u, pDevice->engines.size());
|
2019-01-10 20:57:40 +08:00
|
|
|
}
|
2020-03-19 22:08:02 +08: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]);
|
|
|
|
|
|
|
|
LinearStream stream(buffer.get(), 128);
|
|
|
|
PIPE_CONTROL *pipeControl = MemorySynchronizationCommands<FamilyType>::addFullCacheFlush(stream);
|
|
|
|
EXPECT_TRUE(pipeControl->getConstantCacheInvalidationEnable());
|
|
|
|
}
|