Revert "Allocate RTDispatchGlobals as unboxed array"

This reverts commit eaa4965ae8.

Signed-off-by: Jim Snow <jim.m.snow@intel.com>
This commit is contained in:
Jim Snow
2022-10-22 04:28:30 +00:00
committed by Compute-Runtime-Automation
parent d653779098
commit f976c7a313
8 changed files with 68 additions and 94 deletions

View File

@@ -905,7 +905,7 @@ ze_result_t KernelImp::initialize(const ze_kernel_desc_t *desc) {
uint32_t bvhLevels = NEO::RayTracingHelper::maxBvhLevels;
auto arg = this->getImmutableData()->getDescriptor().payloadMappings.implicitArgs.rtDispatchGlobals;
if (arg.pointerSize == 0) {
// application is allocating its own RTDispatchGlobals manually
// kernel is allocating its own RTDispatchGlobals manually
neoDevice->initializeRayTracing(0);
} else {
neoDevice->initializeRayTracing(bvhLevels);
@@ -914,18 +914,17 @@ ze_result_t KernelImp::initialize(const ze_kernel_desc_t *desc) {
return ZE_RESULT_ERROR_OUT_OF_HOST_MEMORY;
}
for (auto rtStack : rtDispatchGlobalsInfo->rtStacks) {
this->residencyContainer.push_back(rtStack);
for (auto rtDispatchGlobals : rtDispatchGlobalsInfo->rtDispatchGlobals) {
this->residencyContainer.push_back(rtDispatchGlobals);
}
auto address = rtDispatchGlobalsInfo->rtDispatchGlobalsArray->getGpuAddressToPatch();
auto address = rtDispatchGlobalsInfo->rtDispatchGlobals[0]->getGpuAddressToPatch();
NEO::patchPointer(ArrayRef<uint8_t>(crossThreadData.get(), crossThreadDataSize),
arg,
static_cast<uintptr_t>(address));
this->residencyContainer.push_back(rtDispatchGlobalsInfo->rtDispatchGlobalsArray);
this->residencyContainer.push_back(neoDevice->getRTMemoryBackedBuffer());
}
this->residencyContainer.push_back(neoDevice->getRTMemoryBackedBuffer());
}
return ZE_RESULT_SUCCESS;

View File

@@ -897,7 +897,7 @@ HWTEST2_F(KernelImmutableDataTests, whenHasRTCallsIsTrueAndNoRTDispatchGlobalsIs
neoDevice->executionEnvironment->memoryManager.swap(otherMemoryManager);
}
HWTEST2_F(KernelImmutableDataTests, whenHasRTCallsIsTrueAndRTStackAllocationFailsThenRayTracingIsNotInitialized, IsAtLeastXeHpgCore) {
HWTEST2_F(KernelImmutableDataTests, whenHasRTCallsIsTrueAndRTDispatchGlobalsArrayAllocationFailsThenRayTracingIsNotInitialized, IsAtLeastXeHpgCore) {
KernelDescriptor mockDescriptor = {};
mockDescriptor.kernelAttributes.flags.hasRTCalls = true;
mockDescriptor.kernelMetadata.kernelName = "rt_test";
@@ -931,7 +931,7 @@ HWTEST2_F(KernelImmutableDataTests, whenHasRTCallsIsTrueAndRTStackAllocationFail
neoDevice->rtDispatchGlobalsForceAllocation = false;
std::unique_ptr<NEO::MemoryManager> otherMemoryManager;
// Ensure that allocating RTDispatchGlobals succeeds, but first RTStack allocation fails.
// Ensure that allocating RTDispatchGlobals succeeds, but the array allocation fails.
otherMemoryManager = std::make_unique<NEO::FailMemoryManager>(1, *neoDevice->executionEnvironment);
neoDevice->executionEnvironment->memoryManager.swap(otherMemoryManager);
@@ -1059,7 +1059,7 @@ TEST_F(KernelImmutableDataTests, whenHasRTCallsIsTrueThenCrossThreadDataIsPatche
EXPECT_NE(nullptr, rtDispatchGlobals);
auto dispatchGlobalsAddressPatched = *reinterpret_cast<uint64_t *>(ptrOffset(crossThreadData.get(), rtGlobalPointerPatchOffset));
auto dispatchGlobalsGpuAddressOffset = static_cast<uint64_t>(rtDispatchGlobals->rtDispatchGlobalsArray->getGpuAddressToPatch());
auto dispatchGlobalsGpuAddressOffset = static_cast<uint64_t>(rtDispatchGlobals->rtDispatchGlobals[0]->getGpuAddressToPatch());
EXPECT_EQ(dispatchGlobalsGpuAddressOffset, dispatchGlobalsAddressPatched);
kernel->crossThreadData.release();