Add shared tests for xe_hp_core
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
parent
5a78fe3728
commit
7a99bcc2f7
|
@ -8,16 +8,18 @@ if(TESTS_XE_HP_CORE)
|
|||
|
||||
set(NEO_CORE_TESTS_XE_HP_CORE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/image_surface_state_tests_xe_hp_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/simd_helper_tests_xe_hp_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_encode_xe_hp_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_xe_hp_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_preemption_xe_hp_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_traits_xe_hp_core.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/unit_test_helper_xe_hp_core.cpp
|
||||
)
|
||||
set_property(GLOBAL PROPERTY NEO_CORE_TESTS_XE_HP_CORE ${NEO_CORE_TESTS_XE_HP_CORE})
|
||||
add_subdirectories()
|
||||
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/unit_test_helper_xe_hp_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_xe_hp_core.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_preemption_xe_hp_core.cpp
|
||||
${COMPUTE_RUNTIME_ULT_XE_HP_CORE}
|
||||
${NEO_CORE_TESTS_XE_HP_CORE}
|
||||
)
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/unit_test/image/image_surface_state_fixture.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using ImageSurfaceStateTestsXeHpCore = ImageSurfaceStateTests;
|
||||
|
||||
XE_HP_CORE_TEST_F(ImageSurfaceStateTestsXeHpCore, givenGmmWithMediaCompressedWhenSetFlagsForMediaCompressionThenAuxiliarySurfaceNoneIsSetAndMemoryCompressionEnable) {
|
||||
auto size = sizeof(typename FamilyType::RENDER_SURFACE_STATE);
|
||||
auto surfaceState = std::make_unique<char[]>(size);
|
||||
auto castSurfaceState = reinterpret_cast<typename FamilyType::RENDER_SURFACE_STATE *>(surfaceState.get());
|
||||
castSurfaceState->setAuxiliarySurfaceMode(FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
|
||||
mockGmm.gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = false;
|
||||
EncodeSurfaceState<FamilyType>::setFlagsForMediaCompression(castSurfaceState, &mockGmm);
|
||||
EXPECT_EQ(castSurfaceState->getAuxiliarySurfaceMode(), FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_CCS_E);
|
||||
EXPECT_EQ(castSurfaceState->getMemoryCompressionEnable(), false);
|
||||
mockGmm.gmmResourceInfo->getResourceFlags()->Info.MediaCompressed = true;
|
||||
EncodeSurfaceState<FamilyType>::setFlagsForMediaCompression(castSurfaceState, &mockGmm);
|
||||
EXPECT_EQ(castSurfaceState->getAuxiliarySurfaceMode(), FamilyType::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE::AUXILIARY_SURFACE_MODE_AUX_NONE);
|
||||
EXPECT_EQ(castSurfaceState->getMemoryCompressionEnable(), true);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(ImageSurfaceStateTestsXeHpCore, givenGmmWhenSetClearColorParamsThenClearValueAddressEnable) {
|
||||
auto size = sizeof(typename FamilyType::RENDER_SURFACE_STATE);
|
||||
auto surfaceState = std::make_unique<char[]>(size);
|
||||
auto castSurfaceState = reinterpret_cast<typename FamilyType::RENDER_SURFACE_STATE *>(surfaceState.get());
|
||||
|
||||
mockGmm.gmmResourceInfo->getResourceFlags()->Gpu.IndirectClearColor = true;
|
||||
EncodeSurfaceState<FamilyType>::setClearColorParams(castSurfaceState, &mockGmm);
|
||||
EXPECT_EQ(castSurfaceState->getClearValueAddressEnable(), true);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(ImageSurfaceStateTestsXeHpCore, givenGmmWithMediaCompressedWhenSetMipTailStartLodThenMipTailStartLodIsSet) {
|
||||
auto size = sizeof(typename FamilyType::RENDER_SURFACE_STATE);
|
||||
auto surfaceState = std::make_unique<char[]>(size);
|
||||
auto castSurfaceState = reinterpret_cast<typename FamilyType::RENDER_SURFACE_STATE *>(surfaceState.get());
|
||||
|
||||
setMipTailStartLod<FamilyType>(castSurfaceState, nullptr);
|
||||
|
||||
EXPECT_EQ(castSurfaceState->getMipTailStartLod(), 0u);
|
||||
|
||||
setMipTailStartLod<FamilyType>(castSurfaceState, &mockGmm);
|
||||
|
||||
EXPECT_EQ(castSurfaceState->getMipTailStartLod(), mockGmm.gmmResourceInfo->getMipTailStartLodSurfaceState());
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/helpers/simd_helper_tests.inl"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using TestSimdConfigSet = ::testing::Test;
|
||||
|
||||
XE_HP_CORE_TEST_F(TestSimdConfigSet, GivenSimdSizeWhenGetSimdConfigCalledThenCorrectEnumReturnedXeHpCore) {
|
||||
GivenSimdSizeWhenGetSimdConfigCalledThenCorrectEnumReturned<typename FamilyType::COMPUTE_WALKER>::TestBodyImpl();
|
||||
}
|
|
@ -0,0 +1,245 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
||||
#include "shared/test/common/fixtures/command_container_fixture.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/mocks/mock_dispatch_kernel_encoder_interface.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include "hw_cmds.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using CommandEncodeXeHpCoreTest = ::testing::Test;
|
||||
|
||||
XE_HP_CORE_TEST_F(CommandEncodeXeHpCoreTest, whenProgrammingStateComputeModeThenProperFieldsAreSet) {
|
||||
using STATE_COMPUTE_MODE = typename FamilyType::STATE_COMPUTE_MODE;
|
||||
uint8_t buffer[64]{};
|
||||
|
||||
StateComputeModeProperties properties;
|
||||
auto pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
|
||||
EncodeComputeMode<FamilyType>::adjustComputeMode(*pLinearStream, nullptr, properties);
|
||||
auto pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
|
||||
EXPECT_EQ(0u, pScm->getMaskBits());
|
||||
EXPECT_EQ(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_DISABLED, pScm->getForceNonCoherent());
|
||||
EXPECT_FALSE(pScm->getLargeGrfMode());
|
||||
|
||||
properties.isCoherencyRequired.value = 0;
|
||||
properties.largeGrfMode.value = 1;
|
||||
pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
|
||||
EncodeComputeMode<FamilyType>::adjustComputeMode(*pLinearStream, nullptr, properties);
|
||||
pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
|
||||
EXPECT_EQ(0u, pScm->getMaskBits());
|
||||
EXPECT_EQ(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_DISABLED, pScm->getForceNonCoherent());
|
||||
EXPECT_FALSE(pScm->getLargeGrfMode());
|
||||
|
||||
properties.isCoherencyRequired.isDirty = true;
|
||||
properties.largeGrfMode.isDirty = true;
|
||||
pLinearStream = std::make_unique<LinearStream>(buffer, sizeof(buffer));
|
||||
EncodeComputeMode<FamilyType>::adjustComputeMode(*pLinearStream, nullptr, properties);
|
||||
pScm = reinterpret_cast<STATE_COMPUTE_MODE *>(pLinearStream->getCpuBase());
|
||||
auto expectedMask = FamilyType::stateComputeModeForceNonCoherentMask |
|
||||
FamilyType::stateComputeModeLargeGrfModeMask;
|
||||
EXPECT_EQ(expectedMask, pScm->getMaskBits());
|
||||
EXPECT_EQ(STATE_COMPUTE_MODE::FORCE_NON_COHERENT_FORCE_GPU_NON_COHERENT, pScm->getForceNonCoherent());
|
||||
EXPECT_TRUE(pScm->getLargeGrfMode());
|
||||
}
|
||||
|
||||
struct EncodeKernelGlobalAtomicsFixture : public CommandEncodeStatesFixture, public ::testing::Test {
|
||||
void SetUp() override {
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(2);
|
||||
osLocalMemoryBackup = std::make_unique<VariableBackup<bool>>(&OSInterface::osEnableLocalMemory, true);
|
||||
mockDeviceBackup = std::make_unique<VariableBackup<bool>>(&MockDevice::createSingleDevice, false);
|
||||
|
||||
CommandEncodeStatesFixture::SetUp();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
CommandEncodeStatesFixture::TearDown();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
std::unique_ptr<VariableBackup<bool>> osLocalMemoryBackup;
|
||||
std::unique_ptr<VariableBackup<bool>> mockDeviceBackup;
|
||||
};
|
||||
|
||||
struct EncodeKernelGlobalAtomicsTestWithImplicitScalingTests : public EncodeKernelGlobalAtomicsFixture {
|
||||
void SetUp() override {
|
||||
DebugManager.flags.EnableWalkerPartition.set(1);
|
||||
EncodeKernelGlobalAtomicsFixture::SetUp();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
EncodeKernelGlobalAtomicsFixture::TearDown();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
};
|
||||
|
||||
XE_HP_CORE_TEST_F(EncodeKernelGlobalAtomicsTestWithImplicitScalingTests, givenCleanHeapsAndSlmNotChangedAndNoUncachedMocsAndGlobalAtomicsUsedThenDisableSupportForMultiGpuAtomicsForStatelessAccessesIsFalse) {
|
||||
uint32_t dims[] = {2, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
cmdContainer->slmSize = 1;
|
||||
EXPECT_CALL(*dispatchInterface.get(), getSlmTotalSize()).WillRepeatedly(::testing::Return(cmdContainer->slmSize));
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
bool useGlobalAtomics = true;
|
||||
uint32_t partitionCount = 0;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, false, false,
|
||||
pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs, useGlobalAtomics, partitionCount, false);
|
||||
|
||||
EXPECT_TRUE(cmdContainer->lastSentUseGlobalAtomics);
|
||||
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
|
||||
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
auto itor = find<STATE_BASE_ADDRESS *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(commands.end(), itor);
|
||||
|
||||
auto cmdSba = genCmdCast<STATE_BASE_ADDRESS *>(*itor);
|
||||
EXPECT_FALSE(cmdSba->getDisableSupportForMultiGpuAtomicsForStatelessAccesses());
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(EncodeKernelGlobalAtomicsTestWithImplicitScalingTests, givenCleanHeapsAndSlmNotChangedAndNoUncachedMocsAndGlobalAtomicsUsedAndLastSentGlobalAtomicsTrueThenSbaIsNotProgrammed) {
|
||||
uint32_t dims[] = {2, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
cmdContainer->slmSize = 1;
|
||||
EXPECT_CALL(*dispatchInterface.get(), getSlmTotalSize()).WillRepeatedly(::testing::Return(cmdContainer->slmSize));
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
bool useGlobalAtomics = true;
|
||||
cmdContainer->lastSentUseGlobalAtomics = true;
|
||||
uint32_t partitionCount = 0;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, false, false,
|
||||
pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs, useGlobalAtomics, partitionCount, false);
|
||||
|
||||
EXPECT_TRUE(cmdContainer->lastSentUseGlobalAtomics);
|
||||
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
|
||||
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
auto itor = find<STATE_BASE_ADDRESS *>(commands.begin(), commands.end());
|
||||
ASSERT_EQ(commands.end(), itor);
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(EncodeKernelGlobalAtomicsTestWithImplicitScalingTests, givenCleanHeapsAndSlmNotChangedAndNoUncachedMocsAndNoGlobalAtomicsUsedAndLastSentGlobalAtomicsTrueThenDisableSupportForMultiGpuAtomicsForStatelessAccessesIsTrue) {
|
||||
uint32_t dims[] = {2, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
cmdContainer->slmSize = 1;
|
||||
EXPECT_CALL(*dispatchInterface.get(), getSlmTotalSize()).WillRepeatedly(::testing::Return(cmdContainer->slmSize));
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
bool useGlobalAtomics = false;
|
||||
cmdContainer->lastSentUseGlobalAtomics = true;
|
||||
uint32_t partitionCount = 0;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, false, false,
|
||||
pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs, useGlobalAtomics, partitionCount, false);
|
||||
|
||||
EXPECT_FALSE(cmdContainer->lastSentUseGlobalAtomics);
|
||||
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
|
||||
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
auto itor = find<STATE_BASE_ADDRESS *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(commands.end(), itor);
|
||||
|
||||
auto cmdSba = genCmdCast<STATE_BASE_ADDRESS *>(*itor);
|
||||
EXPECT_TRUE(cmdSba->getDisableSupportForMultiGpuAtomicsForStatelessAccesses());
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(EncodeKernelGlobalAtomicsTestWithImplicitScalingTests, givenCleanHeapsAndSlmNotChangedAndUncachedMocsAndNoGlobalAtomicsUsedAndLastSentGlobalAtomicsTrueThenDisableSupportForMultiGpuAtomicsForStatelessAccessesIsTrue) {
|
||||
uint32_t dims[] = {2, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
cmdContainer->slmSize = 1;
|
||||
EXPECT_CALL(*dispatchInterface.get(), getSlmTotalSize()).WillRepeatedly(::testing::Return(cmdContainer->slmSize));
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
|
||||
bool requiresUncachedMocs = true;
|
||||
bool useGlobalAtomics = false;
|
||||
cmdContainer->lastSentUseGlobalAtomics = true;
|
||||
uint32_t partitionCount = 0;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, false, false,
|
||||
pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs, useGlobalAtomics, partitionCount, false);
|
||||
|
||||
EXPECT_FALSE(cmdContainer->lastSentUseGlobalAtomics);
|
||||
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
|
||||
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
auto itor = find<STATE_BASE_ADDRESS *>(commands.begin(), commands.end());
|
||||
ASSERT_NE(commands.end(), itor);
|
||||
|
||||
auto cmdSba = genCmdCast<STATE_BASE_ADDRESS *>(*itor);
|
||||
EXPECT_TRUE(cmdSba->getDisableSupportForMultiGpuAtomicsForStatelessAccesses());
|
||||
}
|
||||
|
||||
XE_HP_CORE_TEST_F(EncodeKernelGlobalAtomicsTestWithImplicitScalingTests, givenCleanHeapsAndSlmNotChangedAndNoUncachedMocsAndNoGlobalAtomicsUsedThenSbaIsNotProgrammed) {
|
||||
uint32_t dims[] = {2, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
cmdContainer->slmSize = 1;
|
||||
EXPECT_CALL(*dispatchInterface.get(), getSlmTotalSize()).WillRepeatedly(::testing::Return(cmdContainer->slmSize));
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
bool useGlobalAtomics = false;
|
||||
uint32_t partitionCount = 0;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, false, false,
|
||||
pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs, useGlobalAtomics, partitionCount, false);
|
||||
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
|
||||
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
auto itor = find<STATE_BASE_ADDRESS *>(commands.begin(), commands.end());
|
||||
ASSERT_EQ(commands.end(), itor);
|
||||
}
|
||||
|
||||
struct EncodeKernelGlobalAtomicsTestWithNoImplicitScalingTests : public EncodeKernelGlobalAtomicsFixture {
|
||||
void SetUp() override {
|
||||
DebugManager.flags.EnableWalkerPartition.set(0);
|
||||
EncodeKernelGlobalAtomicsFixture::SetUp();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
EncodeKernelGlobalAtomicsFixture::TearDown();
|
||||
}
|
||||
|
||||
DebugManagerStateRestore restorer;
|
||||
};
|
||||
|
||||
XE_HP_CORE_TEST_F(EncodeKernelGlobalAtomicsTestWithNoImplicitScalingTests, givenCleanHeapsAndSlmNotChangedAndNoUncachedMocsAndGlobalAtomicsUsedWithNoImplicitScalingThenSBAIsNotProgrammed) {
|
||||
uint32_t dims[] = {2, 1, 1};
|
||||
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
|
||||
cmdContainer->slmSize = 1;
|
||||
EXPECT_CALL(*dispatchInterface.get(), getSlmTotalSize()).WillRepeatedly(::testing::Return(cmdContainer->slmSize));
|
||||
cmdContainer->setDirtyStateForAllHeaps(false);
|
||||
|
||||
bool requiresUncachedMocs = false;
|
||||
bool useGlobalAtomics = true;
|
||||
uint32_t partitionCount = 0;
|
||||
EncodeDispatchKernel<FamilyType>::encode(*cmdContainer.get(), dims, false, false, dispatchInterface.get(), 0, false, false,
|
||||
pDevice, NEO::PreemptionMode::Disabled, requiresUncachedMocs, useGlobalAtomics, partitionCount, false);
|
||||
|
||||
EXPECT_FALSE(cmdContainer->lastSentUseGlobalAtomics);
|
||||
GenCmdList commands;
|
||||
CmdParse<FamilyType>::parseCommandBuffer(commands, ptrOffset(cmdContainer->getCommandStream()->getCpuBase(), 0), cmdContainer->getCommandStream()->getUsed());
|
||||
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
auto itor = find<STATE_BASE_ADDRESS *>(commands.begin(), commands.end());
|
||||
EXPECT_EQ(commands.end(), itor);
|
||||
}
|
|
@ -13,9 +13,9 @@
|
|||
|
||||
using namespace NEO;
|
||||
|
||||
using XeHPHwInfoConfig = Test<DeviceFixture>;
|
||||
using XeHPMaxThreadsTest = Test<DeviceFixture>;
|
||||
|
||||
XEHPTEST_F(XeHPHwInfoConfig, givenXEHPWithA0SteppingThenMaxThreadsForWorkgroupWAIsRequired) {
|
||||
XEHPTEST_F(XeHPMaxThreadsTest, givenXEHPWithA0SteppingThenMaxThreadsForWorkgroupWAIsRequired) {
|
||||
auto hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
auto hwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
|
@ -24,7 +24,7 @@ XEHPTEST_F(XeHPHwInfoConfig, givenXEHPWithA0SteppingThenMaxThreadsForWorkgroupWA
|
|||
EXPECT_TRUE(isWARequired);
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPHwInfoConfig, givenXEHPWithBSteppingThenMaxThreadsForWorkgroupWAIsNotRequired) {
|
||||
XEHPTEST_F(XeHPMaxThreadsTest, givenXEHPWithBSteppingThenMaxThreadsForWorkgroupWAIsNotRequired) {
|
||||
auto hwInfoConfig = HwInfoConfig::get(productFamily);
|
||||
auto hwInfo = pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
|
||||
auto &hwHelper = HwHelper::get(hwInfo->platform.eRenderCoreFamily);
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#
|
||||
# Copyright (C) 2021 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(TESTS_XEHP)
|
||||
set(NEO_CORE_TESTS_XE_HP_CORE_XEHP
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_helper_xehp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_preamble_xehp.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/test_preemption_xehp.cpp
|
||||
)
|
||||
|
||||
target_sources(${TARGET_NAME} PRIVATE ${NEO_CORE_TESTS_XE_HP_CORE_XEHP})
|
||||
endif()
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
using HwHelperTestXeHP = ::testing::Test;
|
||||
|
||||
XEHPTEST_F(HwHelperTestXeHP, givenSteppingWhenAskingForLocalMemoryAccessModeThenDisallowOnA0) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
auto renderCoreFamily = defaultHwInfo->platform.eRenderCoreFamily;
|
||||
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
|
||||
hwInfo.platform.usRevId = helper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
|
||||
EXPECT_EQ(LocalMemoryAccessMode::CpuAccessDisallowed, helper.getLocalMemoryAccessMode(hwInfo));
|
||||
|
||||
hwInfo.platform.usRevId = helper.getHwRevIdFromStepping(REVISION_B, hwInfo);
|
||||
EXPECT_EQ(LocalMemoryAccessMode::Default, helper.getLocalMemoryAccessMode(hwInfo));
|
||||
}
|
||||
|
||||
XEHPTEST_F(HwHelperTestXeHP, givenSteppingAorBWhenCheckingSipWAThenTrueIsReturned) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
auto renderCoreFamily = defaultHwInfo->platform.eRenderCoreFamily;
|
||||
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
|
||||
hwInfo.platform.usRevId = helper.getHwRevIdFromStepping(REVISION_A0, hwInfo);
|
||||
EXPECT_TRUE(helper.isSipWANeeded(hwInfo));
|
||||
|
||||
hwInfo.platform.usRevId = helper.getHwRevIdFromStepping(REVISION_B, hwInfo);
|
||||
EXPECT_TRUE(helper.isSipWANeeded(hwInfo));
|
||||
}
|
||||
|
||||
XEHPTEST_F(HwHelperTestXeHP, givenSteppingCWhenCheckingSipWAThenFalseIsReturned) {
|
||||
HardwareInfo hwInfo = *defaultHwInfo;
|
||||
auto renderCoreFamily = defaultHwInfo->platform.eRenderCoreFamily;
|
||||
|
||||
auto &helper = HwHelper::get(renderCoreFamily);
|
||||
|
||||
hwInfo.platform.usRevId = helper.getHwRevIdFromStepping(REVISION_C, hwInfo);
|
||||
EXPECT_FALSE(helper.isSipWANeeded(hwInfo));
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
#include "shared/test/common/mocks/mock_graphics_allocation.h"
|
||||
|
||||
#include "opencl/source/helpers/hardware_commands_helper.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
struct XeHPSlm : HardwareParse, ::testing::Test {
|
||||
void SetUp() override {
|
||||
HardwareParse::SetUp();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
HardwareParse::TearDown();
|
||||
}
|
||||
|
||||
uint32_t cmdBuffer[1024];
|
||||
MockGraphicsAllocation gfxAllocation{cmdBuffer, sizeof(cmdBuffer)};
|
||||
LinearStream linearStream{&gfxAllocation};
|
||||
};
|
||||
|
||||
XEHPTEST_F(XeHPSlm, givenTglWhenPreambleIsBeingProgrammedThenThreadArbitrationPolicyIsIgnored) {
|
||||
typedef XeHpFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
||||
LinearStream &cs = linearStream;
|
||||
uint32_t l3Config = PreambleHelper<XeHpFamily>::getL3Config(*defaultHwInfo, true);
|
||||
MockDevice mockDevice;
|
||||
PreambleHelper<XeHpFamily>::programPreamble(&linearStream, mockDevice, l3Config,
|
||||
ThreadArbitrationPolicy::RoundRobin,
|
||||
nullptr);
|
||||
|
||||
parseCommands<XeHpFamily>(cs);
|
||||
|
||||
// parse through commands and ensure that 0xE404 is not being programmed
|
||||
EXPECT_EQ(0U, countMmio<FamilyType>(cmdList.begin(), cmdList.end(), 0xE404));
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPSlm, WhenProgrammingL3ThenLoadRegisterImmNotUsed) {
|
||||
typedef XeHpFamily::MI_LOAD_REGISTER_IMM MI_LOAD_REGISTER_IMM;
|
||||
LinearStream &cs = linearStream;
|
||||
uint32_t l3Config = PreambleHelper<FamilyType>::getL3Config(*defaultHwInfo, true);
|
||||
PreambleHelper<FamilyType>::programL3(&cs, l3Config);
|
||||
|
||||
parseCommands<XeHpFamily>(cs);
|
||||
|
||||
auto itorLRI = find<MI_LOAD_REGISTER_IMM *>(cmdList.begin(), cmdList.end());
|
||||
ASSERT_EQ(cmdList.end(), itorLRI);
|
||||
}
|
||||
|
||||
using XeHPUrbEntryAllocationSize = ::testing::Test;
|
||||
XEHPTEST_F(XeHPUrbEntryAllocationSize, WhenGettingUrbEntryAllocationSizeTheZeroIsReturned) {
|
||||
uint32_t actualVal = PreambleHelper<FamilyType>::getUrbEntryAllocationSize();
|
||||
EXPECT_EQ(0u, actualVal);
|
||||
}
|
||||
|
||||
using XeHPPreambleVfeState = XeHPSlm;
|
||||
XEHPTEST_F(XeHPPreambleVfeState, givenDefaultPipeControlWhenItIsProgrammedThenCsStallBitIsSet) {
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
PIPE_CONTROL *pipeControl = static_cast<PIPE_CONTROL *>(linearStream.getSpace(sizeof(PIPE_CONTROL)));
|
||||
*pipeControl = FamilyType::cmdInitPipeControl;
|
||||
|
||||
EXPECT_EQ(1u, pipeControl->getCommandStreamerStallEnable());
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPPreambleVfeState, whenProgrammingComputeWalkerThenUavFieldsSetToZero) {
|
||||
using COMPUTE_WALKER = typename FamilyType::COMPUTE_WALKER;
|
||||
|
||||
COMPUTE_WALKER *computeWalker = static_cast<COMPUTE_WALKER *>(linearStream.getSpace(sizeof(COMPUTE_WALKER)));
|
||||
*computeWalker = FamilyType::cmdInitGpgpuWalker;
|
||||
|
||||
EXPECT_FALSE(computeWalker->getUavWaitToProduce());
|
||||
EXPECT_FALSE(computeWalker->getUavProducer());
|
||||
EXPECT_FALSE(computeWalker->getUavConsumer());
|
||||
}
|
||||
|
||||
XEHPTEST_F(XeHPPreambleVfeState, whenProgrammingVfeStateThenDoNotAddPipeControlWaCmd) {
|
||||
LinearStream &cs = linearStream;
|
||||
|
||||
size_t sizeBefore = cs.getUsed();
|
||||
PreambleHelper<FamilyType>::addPipeControlBeforeVfeCmd(&cs, defaultHwInfo.get(), EngineGroupType::RenderCompute);
|
||||
size_t sizeAfter = cs.getUsed();
|
||||
|
||||
EXPECT_EQ(sizeBefore, sizeAfter);
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/command_stream/preemption.h"
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/test/common/cmd_parse/hw_parse.h"
|
||||
#include "shared/test/common/mocks/mock_debugger.h"
|
||||
#include "shared/test/common/mocks/mock_device.h"
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include <array>
|
||||
using namespace NEO;
|
||||
|
||||
using PreemptionXeHPTest = ::testing::Test;
|
||||
|
||||
XEHPTEST_F(PreemptionXeHPTest, givenRevisionA0toBWhenProgrammingSipThenGlobalSipIsSet) {
|
||||
using PIPE_CONTROL = XeHpFamily::PIPE_CONTROL;
|
||||
using MI_LOAD_REGISTER_IMM = XeHpFamily::MI_LOAD_REGISTER_IMM;
|
||||
using STATE_SIP = XeHpFamily::STATE_SIP;
|
||||
HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
|
||||
HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
|
||||
std::array<uint32_t, 2> revisions = {hwHelper.getHwRevIdFromStepping(REVID::REVISION_A0, hwInfo),
|
||||
hwHelper.getHwRevIdFromStepping(REVID::REVISION_B, hwInfo)};
|
||||
|
||||
for (auto revision : revisions) {
|
||||
hwInfo.platform.usRevId = revision;
|
||||
|
||||
std::unique_ptr<MockDevice> mockDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||
mockDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(new MockDebugger);
|
||||
auto sipAllocation = SipKernel::getSipKernel(*mockDevice).getSipAllocation();
|
||||
|
||||
size_t requiredSize = PreemptionHelper::getRequiredStateSipCmdSize<FamilyType>(*mockDevice);
|
||||
StackVec<char, 1024> streamStorage(1024);
|
||||
LinearStream cmdStream{streamStorage.begin(), streamStorage.size()};
|
||||
|
||||
auto expectedGlobalSipWaSize = sizeof(PIPE_CONTROL) + 2 * sizeof(MI_LOAD_REGISTER_IMM);
|
||||
EXPECT_EQ(expectedGlobalSipWaSize, requiredSize);
|
||||
PreemptionHelper::programStateSip<FamilyType>(cmdStream, *mockDevice);
|
||||
EXPECT_NE(0U, cmdStream.getUsed());
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(cmdStream.getCpuBase(), 0), cmdStream.getUsed()));
|
||||
|
||||
auto itorLRI = findMmio<FamilyType>(cmdList.begin(), cmdList.end(), 0xE42C);
|
||||
EXPECT_NE(cmdList.end(), itorLRI);
|
||||
|
||||
auto cmdLRI = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorLRI);
|
||||
auto sipAddress = cmdLRI->getDataDword() & 0xfffffff8;
|
||||
EXPECT_EQ(sipAllocation->getGpuAddressToPatch(), sipAddress);
|
||||
}
|
||||
}
|
||||
|
||||
XEHPTEST_F(PreemptionXeHPTest, givenRevisionA0toBWhenProgrammingSipEndWaThenGlobalSipIsRestored) {
|
||||
using PIPE_CONTROL = XeHpFamily::PIPE_CONTROL;
|
||||
using MI_LOAD_REGISTER_IMM = XeHpFamily::MI_LOAD_REGISTER_IMM;
|
||||
using STATE_SIP = XeHpFamily::STATE_SIP;
|
||||
HardwareInfo hwInfo = *NEO::defaultHwInfo.get();
|
||||
|
||||
HwHelper &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
|
||||
std::array<uint32_t, 2> revisions = {hwHelper.getHwRevIdFromStepping(REVID::REVISION_A0, hwInfo),
|
||||
hwHelper.getHwRevIdFromStepping(REVID::REVISION_B, hwInfo)};
|
||||
|
||||
for (auto revision : revisions) {
|
||||
hwInfo.platform.usRevId = revision;
|
||||
|
||||
std::unique_ptr<MockDevice> mockDevice(NEO::MockDevice::createWithNewExecutionEnvironment<NEO::MockDevice>(&hwInfo, 0));
|
||||
mockDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(new MockDebugger);
|
||||
|
||||
StackVec<char, 1024> streamStorage(1024);
|
||||
LinearStream cmdStream{streamStorage.begin(), streamStorage.size()};
|
||||
|
||||
PreemptionHelper::programStateSipEndWa<FamilyType>(cmdStream, *mockDevice);
|
||||
EXPECT_NE(0U, cmdStream.getUsed());
|
||||
|
||||
GenCmdList cmdList;
|
||||
ASSERT_TRUE(FamilyType::PARSE::parseCommandBuffer(
|
||||
cmdList, ptrOffset(cmdStream.getCpuBase(), 0), cmdStream.getUsed()));
|
||||
|
||||
auto itorPC = find<PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
|
||||
EXPECT_NE(cmdList.end(), itorPC);
|
||||
|
||||
auto itorLRI = findMmio<FamilyType>(itorPC, cmdList.end(), 0xE42C);
|
||||
EXPECT_NE(cmdList.end(), itorLRI);
|
||||
|
||||
auto cmdLRI = genCmdCast<MI_LOAD_REGISTER_IMM *>(*itorLRI);
|
||||
auto sipAddress = cmdLRI->getDataDword() & 0xfffffff8;
|
||||
EXPECT_EQ(0u, sipAddress);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue