fix: program 8 maxBVHLevels as 0 - special case

Related-To: NEO-14423

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk 2025-05-23 14:35:04 +00:00 committed by Compute-Runtime-Automation
parent 3dc32cec88
commit d247358fdf
2 changed files with 15 additions and 0 deletions

View File

@ -1166,6 +1166,12 @@ void Device::allocateRTDispatchGlobals(uint32_t maxBvhLevels) {
auto rtStacksPerDss = RayTracingHelper::getNumRtStacksPerDss(*this);
dispatchGlobals.numDSSRTStacks = rtStacksPerDss;
dispatchGlobals.maxBVHLevels = maxBvhLevels;
constexpr auto maxProgrammableBvhLevels = 7;
if (maxBvhLevels > maxProgrammableBvhLevels) {
dispatchGlobals.maxBVHLevels = 0; // 0 = special case: use 8 levels
}
uint32_t *dispatchGlobalsAsArray = reinterpret_cast<uint32_t *>(&dispatchGlobals);
dispatchGlobalsAsArray[7] = 1;

View File

@ -263,6 +263,15 @@ TEST_F(DeviceTest, whenAllocateRTDispatchGlobalsIsCalledThenStackSizePerRayIsSet
}
}
TEST_F(DeviceTest, given8MaxBvhLevelsWhenAllocateRTDispatchGlobalsIsCalledThenMaxBvhLevelsIsSetCorrectly) {
uint32_t maxBvhLevels = 8u;
pDevice->initializeRayTracing(maxBvhLevels);
pDevice->allocateRTDispatchGlobals(maxBvhLevels);
EXPECT_NE(nullptr, pDevice->getRTDispatchGlobals(maxBvhLevels));
RTDispatchGlobals dispatchGlobals = *reinterpret_cast<struct RTDispatchGlobals *>(pDevice->getRTDispatchGlobals(maxBvhLevels)->rtDispatchGlobalsArray->getUnderlyingBuffer());
EXPECT_EQ(0u, static_cast<uint32_t>(dispatchGlobals.maxBVHLevels));
}
TEST_F(DeviceTest, givenNot48bResourceForRtWhenAllocateRTDispatchGlobalsIsCalledThenRTDispatchGlobalsIsAllocatedWithout48bResourceFlag) {
auto mockProductHelper = std::make_unique<MockProductHelper>();
mockProductHelper->is48bResourceNeededForRayTracingResult = false;