Move helpers tests to shared

ray tracing tests
engine node helper xehp and later tests
hw helper tests

move shared ult from command queue to helpers

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-11-07 14:46:13 +00:00
committed by Compute-Runtime-Automation
parent 5b11a4a5fa
commit 04a66d2b61
9 changed files with 19 additions and 33 deletions

View File

@@ -1,11 +0,0 @@
#
# Copyright (C) 2021-2022 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
target_sources(neo_shared_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/flattened_id_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_id_tests.cpp
)

View File

@@ -22,17 +22,22 @@ target_sources(neo_shared_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/engine_node_helper_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/extendable_enum_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/file_io_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/flattened_id_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/flush_stamp_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/get_gpgpu_engines_tests.inl
${CMAKE_CURRENT_SOURCE_DIR}/get_info_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hash_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/heap_assigner_shared_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel_helpers_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_default_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_dg2_or_below.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_id_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/l3_range_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel_helpers_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/matcher_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/memory_management_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/product_config_helper_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ptr_math_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/ray_tracing_helper_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/state_base_address_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/string_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/string_to_hash_tests.cpp
@@ -40,7 +45,6 @@ target_sources(neo_shared_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config.cpp
${CMAKE_CURRENT_SOURCE_DIR}/cache_policy_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/timestamp_packet_tests.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hw_helper_tests_dg2_or_below.cpp
)
if(MSVC OR COMPILER_SUPPORTS_SSE42)
@@ -52,7 +56,11 @@ if(COMPILER_SUPPORTS_NEON)
endif()
if(TESTS_XEHP_AND_LATER)
target_sources(neo_shared_tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/test_blit_commands_helper_xehp_and_later.cpp)
target_sources(neo_shared_tests PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/aub_helper_hw_tests_xehp_and_later.cpp
${CMAKE_CURRENT_SOURCE_DIR}/engine_node_helper_tests_xehp_and_later.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_blit_commands_helper_xehp_and_later.cpp
)
endif()
if(TESTS_DG2_AND_LATER)
@@ -67,4 +75,4 @@ if(TESTS_PVC_AND_LATER)
)
endif()
add_subdirectories()
add_subdirectories()

View File

@@ -0,0 +1,31 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/aub/aub_helper.h"
#include "shared/source/aub_mem_dump/aub_mem_dump.h"
#include "shared/test/common/test_macros/hw_test.h"
using namespace NEO;
using AubHelperHwTestXeHPAndLater = ::testing::Test;
HWCMDTEST_F(IGFX_XE_HP_CORE, AubHelperHwTestXeHPAndLater, givenAubHelperWhenGetDataHintForPml4EntryIsCalledThenTracePpgttLevel4IsReturned) {
AubHelperHw<FamilyType> aubHelper(true);
EXPECT_EQ(AubMemDump::DataTypeHintValues::TracePpgttLevel4, aubHelper.getDataHintForPml4Entry());
}
HWCMDTEST_F(IGFX_XE_HP_CORE, AubHelperHwTestXeHPAndLater, givenAubHelperWhenGetDataHintForPml4EntryIsCalledThenTracePpgttLevel3IsReturned) {
AubHelperHw<FamilyType> aubHelper(true);
EXPECT_EQ(AubMemDump::DataTypeHintValues::TracePpgttLevel3, aubHelper.getDataHintForPdpEntry());
}
HWCMDTEST_F(IGFX_XE_HP_CORE, AubHelperHwTestXeHPAndLater, givenAubHelperWhenGetDataHintForPml4EntryIsCalledThenTracePpgttLevel2IsReturned) {
AubHelperHw<FamilyType> aubHelper(true);
EXPECT_EQ(AubMemDump::DataTypeHintValues::TracePpgttLevel2, aubHelper.getDataHintForPdEntry());
}
HWCMDTEST_F(IGFX_XE_HP_CORE, AubHelperHwTestXeHPAndLater, givenAubHelperWhenGetDataHintForPml4EntryIsCalledThenTracePpgttLevel1IsReturned) {
AubHelperHw<FamilyType> aubHelper(true);
EXPECT_EQ(AubMemDump::DataTypeHintValues::TracePpgttLevel1, aubHelper.getDataHintForPtEntry());
}

View File

@@ -0,0 +1,248 @@
/*
* Copyright (C) 2021-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/engine_node_helper.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/test_macros/hw_test.h"
using namespace NEO;
using EngineNodeHelperTestsXeHPAndLater = ::Test<DeviceFixture>;
HWCMDTEST_F(IGFX_XE_HP_CORE, EngineNodeHelperTestsXeHPAndLater, WhenGetBcsEngineTypeIsCalledThenBcsEngineIsReturned) {
const auto hwInfo = pDevice->getHardwareInfo();
auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine();
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS, EngineHelpers::getBcsEngineType(hwInfo, {}, selectorCopyEngine, false));
}
HWTEST2_F(EngineNodeHelperTestsXeHPAndLater, givenDebugVariableSetWhenAskingForEngineTypeThenReturnTheSameAsVariableIndex, IsAtLeastXeHpCore) {
DebugManagerStateRestore restore;
DeviceBitfield deviceBitfield = 0b11;
const auto hwInfo = pDevice->getHardwareInfo();
auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine();
for (int32_t i = 0; i <= 9; i++) {
DebugManager.flags.ForceBcsEngineIndex.set(i);
if (i == 0) {
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS, EngineHelpers::getBcsEngineType(hwInfo, deviceBitfield, selectorCopyEngine, false));
} else if (i <= 8) {
EXPECT_EQ(static_cast<aub_stream::EngineType>(aub_stream::EngineType::ENGINE_BCS1 + i - 1), EngineHelpers::getBcsEngineType(hwInfo, deviceBitfield, selectorCopyEngine, false));
} else {
EXPECT_ANY_THROW(EngineHelpers::getBcsEngineType(hwInfo, deviceBitfield, selectorCopyEngine, false));
}
}
}
HWTEST2_F(EngineNodeHelperTestsXeHPAndLater, givenForceBCSForInternalCopyEngineWhenGetBcsEngineTypeForInternalEngineThenForcedTypeIsReturned, IsAtLeastXeHpCore) {
DebugManagerStateRestore restore;
DebugManager.flags.ForceBCSForInternalCopyEngine.set(0u);
auto hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo.featureTable.ftrBcsInfo = 0xff;
auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine();
DeviceBitfield deviceBitfield = 0xff;
{
DebugManager.flags.ForceBCSForInternalCopyEngine.set(0u);
auto engineType = EngineHelpers::getBcsEngineType(hwInfo, deviceBitfield, selectorCopyEngine, true);
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS, engineType);
}
{
DebugManager.flags.ForceBCSForInternalCopyEngine.set(3u);
auto engineType = EngineHelpers::getBcsEngineType(hwInfo, deviceBitfield, selectorCopyEngine, true);
EXPECT_EQ(aub_stream::EngineType::ENGINE_BCS3, engineType);
}
}
HWTEST2_F(EngineNodeHelperTestsXeHPAndLater, givenEnableCmdQRoundRobindBcsEngineAssignWhenSelectLinkCopyEngineThenRoundRobinOverAllAvailableLinkedCopyEngines, IsAtLeastXeHpCore) {
DebugManagerStateRestore restore;
DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssign.set(1u);
DeviceBitfield deviceBitfield = 0b10;
auto hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo.featureTable.ftrBcsInfo.set(7);
auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine();
int32_t expectedEngineType = aub_stream::EngineType::ENGINE_BCS1;
for (int32_t i = 0; i <= 20; i++) {
while (!HwHelper::get(hwInfo.platform.eRenderCoreFamily).isSubDeviceEngineSupported(hwInfo, deviceBitfield, static_cast<aub_stream::EngineType>(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) {
expectedEngineType++;
if (static_cast<aub_stream::EngineType>(expectedEngineType) > aub_stream::EngineType::ENGINE_BCS8) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS1;
}
}
auto engineType = EngineHelpers::selectLinkCopyEngine(hwInfo, deviceBitfield, selectorCopyEngine.selector);
EXPECT_EQ(engineType, static_cast<aub_stream::EngineType>(expectedEngineType));
expectedEngineType++;
if (static_cast<aub_stream::EngineType>(expectedEngineType) > aub_stream::EngineType::ENGINE_BCS8) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS1;
}
}
}
HWTEST2_F(EngineNodeHelperTestsXeHPAndLater, givenEnableCmdQRoundRobindBcsEngineAssignAndMainCopyEngineIncludedWhenSelectLinkCopyEngineThenRoundRobinOverAllAvailableLinkedCopyEnginesAndMainCopyEngine, IsAtLeastXeHpCore) {
DebugManagerStateRestore restore;
DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssign.set(1u);
DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssignStartingValue.set(0);
DeviceBitfield deviceBitfield = 0b10;
auto hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo.featureTable.ftrBcsInfo = 0x17f;
auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine();
int32_t expectedEngineType = aub_stream::EngineType::ENGINE_BCS;
for (int32_t i = 0; i <= 20; i++) {
while (!HwHelper::get(hwInfo.platform.eRenderCoreFamily).isSubDeviceEngineSupported(hwInfo, deviceBitfield, static_cast<aub_stream::EngineType>(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType == aub_stream::EngineType::ENGINE_BCS
? 0
: expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) {
if (expectedEngineType == aub_stream::EngineType::ENGINE_BCS) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS1;
} else {
expectedEngineType++;
}
if (static_cast<aub_stream::EngineType>(expectedEngineType) > aub_stream::EngineType::ENGINE_BCS8) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS;
}
}
auto engineType = EngineHelpers::selectLinkCopyEngine(hwInfo, deviceBitfield, selectorCopyEngine.selector);
EXPECT_EQ(engineType, static_cast<aub_stream::EngineType>(expectedEngineType));
if (expectedEngineType == aub_stream::EngineType::ENGINE_BCS) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS1;
} else {
expectedEngineType++;
}
if (static_cast<aub_stream::EngineType>(expectedEngineType) > aub_stream::EngineType::ENGINE_BCS8) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS;
}
}
}
HWTEST2_F(EngineNodeHelperTestsXeHPAndLater, givenEnableCmdQRoundRobindBcsEngineAssignAndMainCopyEngineIncludedAndLimitSetWhenSelectLinkCopyEngineThenRoundRobinOverAllAvailableLinkedCopyEnginesAndMainCopyEngine, IsAtLeastXeHpCore) {
DebugManagerStateRestore restore;
DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssign.set(1u);
DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssignStartingValue.set(0);
DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssignLimit.set(6);
DeviceBitfield deviceBitfield = 0b10;
auto hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo.featureTable.ftrBcsInfo = 0x17f;
auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine();
int32_t expectedEngineType = aub_stream::EngineType::ENGINE_BCS;
for (int32_t i = 0; i <= 20; i++) {
while (!HwHelper::get(hwInfo.platform.eRenderCoreFamily).isSubDeviceEngineSupported(hwInfo, deviceBitfield, static_cast<aub_stream::EngineType>(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType == aub_stream::EngineType::ENGINE_BCS
? 0
: expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) {
if (expectedEngineType == aub_stream::EngineType::ENGINE_BCS) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS1;
} else {
expectedEngineType++;
}
if (static_cast<aub_stream::EngineType>(expectedEngineType) > aub_stream::EngineType::ENGINE_BCS5) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS;
}
}
auto engineType = EngineHelpers::selectLinkCopyEngine(hwInfo, deviceBitfield, selectorCopyEngine.selector);
EXPECT_EQ(engineType, static_cast<aub_stream::EngineType>(expectedEngineType));
if (expectedEngineType == aub_stream::EngineType::ENGINE_BCS) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS1;
} else {
expectedEngineType++;
}
if (static_cast<aub_stream::EngineType>(expectedEngineType) > aub_stream::EngineType::ENGINE_BCS5) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS;
}
}
}
HWTEST2_F(EngineNodeHelperTestsXeHPAndLater, givenEnableCmdQRoundRobindBcsEngineAssignAndLimitSetWhenSelectLinkCopyEngineThenRoundRobinOverAllAvailableLinkedCopyEnginesAndMainCopyEngine, IsAtLeastXeHpCore) {
DebugManagerStateRestore restore;
DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssign.set(1u);
DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssignLimit.set(6);
DeviceBitfield deviceBitfield = 0b10;
auto hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo.featureTable.ftrBcsInfo = 0x17f;
auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine();
int32_t expectedEngineType = aub_stream::EngineType::ENGINE_BCS1;
for (int32_t i = 0; i <= 20; i++) {
while (!HwHelper::get(hwInfo.platform.eRenderCoreFamily).isSubDeviceEngineSupported(hwInfo, deviceBitfield, static_cast<aub_stream::EngineType>(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType == aub_stream::EngineType::ENGINE_BCS
? 0
: expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) {
if (expectedEngineType == aub_stream::EngineType::ENGINE_BCS) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS1;
} else {
expectedEngineType++;
}
if (static_cast<aub_stream::EngineType>(expectedEngineType) > aub_stream::EngineType::ENGINE_BCS6) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS1;
}
}
auto engineType = EngineHelpers::selectLinkCopyEngine(hwInfo, deviceBitfield, selectorCopyEngine.selector);
EXPECT_EQ(engineType, static_cast<aub_stream::EngineType>(expectedEngineType));
if (expectedEngineType == aub_stream::EngineType::ENGINE_BCS) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS1;
} else {
expectedEngineType++;
}
if (static_cast<aub_stream::EngineType>(expectedEngineType) > aub_stream::EngineType::ENGINE_BCS6) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS1;
}
}
}
HWTEST2_F(EngineNodeHelperTestsXeHPAndLater, givenEnableCmdQRoundRobindBcsEngineAssignAndStartOffsetIncludedWhenSelectLinkCopyEngineThenRoundRobinOverAllAvailableLinkedCopyEngines, IsAtLeastXeHpCore) {
DebugManagerStateRestore restore;
DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssign.set(1u);
DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssignStartingValue.set(2);
DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssignLimit.set(5);
DeviceBitfield deviceBitfield = 0b10;
auto hwInfo = *pDevice->getRootDeviceEnvironment().getMutableHardwareInfo();
hwInfo.featureTable.ftrBcsInfo = 0x17f;
auto &selectorCopyEngine = pDevice->getNearestGenericSubDevice(0)->getSelectorCopyEngine();
int32_t expectedEngineType = aub_stream::EngineType::ENGINE_BCS3;
for (int32_t i = 0; i <= 20; i++) {
while (!HwHelper::get(hwInfo.platform.eRenderCoreFamily).isSubDeviceEngineSupported(hwInfo, deviceBitfield, static_cast<aub_stream::EngineType>(expectedEngineType)) || !hwInfo.featureTable.ftrBcsInfo.test(expectedEngineType == aub_stream::EngineType::ENGINE_BCS
? 0
: expectedEngineType - aub_stream::EngineType::ENGINE_BCS1 + 1)) {
if (expectedEngineType == aub_stream::EngineType::ENGINE_BCS) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS1;
} else {
expectedEngineType++;
}
if (static_cast<aub_stream::EngineType>(expectedEngineType) > aub_stream::EngineType::ENGINE_BCS7) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS3;
}
}
auto engineType = EngineHelpers::selectLinkCopyEngine(hwInfo, deviceBitfield, selectorCopyEngine.selector);
EXPECT_EQ(engineType, static_cast<aub_stream::EngineType>(expectedEngineType));
if (expectedEngineType == aub_stream::EngineType::ENGINE_BCS) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS1;
} else {
expectedEngineType++;
}
if (static_cast<aub_stream::EngineType>(expectedEngineType) > aub_stream::EngineType::ENGINE_BCS7) {
expectedEngineType = aub_stream::EngineType::ENGINE_BCS3;
}
}
}

View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/hw_info.h"
#include "shared/test/common/helpers/hw_helper_tests.h"
#include "shared/test/common/test_macros/hw_test.h"
HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, givenHwHelperWhenAskedForHvAlign4RequiredThenReturnTrue) {
auto &hwHelper = HwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily);
EXPECT_TRUE(hwHelper.hvAlign4Required());
}
HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, givenHwHelperWhenGettingBindlessSurfaceExtendedMessageDescriptorValueThenCorrectValueIsReturned) {
auto &hwHelper = HwHelper::get(pDevice->getHardwareInfo().platform.eRenderCoreFamily);
auto value = hwHelper.getBindlessSurfaceExtendedMessageDescriptorValue(0x200);
typename FamilyType::DataPortBindlessSurfaceExtendedMessageDescriptor messageExtDescriptor = {};
messageExtDescriptor.setBindlessSurfaceOffset(0x200);
EXPECT_EQ(messageExtDescriptor.getBindlessSurfaceOffsetToPatch(), value);
EXPECT_EQ(0x200u << 6, value);
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright (C) 2020-2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/ray_tracing_helper.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
TEST(RayTracingHelperTests, whenGetMemoryBackedFifoSizeToPatchIsCalledCorrectValueIsReturned) {
size_t fifoSize = RayTracingHelper::getMemoryBackedFifoSizeToPatch();
size_t expectedSize =
RayTracingHelper::memoryBackedFifoSizePerDss == 0
? 0
: Math::log2(RayTracingHelper::memoryBackedFifoSizePerDss / KB) - 1;
EXPECT_EQ(expectedSize, fifoSize);
}
TEST(RayTracingHelperTests, whenMemoryBackedFifoSizeIsRequestedThenCorrectValueIsReturned) {
MockDevice device;
size_t size = RayTracingHelper::getTotalMemoryBackedFifoSize(device);
size_t expectedSize = device.getHardwareInfo().gtSystemInfo.MaxDualSubSlicesSupported * RayTracingHelper::memoryBackedFifoSizePerDss;
EXPECT_EQ(expectedSize, size);
}
TEST(RayTracingHelperTests, whenGlobalDispatchSizeIsRequestedThenCorrectValueIsReturned) {
MockDevice device;
uint32_t maxBvhLevel = 2;
uint32_t extraBytesLocal = 20;
uint32_t extraBytesGlobal = 100;
size_t expectedSize = alignUp(sizeof(RTDispatchGlobals), MemoryConstants::cacheLineSize) +
(RayTracingHelper::hitInfoSize + RayTracingHelper::bvhStackSize * maxBvhLevel + extraBytesLocal) * RayTracingHelper::getNumRtStacks(device) +
extraBytesGlobal;
size_t size = RayTracingHelper::getDispatchGlobalSize(device, maxBvhLevel, extraBytesLocal, extraBytesGlobal);
EXPECT_EQ(expectedSize, size);
}
TEST(RayTracingHelperTests, whenNumRtStacksPerDssIsRequestedThenCorrectValueIsReturned) {
MockDevice device;
uint32_t numDssRtStacks = RayTracingHelper::getNumRtStacksPerDss(device);
uint32_t expectedValue = device.getHardwareInfo().gtSystemInfo.MaxDualSubSlicesSupported
? static_cast<uint32_t>(RayTracingHelper::getNumRtStacks(device) / device.getHardwareInfo().gtSystemInfo.MaxDualSubSlicesSupported + 0.5)
: RayTracingHelper::stackDssMultiplier;
EXPECT_EQ(expectedValue, numDssRtStacks);
}
TEST(RayTracingHelperTests, whenNumRtStacksIsQueriedThenItIsEqualToNumRtStacksPerDssMultipliedByDualSubsliceCount) {
MockDevice device;
uint32_t numDssRtStacksPerDss = RayTracingHelper::getNumRtStacksPerDss(device);
uint32_t numDssRtStacks = RayTracingHelper::getNumRtStacks(device);
uint32_t subsliceCount = device.getHardwareInfo().gtSystemInfo.MaxDualSubSlicesSupported;
EXPECT_EQ(numDssRtStacks, numDssRtStacksPerDss * subsliceCount);
}
TEST(RayTracingHelperTests, whenNumDssIsRequestedThenCorrectValueIsReturned) {
MockDevice device;
EXPECT_EQ(device.getHardwareInfo().gtSystemInfo.MaxDualSubSlicesSupported, RayTracingHelper::getNumDss(device));
}
TEST(RayTracingHelperTests, whenStackSizePerRayIsRequestedThenCorrectValueIsReturned) {
EXPECT_EQ(RayTracingHelper::hitInfoSize, RayTracingHelper::getStackSizePerRay(0, 0));
uint32_t maxBvhLevel = 1234;
uint32_t extraBytesLocal = 5678;
uint32_t expectedValue = RayTracingHelper::hitInfoSize + RayTracingHelper::bvhStackSize * maxBvhLevel + extraBytesLocal;
EXPECT_EQ(RayTracingHelper::getStackSizePerRay(maxBvhLevel, extraBytesLocal), expectedValue);
}
TEST(RayTracingHelperTests, whenGetMemoryBackedFifoSizeToPatchIsCalledThenCorrectValueIsReturned) {
EXPECT_EQ(2u, RayTracingHelper::getMemoryBackedFifoSizeToPatch());
}