2019-01-10 22:36:57 +08:00
|
|
|
/*
|
2019-12-23 21:28:33 +08:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2019-01-10 22:36:57 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-04-27 03:48:59 +08:00
|
|
|
#include "shared/test/unit_test/cmd_parse/gen_cmd_parse.h"
|
|
|
|
|
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"
|
2019-01-10 22:36:57 +08:00
|
|
|
|
|
|
|
using HwHelperTestGen11 = HwHelperTest;
|
|
|
|
|
|
|
|
GEN11TEST_F(HwHelperTestGen11, getMaxBarriersPerSliceReturnsCorrectSize) {
|
|
|
|
auto &helper = HwHelper::get(renderCoreFamily);
|
|
|
|
EXPECT_EQ(32u, helper.getMaxBarrierRegisterPerSlice());
|
|
|
|
}
|
|
|
|
|
|
|
|
GEN11TEST_F(HwHelperTestGen11, setCapabilityCoherencyFlag) {
|
|
|
|
auto &helper = HwHelper::get(renderCoreFamily);
|
|
|
|
|
|
|
|
bool coherency = false;
|
2019-05-08 23:16:25 +08:00
|
|
|
helper.setCapabilityCoherencyFlag(&hardwareInfo, coherency);
|
2019-01-10 22:36:57 +08:00
|
|
|
EXPECT_TRUE(coherency);
|
|
|
|
}
|
|
|
|
|
2019-08-23 06:23:10 +08:00
|
|
|
GEN11TEST_F(HwHelperTestGen11, getPitchAlignmentForImage) {
|
|
|
|
auto &helper = HwHelper::get(renderCoreFamily);
|
|
|
|
EXPECT_EQ(4u, helper.getPitchAlignmentForImage(&hardwareInfo));
|
|
|
|
}
|
|
|
|
|
2019-01-10 22:36:57 +08:00
|
|
|
GEN11TEST_F(HwHelperTestGen11, adjustDefaultEngineType) {
|
2019-05-08 23:16:25 +08:00
|
|
|
auto engineType = hardwareInfo.capabilityTable.defaultEngineType;
|
2019-01-10 22:36:57 +08:00
|
|
|
auto &helper = HwHelper::get(renderCoreFamily);
|
2019-05-08 23:16:25 +08:00
|
|
|
helper.adjustDefaultEngineType(&hardwareInfo);
|
|
|
|
EXPECT_EQ(engineType, hardwareInfo.capabilityTable.defaultEngineType);
|
2019-01-10 22:36:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
GEN11TEST_F(HwHelperTestGen11, givenGen11PlatformWhenSetupHardwareCapabilitiesIsCalledThenDefaultImplementationIsUsed) {
|
|
|
|
auto &helper = HwHelper::get(renderCoreFamily);
|
|
|
|
|
|
|
|
// Test default method implementation
|
2019-05-08 23:16:25 +08:00
|
|
|
testDefaultImplementationOfSetupHardwareCapabilities(helper, hardwareInfo);
|
2019-01-10 22:36:57 +08:00
|
|
|
}
|
|
|
|
|
2020-01-21 16:35:12 +08:00
|
|
|
GEN11TEST_F(HwHelperTestGen11, whenGetGpgpuEnginesThenReturnThreeRcsEngines) {
|
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 22:36:57 +08:00
|
|
|
}
|
2020-03-19 22:08:02 +08:00
|
|
|
|
|
|
|
using MemorySynchronizatiopCommandsTestsGen11 = ::testing::Test;
|
|
|
|
GEN11TEST_F(MemorySynchronizatiopCommandsTestsGen11, WhenProgrammingCacheFlushThenExpectConstantCacheFieldSet) {
|
|
|
|
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
|
|
|
std::unique_ptr<uint8_t> buffer(new uint8_t[128]);
|
|
|
|
|
|
|
|
LinearStream stream(buffer.get(), 128);
|
2020-04-27 03:48:59 +08:00
|
|
|
MemorySynchronizationCommands<FamilyType>::addFullCacheFlush(stream);
|
|
|
|
PIPE_CONTROL *pipeControl = genCmdCast<PIPE_CONTROL *>(buffer.get());
|
|
|
|
ASSERT_NE(nullptr, pipeControl);
|
2020-03-19 22:08:02 +08:00
|
|
|
EXPECT_TRUE(pipeControl->getConstantCacheInvalidationEnable());
|
|
|
|
}
|