Skip to content

Commit 8ada5db

Browse files
fix: make dispatch globals array allocation lockable
Signed-off-by: Mateusz Jablonski <[email protected]>
1 parent e0d3db3 commit 8ada5db

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

shared/source/device/device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ void Device::allocateRTDispatchGlobals(uint32_t maxBvhLevels) {
886886
GraphicsAllocation *dispatchGlobalsArrayAllocation = nullptr;
887887

888888
AllocationProperties arrayAllocProps(getRootDeviceIndex(), true, dispatchGlobalsSize,
889-
AllocationType::BUFFER, true, getDeviceBitfield());
889+
AllocationType::GLOBAL_SURFACE, true, getDeviceBitfield());
890890
arrayAllocProps.flags.resource48Bit = productHelper.is48bResourceNeededForRayTracing();
891891
arrayAllocProps.flags.isUSMDeviceAllocation = true;
892892
dispatchGlobalsArrayAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(arrayAllocProps);

shared/test/unit_test/device/neo_device_tests.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,20 @@ TEST_F(DeviceTest, whenGetRTDispatchGlobalsIsCalledWithUnsupportedBVHLevelsThenN
126126
EXPECT_EQ(nullptr, pDevice->getRTDispatchGlobals(100));
127127
}
128128

129+
TEST_F(DeviceTest, whenInitializeRayTracingIsCalledWithMockAllocatorThenDispatchGlobalsArrayAllocationIsLockable) {
130+
DebugManagerStateRestore restorer;
131+
DebugManager.flags.ForceLocalMemoryAccessMode.set(0);
132+
auto maxBvhLevel = 3;
133+
pDevice->initializeRayTracing(maxBvhLevel);
134+
for (auto i = 0; i < maxBvhLevel; i++) {
135+
auto rtDispatchGlobals = pDevice->getRTDispatchGlobals(i);
136+
EXPECT_NE(nullptr, rtDispatchGlobals);
137+
auto dispatchGlobalsArray = rtDispatchGlobals->rtDispatchGlobalsArray;
138+
EXPECT_NE(nullptr, dispatchGlobalsArray);
139+
EXPECT_FALSE(dispatchGlobalsArray->getDefaultGmm()->resourceParams.Flags.Info.NotLockable);
140+
}
141+
}
142+
129143
TEST_F(DeviceTest, whenInitializeRayTracingIsCalledWithMockAllocatorThenRTDispatchGlobalsIsAllocated) {
130144
pDevice->initializeRayTracing(5);
131145
EXPECT_NE(nullptr, pDevice->getRTDispatchGlobals(3));

0 commit comments

Comments
 (0)