Move API agnotic gen8 tests to shared

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2021-12-23 09:28:36 +00:00
committed by Compute-Runtime-Automation
parent 38ace23f72
commit eb9746987e
21 changed files with 192 additions and 209 deletions

View File

@@ -5,5 +5,13 @@
#
if(TESTS_GEN8)
target_sources(neo_shared_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/coherency_tests_gen8.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_gen8.cpp
${CMAKE_CURRENT_SOURCE_DIR}/sampler_tests_gen8.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_gen8.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_sample_gen8.cpp
)
add_subdirectories()
endif()

View File

@@ -0,0 +1,14 @@
#
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(TESTS_BDW)
target_sources(neo_shared_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_device_caps_bdw.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_bdw.cpp
)
add_subdirectories()
endif()

View File

@@ -0,0 +1,35 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
using BdwUsDeviceIdTest = ::testing::Test;
BDWTEST_F(BdwUsDeviceIdTest, WhenCheckingIsSimulationThenTrueReturnedOnlyForSimulationId) {
unsigned short bdwSimulationIds[6] = {
0x0BD0,
0x0BD1,
0x0BD2,
0x0BD3,
0x0BD4,
0, // default, non-simulation
};
for (auto &id : bdwSimulationIds) {
auto hardwareInfo = *defaultHwInfo;
hardwareInfo.platform.usDeviceID = id;
std::unique_ptr<MockDevice> mockDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hardwareInfo, 0u /*rootDeviceIndex*/));
ASSERT_NE(mockDevice.get(), nullptr);
if (id == 0)
EXPECT_FALSE(mockDevice->isSimulation());
else
EXPECT_TRUE(mockDevice->isSimulation());
}
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/compiler_hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
TEST(BdwHwInfoConfig, givenInvalidSystemInfoWhenSettingHardwareInfoThenExpectThrow) {
if (IGFX_BROADWELL != productFamily) {
return;
}
HardwareInfo hwInfo = *defaultHwInfo;
GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
uint64_t config = 0xdeadbeef;
gtSystemInfo = {0};
EXPECT_ANY_THROW(hardwareInfoSetup[productFamily](&hwInfo, false, config));
EXPECT_EQ(0u, gtSystemInfo.SliceCount);
EXPECT_EQ(0u, gtSystemInfo.SubSliceCount);
EXPECT_EQ(0u, gtSystemInfo.DualSubSliceCount);
EXPECT_EQ(0u, gtSystemInfo.EUCount);
}
using BdwHwInfo = ::testing::Test;
BDWTEST_F(BdwHwInfo, givenBoolWhenCallBdwHardwareInfoSetupThenFeatureTableAndWorkaroundTableAreSetCorrect) {
uint64_t configs[] = {
0x100030008,
0x200030008,
0x100020006,
0x100030006};
bool boolValue[]{
true, false};
HardwareInfo hwInfo = *defaultHwInfo;
GT_SYSTEM_INFO &gtSystemInfo = hwInfo.gtSystemInfo;
FeatureTable &featureTable = hwInfo.featureTable;
WorkaroundTable &workaroundTable = hwInfo.workaroundTable;
for (auto &config : configs) {
for (auto setParamBool : boolValue) {
gtSystemInfo = {0};
featureTable = {};
workaroundTable = {};
hardwareInfoSetup[productFamily](&hwInfo, setParamBool, config);
EXPECT_EQ(setParamBool, featureTable.flags.ftrL3IACoherency);
EXPECT_EQ(setParamBool, featureTable.flags.ftrPPGTT);
EXPECT_EQ(setParamBool, featureTable.flags.ftrSVM);
EXPECT_EQ(setParamBool, featureTable.flags.ftrIA32eGfxPTEs);
EXPECT_EQ(setParamBool, featureTable.flags.ftrFbc);
EXPECT_EQ(setParamBool, featureTable.flags.ftrFbc2AddressTranslation);
EXPECT_EQ(setParamBool, featureTable.flags.ftrFbcBlitterTracking);
EXPECT_EQ(setParamBool, featureTable.flags.ftrFbcCpuTracking);
EXPECT_EQ(setParamBool, featureTable.flags.ftrTileY);
EXPECT_EQ(setParamBool, workaroundTable.flags.waDisableLSQCROPERFforOCL);
EXPECT_EQ(setParamBool, workaroundTable.flags.waReportPerfCountUseGlobalContextID);
EXPECT_EQ(setParamBool, workaroundTable.flags.waUseVAlign16OnTileXYBpp816);
EXPECT_EQ(setParamBool, workaroundTable.flags.waModifyVFEStateAfterGPGPUPreemption);
EXPECT_EQ(setParamBool, workaroundTable.flags.waSamplerCacheFlushBetweenRedescribedSurfaceReads);
}
}
}
BDWTEST_F(BdwHwInfo, givenHwInfoConfigStringThenAfterSetupResultingVmeIsDisabled) {
HardwareInfo hwInfo = *defaultHwInfo;
uint64_t config = 0x0;
hardwareInfoSetup[productFamily](&hwInfo, false, config);
EXPECT_FALSE(hwInfo.capabilityTable.ftrSupportsVmeAvcTextureSampler);
EXPECT_FALSE(hwInfo.capabilityTable.ftrSupportsVmeAvcPreemption);
EXPECT_FALSE(hwInfo.capabilityTable.supportsVme);
}
using CompilerHwInfoConfigHelperTestsBdw = ::testing::Test;
BDWTEST_F(CompilerHwInfoConfigHelperTestsBdw, givenBdwWhenIsStatelessToStatefulBufferOffsetSupportedIsCalledThenReturnsTrue) {
EXPECT_FALSE(CompilerHwInfoConfig::get(productFamily)->isStatelessToStatefulBufferOffsetSupported());
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_stream/command_stream_receiver_hw.h"
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/dispatch_flags_helper.h"
#include "shared/test/common/mocks/mock_execution_environment.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
using Gen8CoherencyRequirements = ::testing::Test;
GEN8TEST_F(Gen8CoherencyRequirements, WhenMemoryManagerIsInitializedThenNoCoherencyProgramming) {
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
executionEnvironment->initializeMemoryManager();
CommandStreamReceiverHw<BDWFamily> csr(*executionEnvironment, 0, 1);
LinearStream stream;
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
auto retSize = csr.getCmdSizeForComputeMode();
EXPECT_EQ(0u, retSize);
csr.programComputeMode(stream, flags, *defaultHwInfo);
EXPECT_EQ(0u, stream.getUsed());
flags.requiresCoherency = true;
retSize = csr.getCmdSizeForComputeMode();
EXPECT_EQ(0u, retSize);
csr.programComputeMode(stream, flags, *defaultHwInfo);
EXPECT_EQ(0u, stream.getUsed());
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/constants.h"
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
#include "shared/test/common/helpers/hw_helper_tests.h"
#include "shared/test/unit_test/helpers/get_gpgpu_engines_tests.inl"
using HwHelperTestGen8 = HwHelperTest;
GEN8TEST_F(HwHelperTestGen8, WhenGettingMaxBarriersPerSliceThenCorrectSizeIsReturned) {
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_EQ(16u, helper.getMaxBarrierRegisterPerSlice());
}
GEN8TEST_F(HwHelperTestGen8, WhenGettingPitchAlignmentForImageThenCorrectValueIsReturned) {
auto &helper = HwHelper::get(renderCoreFamily);
EXPECT_EQ(4u, helper.getPitchAlignmentForImage(&hardwareInfo));
}
GEN8TEST_F(HwHelperTestGen8, WhenAdjustingDefaultEngineTypeThenEngineTypeIsSet) {
auto engineType = hardwareInfo.capabilityTable.defaultEngineType;
auto &helper = HwHelper::get(renderCoreFamily);
helper.adjustDefaultEngineType(&hardwareInfo);
EXPECT_EQ(engineType, hardwareInfo.capabilityTable.defaultEngineType);
}
GEN8TEST_F(HwHelperTestGen8, whenGetGpgpuEnginesThenReturnThreeEngines) {
whenGetGpgpuEnginesThenReturnTwoRcsEngines<FamilyType>(pDevice->getHardwareInfo());
EXPECT_EQ(3u, pDevice->allEngines.size());
}
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);
MemorySynchronizationCommands<FamilyType>::addFullCacheFlush(stream, *defaultHwInfo);
PIPE_CONTROL *pipeControl = genCmdCast<PIPE_CONTROL *>(buffer.get());
ASSERT_NE(nullptr, pipeControl);
EXPECT_TRUE(pipeControl->getConstantCacheInvalidationEnable());
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/test.h"
#include <memory>
using namespace NEO;
using Gen8SamplerTest = ::testing::Test;
GEN8TEST_F(Gen8SamplerTest, WhenAppendingSamplerStateParamsThenStateIsNotChanged) {
typedef typename FamilyType::SAMPLER_STATE SAMPLER_STATE;
auto stateWithoutAppendedParams = FamilyType::cmdInitSamplerState;
auto stateWithAppendedParams = FamilyType::cmdInitSamplerState;
EXPECT_TRUE(memcmp(&stateWithoutAppendedParams, &stateWithAppendedParams, sizeof(SAMPLER_STATE)) == 0);
HwInfoConfig::get(defaultHwInfo->platform.eProductFamily)->adjustSamplerState(&stateWithAppendedParams, *defaultHwInfo);
EXPECT_TRUE(memcmp(&stateWithoutAppendedParams, &stateWithAppendedParams, sizeof(SAMPLER_STATE)) == 0);
}

View File

@@ -0,0 +1,96 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/hw_helper.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
using Gen8DeviceCaps = Test<DeviceFixture>;
GEN8TEST_F(Gen8DeviceCaps, GivenDefaultWhenCheckingPreemptionModeThenDisabledIsReported) {
EXPECT_TRUE(PreemptionMode::Disabled == pDevice->getHardwareInfo().capabilityTable.defaultPreemptionMode);
}
GEN8TEST_F(Gen8DeviceCaps, BdwProfilingTimerResolution) {
const auto &caps = pDevice->getDeviceInfo();
EXPECT_EQ(80u, caps.outProfilingTimerResolution);
}
GEN8TEST_F(Gen8DeviceCaps, givenHwInfoWhenRequestedComputeUnitsUsedForScratchThenReturnValidValue) {
const auto &hwInfo = pDevice->getHardwareInfo();
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
uint32_t expectedValue = hwInfo.gtSystemInfo.MaxSubSlicesSupported * hwInfo.gtSystemInfo.MaxEuPerSubSlice *
hwInfo.gtSystemInfo.ThreadCount / hwInfo.gtSystemInfo.EUCount;
EXPECT_EQ(expectedValue, hwHelper.getComputeUnitsUsedForScratch(&hwInfo));
EXPECT_EQ(expectedValue, pDevice->getDeviceInfo().computeUnitsUsedForScratch);
}
GEN8TEST_F(Gen8DeviceCaps, givenHwInfoWhenRequestedMaxFrontEndThreadsThenReturnValidValue) {
const auto &hwInfo = pDevice->getHardwareInfo();
EXPECT_EQ(HwHelper::getMaxThreadsForVfe(hwInfo), pDevice->getDeviceInfo().maxFrontEndThreads);
}
GEN8TEST_F(Gen8DeviceCaps, GivenBdwWhenCheckftr64KBpagesThenFalse) {
EXPECT_FALSE(defaultHwInfo->capabilityTable.ftr64KBpages);
}
GEN8TEST_F(Gen8DeviceCaps, GivenDefaultSettingsWhenCheckingPreemptionModeThenPreemptionIsDisabled) {
EXPECT_TRUE(PreemptionMode::Disabled == pDevice->getHardwareInfo().capabilityTable.defaultPreemptionMode);
}
GEN8TEST_F(Gen8DeviceCaps, WhenCheckingKmdNotifyMechanismThenPropertiesAreSetCorrectly) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableKmdNotify);
EXPECT_EQ(50000, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayKmdNotifyMicroseconds);
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleep);
EXPECT_EQ(5000, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepMicroseconds);
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForSporadicWaits);
EXPECT_EQ(200000, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForSporadicWaitsMicroseconds);
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.enableQuickKmdSleepForDirectSubmission);
EXPECT_EQ(0, pDevice->getHardwareInfo().capabilityTable.kmdNotifyProperties.delayQuickKmdSleepForDirectSubmissionMicroseconds);
}
GEN8TEST_F(Gen8DeviceCaps, WhenCheckingCompressionThenItIsDisabled) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrRenderCompressedBuffers);
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.ftrRenderCompressedImages);
}
GEN8TEST_F(Gen8DeviceCaps, WhenCheckingImage3dDimensionsThenCapsAreSetCorrectly) {
const auto &sharedCaps = pDevice->getDeviceInfo();
EXPECT_EQ(2048u, sharedCaps.image3DMaxDepth);
}
GEN8TEST_F(Gen8DeviceCaps, givenHwInfoWhenSlmSizeIsRequiredThenReturnCorrectValue) {
EXPECT_EQ(64u, pDevice->getHardwareInfo().capabilityTable.slmSize);
}
GEN8TEST_F(Gen8DeviceCaps, givenGen8WhenCheckSupportCacheFlushAfterWalkerThenFalse) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.supportCacheFlushAfterWalker);
}
GEN8TEST_F(Gen8DeviceCaps, givenGen8WhenCheckBlitterOperationsSupportThenReturnFalse) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.blitterOperationsSupported);
}
GEN8TEST_F(Gen8DeviceCaps, givenGen8WhenCheckFtrSupportsInteger64BitAtomicsThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.ftrSupportsInteger64BitAtomics);
}
GEN8TEST_F(Gen8DeviceCaps, givenGen8WhenCheckingImageSupportThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsImages);
}
GEN8TEST_F(Gen8DeviceCaps, givenGen8WhenCheckingMediaBlockSupportThenReturnTrue) {
EXPECT_TRUE(pDevice->getHardwareInfo().capabilityTable.supportsMediaBlock);
}
GEN8TEST_F(Gen8DeviceCaps, givenGen8WhenCheckingDeviceEnqueueSupportThenReturnFalse) {
EXPECT_FALSE(pDevice->getHardwareInfo().capabilityTable.supportsDeviceEnqueue);
}

View File

@@ -0,0 +1,23 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
using BroadwellOnlyTest = ::testing::Test;
BDWTEST_F(BroadwellOnlyTest, WhenGettingProductFamilyThenBroadwellIsReturned) {
EXPECT_EQ(IGFX_BROADWELL, defaultHwInfo->platform.eProductFamily);
}
using Gen8OnlyTest = ::testing::Test;
GEN8TEST_F(Gen8OnlyTest, WhenGettingRenderCoreFamilyThenGen8CoreIsReturned) {
EXPECT_EQ(IGFX_GEN8_CORE, defaultHwInfo->platform.eRenderCoreFamily);
}

View File

@@ -0,0 +1,12 @@
#
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
if(WIN32)
target_sources(neo_shared_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/gmm_callbacks_tests_gen8.cpp
)
endif()

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2018-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/windows/gmm_callbacks.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
using Gen8GmmCallbacksTests = ::testing::Test;
GEN8TEST_F(Gen8GmmCallbacksTests, GivenDefaultWhenNotifyingAubCaptureThenDeviceCallbackIsNotSupported) {
EXPECT_EQ(0, DeviceCallbacks<FamilyType>::notifyAubCapture(nullptr, 0, 0, false));
}
GEN8TEST_F(Gen8GmmCallbacksTests, GivenDefaultWhenWritingL3AddressThenTtCallbackIsNotSupported) {
EXPECT_EQ(0, TTCallbacks<FamilyType>::writeL3Address(nullptr, 1, 2));
}