mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 14:55:24 +08:00
Allocate RTDispatchGlobals as array-of-structures.
This fixes several bugs in previous (reverted) implementation. We use correct RTStack pointer offset, and a larger RTStack size. Related-To: LOCI-2966 Signed-off-by: Jim Snow <jim.m.snow@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
04a66d2b61
commit
48ba0554db
@@ -168,12 +168,12 @@ class MockDevice : public RootDevice {
|
||||
for (unsigned int i = 0; i < rtDispatchGlobalsInfos.size(); i++) {
|
||||
auto rtDispatchGlobalsInfo = rtDispatchGlobalsInfos[i];
|
||||
if (rtDispatchGlobalsForceAllocation == true && rtDispatchGlobalsInfo != nullptr) {
|
||||
for (unsigned int j = 0; j < rtDispatchGlobalsInfo->rtDispatchGlobals.size(); j++) {
|
||||
delete rtDispatchGlobalsInfo->rtDispatchGlobals[j];
|
||||
rtDispatchGlobalsInfo->rtDispatchGlobals[j] = nullptr;
|
||||
for (unsigned int j = 0; j < rtDispatchGlobalsInfo->rtStacks.size(); j++) {
|
||||
delete rtDispatchGlobalsInfo->rtStacks[j];
|
||||
rtDispatchGlobalsInfo->rtStacks[j] = nullptr;
|
||||
}
|
||||
delete rtDispatchGlobalsInfo->rtDispatchGlobalsArrayAllocation;
|
||||
rtDispatchGlobalsInfo->rtDispatchGlobalsArrayAllocation = nullptr;
|
||||
delete rtDispatchGlobalsInfo->rtDispatchGlobalsArray;
|
||||
rtDispatchGlobalsInfo->rtDispatchGlobalsArray = nullptr;
|
||||
delete rtDispatchGlobalsInfos[i];
|
||||
rtDispatchGlobalsInfos[i] = nullptr;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,26 @@ TEST_F(DeviceTest, whenAllocateRTDispatchGlobalsIsCalledThenRTDispatchGlobalsIsA
|
||||
EXPECT_NE(nullptr, pDevice->getRTDispatchGlobals(3));
|
||||
}
|
||||
|
||||
HWTEST2_F(DeviceTest, whenAllocateRTDispatchGlobalsIsCalledAndRTStackAllocationFailsRTDispatchGlobalsIsNotAllocated, IsPVC) {
|
||||
DebugManagerStateRestore dbgRestorer;
|
||||
|
||||
DebugManager.flags.CreateMultipleSubDevices.set(2);
|
||||
pDevice->deviceBitfield = 3;
|
||||
|
||||
pDevice->subdevices.push_back(new SubDevice(pDevice->executionEnvironment, 0, *pDevice));
|
||||
pDevice->subdevices.push_back(new SubDevice(pDevice->executionEnvironment, 1, *pDevice));
|
||||
|
||||
std::unique_ptr<NEO::MemoryManager> otherMemoryManager;
|
||||
otherMemoryManager = std::make_unique<NEO::MockMemoryManagerWithCapacity>(*pDevice->executionEnvironment);
|
||||
static_cast<NEO::MockMemoryManagerWithCapacity &>(*otherMemoryManager).capacity = 50000000;
|
||||
pDevice->executionEnvironment->memoryManager.swap(otherMemoryManager);
|
||||
|
||||
pDevice->initializeRayTracing(5);
|
||||
EXPECT_EQ(nullptr, pDevice->getRTDispatchGlobals(3));
|
||||
|
||||
pDevice->executionEnvironment->memoryManager.swap(otherMemoryManager);
|
||||
}
|
||||
|
||||
TEST_F(DeviceTest, givenDispatchGlobalsAllocationFailsThenRTDispatchGlobalsInfoIsNull) {
|
||||
std::unique_ptr<NEO::MemoryManager> otherMemoryManager;
|
||||
otherMemoryManager = std::make_unique<NEO::FailMemoryManager>(1, *pDevice->getExecutionEnvironment());
|
||||
@@ -624,4 +644,4 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DeviceTests, givenNonDebuggableOsContextWhenDeviceC
|
||||
auto device = deviceFactory.rootDevices[0];
|
||||
auto csr = device->allEngines[device->defaultEngineIndex].commandStreamReceiver;
|
||||
EXPECT_EQ(0u, csr->peekLatestSentTaskCount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,17 +29,16 @@ TEST(RayTracingHelperTests, whenMemoryBackedFifoSizeIsRequestedThenCorrectValueI
|
||||
EXPECT_EQ(expectedSize, size);
|
||||
}
|
||||
|
||||
TEST(RayTracingHelperTests, whenGlobalDispatchSizeIsRequestedThenCorrectValueIsReturned) {
|
||||
TEST(RayTracingHelperTests, whenRTStackSizeIsRequestedThenCorrectValueIsReturned) {
|
||||
MockDevice device;
|
||||
|
||||
uint32_t maxBvhLevel = 2;
|
||||
uint32_t extraBytesLocal = 20;
|
||||
uint32_t extraBytesGlobal = 100;
|
||||
uint32_t tiles = 2;
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user