feature: add calculation of stack count for sync RT

Related-To: NEO-10830

Signed-off-by: Alicja Lukaszewicz <alicja.lukaszewicz@intel.com>
This commit is contained in:
Alicja Lukaszewicz
2024-11-18 13:24:30 +00:00
committed by Compute-Runtime-Automation
parent ee9af40a27
commit 68dc7fb33b
18 changed files with 99 additions and 17 deletions

View File

@@ -8,6 +8,7 @@
#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/mocks/mock_release_helper.h"
#include "shared/test/common/test_macros/test.h"
using namespace NEO;
@@ -39,24 +40,16 @@ TEST(RayTracingHelperTests, whenRTStackSizeIsRequestedThenCorrectValueIsReturned
uint32_t extraBytesGlobal = 100;
uint32_t tiles = 2;
size_t expectedSize = alignUp(RayTracingHelper::getStackSizePerRay(maxBvhLevel, extraBytesLocal) * RayTracingHelper::getNumRtStacks(device.getHardwareInfo()) + extraBytesGlobal, MemoryConstants::cacheLineSize);
size_t expectedSize = alignUp(RayTracingHelper::getStackSizePerRay(maxBvhLevel, extraBytesLocal) * RayTracingHelper::getNumRtStacks(device) + extraBytesGlobal, MemoryConstants::cacheLineSize);
size_t size = RayTracingHelper::getRTStackSizePerTile(device, tiles, maxBvhLevel, extraBytesLocal, extraBytesGlobal);
EXPECT_EQ(expectedSize, size);
}
TEST(RayTracingHelperTests, whenNumRtStacksPerDssIsRequestedThenCorrectValueIsReturned) {
MockDevice device;
uint32_t numDssRtStacks = RayTracingHelper::getNumRtStacksPerDss(device.getHardwareInfo());
uint32_t expectedValue = device.getHardwareInfo().capabilityTable.syncNumRTStacksPerDSS;
EXPECT_EQ(expectedValue, numDssRtStacks);
}
TEST(RayTracingHelperTests, whenNumRtStacksIsQueriedThenItIsEqualToNumRtStacksPerDssMultipliedByDualSubsliceCount) {
MockDevice device;
uint32_t numDssRtStacksPerDss = RayTracingHelper::getNumRtStacksPerDss(device.getHardwareInfo());
uint32_t numDssRtStacks = RayTracingHelper::getNumRtStacks(device.getHardwareInfo());
uint32_t numDssRtStacksPerDss = RayTracingHelper::getNumRtStacksPerDss(device);
uint32_t numDssRtStacks = RayTracingHelper::getNumRtStacks(device);
uint32_t subsliceCount = GfxCoreHelper::getHighestEnabledDualSubSlice(device.getHardwareInfo());
EXPECT_LT(0u, numDssRtStacks);
@@ -77,3 +70,54 @@ TEST(RayTracingHelperTests, whenStackSizePerRayIsRequestedThenCorrectValueIsRetu
TEST(RayTracingHelperTests, whenGetMemoryBackedFifoSizeToPatchIsCalledThenCorrectValueIsReturned) {
EXPECT_EQ(2u, RayTracingHelper::getMemoryBackedFifoSizeToPatch());
}
TEST(RayTracingHelperTests, whenNumRtStacksPerDssIsRequestedAndFixedValueIsTrueThenCorrectValueIsReturned) {
MockReleaseHelper mockReleaseHelper;
MockDevice mockDevice;
mockReleaseHelper.isNumRtStacksPerDssFixedValueResult = true;
mockDevice.mockReleaseHelper = &mockReleaseHelper;
uint32_t fixedSizeOfRtStacksPerDss = 2048;
uint32_t result = RayTracingHelper::getNumRtStacksPerDss(mockDevice);
EXPECT_EQ(fixedSizeOfRtStacksPerDss, result);
}
TEST(RayTracingHelperTests, whenNumRtStacksPerDssIsRequestedAndFixedValueIsFalseThenCorrectValueIsReturned) {
MockReleaseHelper mockReleaseHelper;
mockReleaseHelper.isNumRtStacksPerDssFixedValueResult = false;
uint32_t maxEuPerSubSlice = 16;
uint32_t threadCount = 672;
uint32_t euCount = 96;
auto hwInfo = *NEO::defaultHwInfo;
hwInfo.gtSystemInfo.MaxEuPerSubSlice = maxEuPerSubSlice;
hwInfo.gtSystemInfo.ThreadCount = threadCount;
hwInfo.gtSystemInfo.EUCount = euCount;
std::unique_ptr<MockDevice> mockDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
mockDevice->mockReleaseHelper = &mockReleaseHelper;
// maxEuPerSubSlice * (threadCount / euCount) * CommonConstants::maximalSimdSize = 3584u
constexpr uint32_t expectedValue = 3584;
EXPECT_EQ(expectedValue, RayTracingHelper::getNumRtStacksPerDss(*mockDevice));
}
TEST(RayTracingHelperTests, whenNumRtStacksPerDssExceedsMaxThenReturnsMaxRtStacksPerDssSupported) {
MockReleaseHelper mockReleaseHelper;
mockReleaseHelper.isNumRtStacksPerDssFixedValueResult = false;
auto hwInfo = *NEO::defaultHwInfo;
hwInfo.gtSystemInfo.MaxEuPerSubSlice = 512;
hwInfo.gtSystemInfo.ThreadCount = 2048;
hwInfo.gtSystemInfo.EUCount = 256;
std::unique_ptr<MockDevice> mockDevice(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo, 0));
mockDevice->mockReleaseHelper = &mockReleaseHelper;
uint32_t maxSizeOfRtStacksPerDss = 4096;
uint32_t result = RayTracingHelper::getNumRtStacksPerDss(*mockDevice);
EXPECT_EQ(maxSizeOfRtStacksPerDss, result);
}