fix: make dispatch globals array allocation lockable

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2023-05-15 13:48:46 +00:00
committed by Compute-Runtime-Automation
parent e0d3db3d91
commit 8ada5db581
2 changed files with 15 additions and 1 deletions

View File

@@ -886,7 +886,7 @@ void Device::allocateRTDispatchGlobals(uint32_t maxBvhLevels) {
GraphicsAllocation *dispatchGlobalsArrayAllocation = nullptr;
AllocationProperties arrayAllocProps(getRootDeviceIndex(), true, dispatchGlobalsSize,
AllocationType::BUFFER, true, getDeviceBitfield());
AllocationType::GLOBAL_SURFACE, true, getDeviceBitfield());
arrayAllocProps.flags.resource48Bit = productHelper.is48bResourceNeededForRayTracing();
arrayAllocProps.flags.isUSMDeviceAllocation = true;
dispatchGlobalsArrayAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(arrayAllocProps);

View File

@@ -126,6 +126,20 @@ TEST_F(DeviceTest, whenGetRTDispatchGlobalsIsCalledWithUnsupportedBVHLevelsThenN
EXPECT_EQ(nullptr, pDevice->getRTDispatchGlobals(100));
}
TEST_F(DeviceTest, whenInitializeRayTracingIsCalledWithMockAllocatorThenDispatchGlobalsArrayAllocationIsLockable) {
DebugManagerStateRestore restorer;
DebugManager.flags.ForceLocalMemoryAccessMode.set(0);
auto maxBvhLevel = 3;
pDevice->initializeRayTracing(maxBvhLevel);
for (auto i = 0; i < maxBvhLevel; i++) {
auto rtDispatchGlobals = pDevice->getRTDispatchGlobals(i);
EXPECT_NE(nullptr, rtDispatchGlobals);
auto dispatchGlobalsArray = rtDispatchGlobals->rtDispatchGlobalsArray;
EXPECT_NE(nullptr, dispatchGlobalsArray);
EXPECT_FALSE(dispatchGlobalsArray->getDefaultGmm()->resourceParams.Flags.Info.NotLockable);
}
}
TEST_F(DeviceTest, whenInitializeRayTracingIsCalledWithMockAllocatorThenRTDispatchGlobalsIsAllocated) {
pDevice->initializeRayTracing(5);
EXPECT_NE(nullptr, pDevice->getRTDispatchGlobals(3));