[DX12] RHIThreadにてGetAccelerationStructureAddress実行時にアクセス違反が発生する

お世話になっております。

WorldPartitionを使用したオープンワールドのレベルで、特定の場所を行き来していると表題箇所にてクラッシュします。

サンプルプロジェクトでの再現は確認できていません。

FRayTracingInstanceBufferBuilder::FillAccelerationStructureAddressesBuffer の以下の処理でクラッシュしており、ReferencedGeometries の DataPtr が上書きされているように見えたため Data をFRWLockで排他制御するようにローカルで修正を入れてみたものの、依然としてクラッシュが発生する状況でした。​

​本件の対処に関してなにか思い当たるものがありましたらご教示いただけますと幸いです。

		RHICmdList.EnqueueLambda([AddressesPtr, ReferencedGeometries, GPUIndex](FRHICommandListBase&)
			{
				TRACE_CPUPROFILER_EVENT_SCOPE(GetAccelerationStructuresAddresses);

				for (int32 GeometryIndex = 0; GeometryIndex < ReferencedGeometries.Num(); ++GeometryIndex)
				{
					AddressesPtr[GeometryIndex] = ReferencedGeometries[GeometryIndex]->GetAccelerationStructureAddress(GPUIndex);  //< CRASH
				}
			});

[Attachment Removed]

お世話になっております。

本件連休を挟み返信にお時間を頂いておりました。申し訳ございません。

確認させていただいたところ過去に類似箇所のクラッシュ報告はあったようなのですが、

こちらはCL31738377やCL23212747といった形で修正されており、直近のバージョンでは報告されていない状況のようでした。

再現が難しいとのことですので詳細な挙動は確認できておりませんが、該当の処理ではポインタをそのまま利用しているようでしたので

以下のようにTRefCountPtrで保持することで回避できないかご確認いただけますでしょうか?

void FRayTracingInstanceBufferBuilder::FillAccelerationStructureAddressesBuffer(FRHICommandList& RHICmdList)
{
	const uint32 NumGeometries = FMath::RoundUpToPowerOfTwo(Data.ReferencedGeometries.Num());
 
	{
		// Round to PoT to avoid resizing too often
		const uint32 NumGeometriesAligned = FMath::RoundUpToPowerOfTwo(NumGeometries);
		const uint32 AccelerationStructureAddressesBufferSize = NumGeometriesAligned * sizeof(FRayTracingAccelerationStructureAddress);
 
		if (AccelerationStructureAddressesBuffer.NumBytes < AccelerationStructureAddressesBufferSize)
		{
			// Need to pass "BUF_MultiGPUAllocate", as virtual addresses are different per GPU
			AccelerationStructureAddressesBuffer.Initialize(RHICmdList, TEXT("FRayTracingScene::AccelerationStructureAddressesBuffer"), AccelerationStructureAddressesBufferSize, BUF_Volatile | BUF_MultiGPUAllocate);
		}
	}
 
	// 追加
	TArray<TRefCountPtr<FRHIRayTracingGeometry>> ReferencedGeometries;
	ReferencedGeometries.Reserve(Data.ReferencedGeometries.Num());
	for (FRHIRayTracingGeometry* ReferencedGeometry : Data.ReferencedGeometries)
	{
		ReferencedGeometries.Add(ReferencedGeometry);
	}
	// 追加ここまで
 
	for (uint32 GPUIndex : RHICmdList.GetGPUMask())
	{
		FRayTracingAccelerationStructureAddress* AddressesPtr = (FRayTracingAccelerationStructureAddress*)RHICmdList.LockBufferMGPU(
			AccelerationStructureAddressesBuffer.Buffer,
			GPUIndex,
			0,
			NumGeometries * sizeof(FRayTracingAccelerationStructureAddress), RLM_WriteOnly);
 
		// 以下をコメントアウト
		//const TArrayView<FRHIRayTracingGeometry*> ReferencedGeometries = RHICmdList.AllocArray(MakeConstArrayView(Data.ReferencedGeometries));
 
		RHICmdList.EnqueueLambda([AddressesPtr, ReferencedGeometries, GPUIndex](FRHICommandListBase&)
			{
				TRACE_CPUPROFILER_EVENT_SCOPE(GetAccelerationStructuresAddresses);
 
				for (int32 GeometryIndex = 0; GeometryIndex < ReferencedGeometries.Num(); ++GeometryIndex)
				{
					AddressesPtr[GeometryIndex] = ReferencedGeometries[GeometryIndex]->GetAccelerationStructureAddress(GPUIndex);
				}
			});
 
	...

​お手数おかけしますが、よろしくお願いいたします。

[Attachment Removed]

お世話になっております。

情報が少ない中でご対応いただきありがとうございます。

いただいた修正を試してみたところ、依然として同じクラッシュが発生するようでした…。

ダンプだと AddressesPtr や ReferencedGeometries の中身が見れない状態で手がかりがあまりなさそうだったのですが、VSでアプリにアタッチしてみたところ

AddressPtr や ReferencedGeometries が見れる状態でクラッシュしました。

ReferencedGeometries[314] のみ FD3D12RayTracingGeometry が存在せず、したがって AccelerationStructureBufferes にアクセスできずクラッシュしていました。

IndexBuffer が nullptr になっているので、不正なデータが作られているかもしれません。

[Attachment Removed]

初回報告時に提出したものとおそらく同じですが、下記になります。

 
 	000001b5229468e0()	Unknown
 
>	Application-Win64-Test.exe!FRayTracingInstanceBufferBuilder::FillAccelerationStructureAddressesBuffer::__l14::<lambda_1>::operator()(FRHICommandListBase & __formal) Line 1036	C++
 
 	Application-Win64-Test.exe!TRHILambdaCommand<FRHICommandList,`FRayTracingInstanceBufferBuilder::FillAccelerationStructureAddressesBuffer'::`14'::<lambda_1>>::ExecuteAndDestruct(FRHICommandListBase & CmdList) Line 373	C++
 
 	Application-Win64-Test.exe!FRHICommandListBase::Execute() Line 539	C++
 
 	Application-Win64-Test.exe!FRHICommandListExecutor::FTranslateState::Translate(FRHICommandListBase * CmdList) Line 1096	C++
 
 	[Inline Frame] Application-Win64-Test.exe!FCpuProfilerTrace::FEventScope::{ctor}(unsigned int &) Line 197	C++
 
 	Application-Win64-Test.exe!FRHICommandListExecutor::FSubmitState::Dispatch::__l4::<lambda_1>::operator()() Line 1044	C++
 
 	[Inline Frame] Application-Win64-Test.exe!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<0>,void __cdecl(void)>::operator()() Line 414	C++
 
 	Application-Win64-Test.exe!FRHICommandListExecutor::FTaskPipe::Execute(FRHICommandListExecutor::FTaskPipe::FTask * Task, const TRefCountPtr<FBaseGraphTask> & CurrentEvent) Line 740	C++
 
 	[Inline Frame] Application-Win64-Test.exe!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &)>::operator()(ENamedThreads::Type <Params_0>, const TRefCountPtr<FBaseGraphTask> &) Line 414	C++
 
 	[Inline Frame] Application-Win64-Test.exe!TFunctionGraphTaskImpl<void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &),0>::DoTaskImpl(TUniqueFunction<void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &)> &) Line 1113	C++
 
 	[Inline Frame] Application-Win64-Test.exe!TFunctionGraphTaskImpl<void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &),0>::DoTask(ENamedThreads::Type) Line 1094	C++
 
 	Application-Win64-Test.exe!TGraphTask<TFunctionGraphTaskImpl<void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &),0>>::ExecuteTask() Line 697	C++
 
 	[Inline Frame] Application-Win64-Test.exe!std::_Atomic_storage<int,4>::load(const std::memory_order) Line 932	C++
 
 	[Inline Frame] Application-Win64-Test.exe!UE::Trace::Private::AtomicLoadRelaxed(volatile int *) Line 62	C++
 
 	[Inline Frame] Application-Win64-Test.exe!UE::Trace::FChannel::IsEnabled() Line 18	C++
 
 	[Inline Frame] Application-Win64-Test.exe!UE::Trace::FChannel::operator bool() Line 24	C++
 
 	[Inline Frame] Application-Win64-Test.exe!TaskTrace::Finished(unsigned __int64) Line 199	C++
 
 	[Inline Frame] Application-Win64-Test.exe!TaskTrace::FTaskTimingEventScope::{dtor}() Line 322	C++
 
 	Application-Win64-Test.exe!UE::Tasks::Private::FTaskBase::TryExecuteTask() Line 519	C++
 
 	[Inline Frame] Application-Win64-Test.exe!FBaseGraphTask::Execute(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> &) Line 495	C++
 
 	Application-Win64-Test.exe!FNamedTaskThread::ProcessTasksNamedThread(int QueueIndex, bool bAllowStall) Line 791	C++
 
 	Application-Win64-Test.exe!FNamedTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 680	C++
 
 	Application-Win64-Test.exe!FRHIThread::Run() Line 213	C++
 
 	Application-Win64-Test.exe!FRunnableThreadWin::Run() Line 159	C++
 
 	Application-Win64-Test.exe!FRunnableThreadWin::GuardedRun() Line 79	C++
 
 	kernel32.dll!00007ff95c76e8d7()	Unknown
 
 	ntdll.dll!00007ff95d60c3fc()	Unknown

[Attachment Removed]

ご確認いただきありがとうございます。

先日ご案内いただいた、void FRayTracingInstanceBufferBuilder::FillAccelerationStructureAddressesBuffer(FRHICommandList& RHICmdList) の変更に加えて

RayTracing.cppに上記修正を行ってみましたが、変わらず同じコールスタックでクラッシュしました。

また、その状態で`r.RayTracing.UseReferenceBasedResidency false`としてみましたが、それでも同様箇所でクラッシュする状態でした。

問題のあるデータのAtomicFlagsを確認してみたところ、1073741825 (10) = 01000000000000000000000000000001 (2) となっており MarkedForDeleteBit が立っているようでした。

Geometry->IsValid() だと FRayTracingGeometry::IsValid() が呼ばれて MakedForDeleteBit が立っているかどうかを見れていないようですので、ひとまず

if (!Geometry->IsValid() || !Geometry->GetRHI()->IsValid() || Geometry->IsEvicted())
					{
						continue;
					}

とすることで MakedForDeleteBit が立っているか判定することで解決するのかを確認してみます。

(追記)

解決しませんでした

[Attachment Removed]

RHICmdList.EnqueueLambda([AddressesPtr, ReferencedGeometries, GPUIndex](FRHICommandListBase&)
			{
				TRACE_CPUPROFILER_EVENT_SCOPE(GetAccelerationStructuresAddresses);
 
				for (int32 GeometryIndex = 0; GeometryIndex < ReferencedGeometries.Num(); ++GeometryIndex)
				{
					if (ReferencedGeometries[GeometryIndex]->IsValid())
					{
						AddressesPtr[GeometryIndex] = ReferencedGeometries[GeometryIndex]->GetAccelerationStructureAddress(GPUIndex);
					}
				}
			});

としてみたところ、以下のコールスタックでクラッシュするようになりました。

[Inline Frame] Application-Win64-Test.exe!FD3D12ResourceLocation::GetResource() Line 700	C++
>	Application-Win64-Test.exe!PrepareAccelerationStructureBuild(FD3D12CommandContext & CommandContext, FD3D12RayTracingScene & Scene, FD3D12Buffer * ScratchBuffer, unsigned int ScratchBufferOffset, FD3D12Buffer * InstanceBuffer, unsigned int InstanceBufferOffset, unsigned int NumInstances, EAccelerationStructureBuildMode BuildMode, D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC & OutBuildDesc) Line 4519	C++
 	Application-Win64-Test.exe!FD3D12CommandContext::RHIBuildAccelerationStructures(TArrayView<FRayTracingSceneBuildParams const ,int> Params) Line 4814	C++
 	Application-Win64-Test.exe!FRHICommandBuildSceneAccelerationStructures::Execute(FRHICommandListBase & CmdList) Line 509	C++
 	[Inline Frame] Application-Win64-Test.exe!FCpuProfilerTrace::FEventScope::{ctor}(unsigned int &) Line 215	C++
 	Application-Win64-Test.exe!FRHICommand<FRHICommandBuildSceneAccelerationStructures,FUnnamedRhiCommand>::ExecuteAndDestruct(FRHICommandListBase & CmdList) Line 1622	C++
 	Application-Win64-Test.exe!FRHICommandListBase::Execute() Line 539	C++
 	Application-Win64-Test.exe!FRHICommandListExecutor::FTranslateState::Translate(FRHICommandListBase * CmdList) Line 1096	C++
 	[Inline Frame] Application-Win64-Test.exe!FCpuProfilerTrace::FEventScope::{ctor}(unsigned int &) Line 197	C++
 	Application-Win64-Test.exe!FRHICommandListExecutor::FSubmitState::Dispatch::__l4::<lambda_1>::operator()() Line 1044	C++
 	[Inline Frame] Application-Win64-Test.exe!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<0>,void __cdecl(void)>::operator()() Line 414	C++
 	Application-Win64-Test.exe!FRHICommandListExecutor::FTaskPipe::Execute(FRHICommandListExecutor::FTaskPipe::FTask * Task, const TRefCountPtr<FBaseGraphTask> & CurrentEvent) Line 740	C++
 	[Inline Frame] Application-Win64-Test.exe!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &)>::operator()(ENamedThreads::Type <Params_0>, const TRefCountPtr<FBaseGraphTask> &) Line 414	C++
 	[Inline Frame] Application-Win64-Test.exe!TFunctionGraphTaskImpl<void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &),0>::DoTaskImpl(TUniqueFunction<void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &)> &) Line 1113	C++
 	[Inline Frame] Application-Win64-Test.exe!TFunctionGraphTaskImpl<void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &),0>::DoTask(ENamedThreads::Type) Line 1094	C++
 	Application-Win64-Test.exe!TGraphTask<TFunctionGraphTaskImpl<void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &),0>>::ExecuteTask() Line 697	C++
 	[Inline Frame] Application-Win64-Test.exe!std::_Atomic_storage<int,4>::load(const std::memory_order) Line 932	C++
 	[Inline Frame] Application-Win64-Test.exe!UE::Trace::Private::AtomicLoadRelaxed(volatile int *) Line 62	C++
 	[Inline Frame] Application-Win64-Test.exe!UE::Trace::FChannel::IsEnabled() Line 18	C++
 	[Inline Frame] Application-Win64-Test.exe!UE::Trace::FChannel::operator bool() Line 24	C++
 	[Inline Frame] Application-Win64-Test.exe!TaskTrace::Finished(unsigned __int64) Line 199	C++
 	[Inline Frame] Application-Win64-Test.exe!TaskTrace::FTaskTimingEventScope::{dtor}() Line 322	C++
 	Application-Win64-Test.exe!UE::Tasks::Private::FTaskBase::TryExecuteTask() Line 519	C++
 	[Inline Frame] Application-Win64-Test.exe!FBaseGraphTask::Execute(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> &) Line 495	C++
 	Application-Win64-Test.exe!FNamedTaskThread::ProcessTasksNamedThread(int QueueIndex, bool bAllowStall) Line 791	C++
 	Application-Win64-Test.exe!FNamedTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 680	C++
 	Application-Win64-Test.exe!FRHIThread::Run() Line 213	C++
 	Application-Win64-Test.exe!FRunnableThreadWin::Run() Line 159	C++
 	Application-Win64-Test.exe!FRunnableThreadWin::GuardedRun() Line 79	C++
 	kernel32.dll!00007ff972b5e8d7()	Unknown
 	ntdll.dll!00007ff973c6c3fc()	Unknown

if (!Geometry->IsValid() || !Geometry->GetRHI()->IsValid() || Geometry->IsEvicted())

の判定は行っている状態です。

[Attachment Removed]

ありがとうございます。

現在githubを利用して差分を確認している状況なのですが、CL54000792 がヒットしないためgithubのリンクを共有いただけないでしょうか?

お手数ですが、よろしくお願いいたします。

[Attachment Removed]

返信遅くなり申し訳ありません。

ご対応ありがとうございます。

CL54000792 と防衛的スキップ処理を追加したものの、クラッシュは解決できませんでした⋯。

適当にブレークポイントを置いて確認した限りでは、FD3D12RayTracingGeometry::~FD3D12RayTracingGeometry() が呼ばれて MakedForDeleteBit が立てられてから実際に破棄されるまで数フレームのラグがありそうでしたが、完全に破棄されるまでの間に再び ReferencedGeometries に追加されてしまうことはあり得るのでしょうか?

[Attachment Removed]

ありがとうございます。

何の変更による影響かわかっていないのですが、クラッシュが発生しなくなりました⋯。

そのため、ご教示いただいた修正で回避可能な問題だったのかどうかの確認に時間がかかっています。

確認でき次第ご連絡いたします。

お手数ですが、よろしくお願いいたします。

[Attachment Removed]

お世話になっております。

​「BuildRayTracingSceneInitializationDataによる構築時に確認を行う」処理を適用してしばらく様子を見ていたのですが、依然として同じコールスタックでクラッシュが発生するようでした⋯。

追加の調査ができていないため取り急ぎの報告となります。

お手数ですが相談を再開させていただますと幸いです。

よろしくお願いいたします。​

[Attachment Removed]

ご対応ありがとうございます。

上記組み込んで確認してみたのですが、依然としてクラッシュする状況でした⋯。

ややこしい話で申し訳ないのですが、​「BuildRayTracingSceneInitializationDataによる構築時に確認を行う」処理のみ適用したパッケージで同様のコールスタックでクラッシュが発生した際に

​FD3D12RayTracingGeometry が UMaterialInstanceConstant になっているものがありました。

状況確認中ですが、メモリ破壊が発生している​のかもしれません。

[Image Removed]

[Attachment Removed]

ご回答ありがとうございます。

ご案内いただいた変更を取り込みエディタPIEでの起動確認を行っていたところ、下記のコールスタックでcheckf()に引っかかりました。

FRayTracingGeometry::ReleaseRHI()が Foreground Worker から呼ばれてしまっているようです。

(今のところエディタで本スレッドのクラッシュは引いておりません。クラッシュの確認はTestパッケージで行っています。あくまでもエンジン更新後の起動確認になります)

FRayTracingGeometry::ReleaseRHI()がRenderThread以外から呼ばれることは想定通りなのでしょうか?

お手数ですがご確認いただけますと幸いです。

よろしくお願いいたします。

>	UnrealEditor-Engine.dll!FRayTracingGeometryManager::RequestUpdateCachedRenderState(int InRayTracingGeometryGroupHandle) Line 1479	C++
 	UnrealEditor-RenderCore.dll!FRenderResource::ReleaseResource() Line 218	C++
 	UnrealEditor-RenderCore.dll!FRayTracingGeometry::ReleaseResource() Line 301	C++
 	[Inline Frame] UnrealEditor-RenderCore.dll!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl(void)>::operator()() Line 414	C++
 	UnrealEditor-RenderCore.dll!ExecuteCommand(FRHICommandList * RHICmdList, const TVariant<TUniqueFunction<void __cdecl(void)>,TUniqueFunction<void __cdecl(FRHICommandList &)>,TUniqueFunction<void __cdecl(FRHICommandListImmediate &)>> & Function, const FRenderCommandTag & Tag) Line 1535	C++
 	[Inline Frame] UnrealEditor-RenderCore.dll!FRenderCommandPipe::ExecuteCommands::__l2::<lambda_1>::operator()(TVariant<TUniqueFunction<void __cdecl(void)>,TUniqueFunction<void __cdecl(FRHICommandList &)>,TUniqueFunction<void __cdecl(FRHICommandListImmediate &)>> &&) Line 2423	C++
 	UnrealEditor-RenderCore.dll!UE::RenderCommandPipe::FCommandList::ConsumeCommands<`FRenderCommandPipe::ExecuteCommands'::`2'::<lambda_1>>(const FRenderCommandPipe::ExecuteCommands::__l2::<lambda_1> & Lambda) Line 431	C++
 	[Inline Frame] UnrealEditor-RenderCore.dll!FRenderCommandPipe::ExecuteCommands(UE::RenderCommandPipe::FCommandList &) Line 2421	C++
 	UnrealEditor-RenderCore.dll!FRenderCommandPipe::EnqueueAndLaunch::__l5::<lambda_2>::operator()() Line 2399	C++
 	UnrealEditor-RenderCore.dll!UE::Tasks::Private::FTaskBase::TryExecuteTask() Line 518	C++
 	[Inline Frame] UnrealEditor-RenderCore.dll!UE::Tasks::Private::FTaskBase::Init::__l2::<lambda_1>::operator()() Line 180	C++
 	[Inline Frame] UnrealEditor-RenderCore.dll!LowLevelTasks::FTask::Init::__l13::<lambda_1>::operator()(const bool) Line 499	C++
 	[Inline Frame] UnrealEditor-RenderCore.dll!Invoke(LowLevelTasks::FTask::Init::__l13::<lambda_1> &) Line 47	C++
 	[Inline Frame] UnrealEditor-RenderCore.dll!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::TTaskDelegateImpl<`LowLevelTasks::FTask::Init<`UE::Tasks::Private::FTaskBase::Init'::`2'::<lambda_1>>'::`13'::<lambda_1>,0>::Call(void *) Line 162	C++
 	UnrealEditor-RenderCore.dll!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::TTaskDelegateImpl<`LowLevelTasks::FTask::Init<`UE::Tasks::Private::FTaskBase::Init'::`2'::<lambda_1>>'::`13'::<lambda_1>,0>::CallAndMove(LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48> & Destination, void * InlineData, unsigned int DestInlineSize, bool <Params_0>) Line 171	C++
 	[Inline Frame] UnrealEditor-Core.dll!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::CallAndMove(LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48> &) Line 309	C++
 	UnrealEditor-Core.dll!LowLevelTasks::FTask::ExecuteTask() Line 627	C++
 	UnrealEditor-Core.dll!LowLevelTasks::FScheduler::ExecuteTask(LowLevelTasks::FTask * InTask) Line 397	C++
 	[Inline Frame] UnrealEditor-Core.dll!LowLevelTasks::FScheduler::TryExecuteTaskFrom(LowLevelTasks::Private::FWaitEvent *) Line 698	C++
 	UnrealEditor-Core.dll!LowLevelTasks::FScheduler::WorkerLoop(LowLevelTasks::Private::FWaitEvent * WorkerEvent, LowLevelTasks::Private::TLocalQueueRegistry<1024,1024>::TLocalQueue * WorkerLocalQueue, unsigned int WaitCycles, bool bPermitBackgroundWork) Line 757	C++
 	[Inline Frame] UnrealEditor-Core.dll!LowLevelTasks::FScheduler::WorkerMain(LowLevelTasks::Private::FWaitEvent * WorkerEvent, LowLevelTasks::Private::TLocalQueueRegistry<1024,1024>::TLocalQueue * WorkerLocalQueue, unsigned int WaitCycles, bool) Line 816	C++
 	UnrealEditor-Core.dll!LowLevelTasks::FScheduler::CreateWorker::__l2::<lambda_1>::operator()() Line 220	C++
 	[Inline Frame] UnrealEditor-Core.dll!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl(void)>::operator()() Line 414	C++
 	UnrealEditor-Core.dll!FThreadImpl::Run() Line 69	C++
 	UnrealEditor-Core.dll!FRunnableThreadWin::Run() Line 159	C++
 	UnrealEditor-Core.dll!FRunnableThreadWin::GuardedRun() Line 71	C++
 	kernel32.dll!00007ff896bce8d7()	Unknown
 	ntdll.dll!00007ff898aec3fc()	Unknown

[Attachment Removed]

連投申し訳ありません⋯。

BackGround Worker からも呼ばれることがあり、そちらは以下のコールスタックでした。

>	UnrealEditor-Engine.dll!FRayTracingGeometryManager::RequestUpdateCachedRenderState(int InRayTracingGeometryGroupHandle) Line 1479	C++
 	UnrealEditor-RenderCore.dll!FRayTracingGeometry::CreateRayTracingGeometry(FRHICommandListBase & RHICmdList, ERTAccelerationStructureBuildPriority InBuildPriority) Line 149	C++
 	UnrealEditor-RenderCore.dll!FRayTracingGeometry::InitRHI(FRHICommandListBase & RHICmdList) Line 250	C++
 	UnrealEditor-RenderCore.dll!FRenderResource::InitResource(FRHICommandListBase & RHICmdList) Line 198	C++
 	UnrealEditor-RenderCore.dll!FRayTracingGeometry::InitResource(FRHICommandListBase & RHICmdList) Line 281	C++
 	UnrealEditor-Engine.dll!FSkeletalMeshRenderData::InitStaticRayTracingGeometry::__l5::<lambda_1>::operator()(FRHICommandList & RHICmdList) Line 763	C++
 	UnrealEditor-RenderCore.dll!ExecuteCommand(FRHICommandList * RHICmdList, const TVariant<TUniqueFunction<void __cdecl(void)>,TUniqueFunction<void __cdecl(FRHICommandList &)>,TUniqueFunction<void __cdecl(FRHICommandListImmediate &)>> & Function, const FRenderCommandTag & Tag) Line 1540	C++
 	[Inline Frame] UnrealEditor-RenderCore.dll!FRenderCommandPipe::ExecuteCommands::__l2::<lambda_1>::operator()(TVariant<TUniqueFunction<void __cdecl(void)>,TUniqueFunction<void __cdecl(FRHICommandList &)>,TUniqueFunction<void __cdecl(FRHICommandListImmediate &)>> &&) Line 2423	C++
 	UnrealEditor-RenderCore.dll!UE::RenderCommandPipe::FCommandList::ConsumeCommands<`FRenderCommandPipe::ExecuteCommands'::`2'::<lambda_1>>(const FRenderCommandPipe::ExecuteCommands::__l2::<lambda_1> & Lambda) Line 431	C++
 	[Inline Frame] UnrealEditor-RenderCore.dll!FRenderCommandPipe::ExecuteCommands(UE::RenderCommandPipe::FCommandList &) Line 2421	C++
 	UnrealEditor-RenderCore.dll!FRenderCommandPipe::EnqueueAndLaunch::__l5::<lambda_2>::operator()() Line 2399	C++
 	UnrealEditor-RenderCore.dll!UE::Tasks::Private::FTaskBase::TryExecuteTask() Line 518	C++
 	[Inline Frame] UnrealEditor-RenderCore.dll!UE::Tasks::Private::FTaskBase::Init::__l2::<lambda_1>::operator()() Line 180	C++
 	[Inline Frame] UnrealEditor-RenderCore.dll!LowLevelTasks::FTask::Init::__l13::<lambda_1>::operator()(const bool) Line 499	C++
 	[Inline Frame] UnrealEditor-RenderCore.dll!Invoke(LowLevelTasks::FTask::Init::__l13::<lambda_1> &) Line 47	C++
 	[Inline Frame] UnrealEditor-RenderCore.dll!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::TTaskDelegateImpl<`LowLevelTasks::FTask::Init<`UE::Tasks::Private::FTaskBase::Init'::`2'::<lambda_1>>'::`13'::<lambda_1>,0>::Call(void *) Line 162	C++
 	UnrealEditor-RenderCore.dll!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::TTaskDelegateImpl<`LowLevelTasks::FTask::Init<`UE::Tasks::Private::FTaskBase::Init'::`2'::<lambda_1>>'::`13'::<lambda_1>,0>::CallAndMove(LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48> & Destination, void * InlineData, unsigned int DestInlineSize, bool <Params_0>) Line 171	C++
 	[Inline Frame] UnrealEditor-Core.dll!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::CallAndMove(LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48> &) Line 309	C++
 	UnrealEditor-Core.dll!LowLevelTasks::FTask::ExecuteTask() Line 627	C++
 	UnrealEditor-Core.dll!LowLevelTasks::FScheduler::ExecuteTask(LowLevelTasks::FTask * InTask) Line 397	C++
 	[Inline Frame] UnrealEditor-Core.dll!LowLevelTasks::FScheduler::TryExecuteTaskFrom(LowLevelTasks::Private::FWaitEvent *) Line 698	C++
 	UnrealEditor-Core.dll!LowLevelTasks::FScheduler::WorkerLoop(LowLevelTasks::Private::FWaitEvent * WorkerEvent, LowLevelTasks::Private::TLocalQueueRegistry<1024,1024>::TLocalQueue * WorkerLocalQueue, unsigned int WaitCycles, bool bPermitBackgroundWork) Line 757	C++
 	[Inline Frame] UnrealEditor-Core.dll!LowLevelTasks::FScheduler::WorkerMain(LowLevelTasks::Private::FWaitEvent * WorkerEvent, LowLevelTasks::Private::TLocalQueueRegistry<1024,1024>::TLocalQueue * WorkerLocalQueue, unsigned int WaitCycles, bool) Line 816	C++
 	UnrealEditor-Core.dll!LowLevelTasks::FScheduler::CreateWorker::__l2::<lambda_1>::operator()() Line 220	C++
 	[Inline Frame] UnrealEditor-Core.dll!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl(void)>::operator()() Line 414	C++
 	UnrealEditor-Core.dll!FThreadImpl::Run() Line 69	C++
 	UnrealEditor-Core.dll!FRunnableThreadWin::Run() Line 159	C++
 	UnrealEditor-Core.dll!FRunnableThreadWin::GuardedRun() Line 71	C++
 	kernel32.dll!00007ff896bce8d7()	Unknown
 	ntdll.dll!00007ff898aec3fc()	Unknown

[Attachment Removed]

ご確認ありがとうございます。

こちらの確認不足となってしまっていまい申し訳ございません。

改めて確認させて頂きましたが、ReleaseRHI()はワーカースレッドからも呼ばれてしまう見込みです。

対応方法としてはReleaseRHI()がRenderThread以外(ワーカースレッド)から呼ばれた場合に処理をRenderThreadへ遅延させ、FRayTracingGeometryManager::Tick()の冒頭でまとめて実行することで対応できないかと考えております。

お手数おかけしますが、以下のような修正をお試しいただけますと幸いです。

.\Engine\Source\Runtime\Engine\Public\Rendering\RayTracingGeometryManager.h

	// (213行目辺りで以下2つを追加)
	TSet<RayTracing::FGeometryGroupHandle> PendingCachedRenderStateUpdates;
	FCriticalSection PendingCachedRenderStateLock;

.\Engine\Source\Runtime\Engine\Private\Rendering\RayTracingGeometryManager.cpp

遅延無効化処理を追加。Check2か所の処理を置き換え

#if DO_CHECK
	static uint64 PreviousFrameCounter = GFrameCounterRenderThread - 1;
	checkf(GFrameCounterRenderThread != PreviousFrameCounter, TEXT("FRayTracingGeometryManager::Tick() should only be called once per frame"));
	PreviousFrameCounter = GFrameCounterRenderThread;
#endif
 
 	 // (590行目辺りから)遅延無効化処理を追加
	{
		TSet<RayTracing::FGeometryGroupHandle> LocalPending;
		{
			FScopeLock Lock(&PendingCachedRenderStateLock);
			Swap(LocalPending, PendingCachedRenderStateUpdates);
		}
		for (RayTracing::FGeometryGroupHandle GroupHandle : LocalPending)
		{
			if (IsRayTracingAllowed() && RegisteredGroups.IsValidIndex(GroupHandle))
			{
				RequestUpdateCachedRenderState(GroupHandle);
			}
		}
	}
	
	
void FRayTracingGeometryManager::RequestUpdateCachedRenderState(RayTracing::FGeometryGroupHandle InRayTracingGeometryGroupHandle)
{
  	// (1494行目辺りから)チェックを置き換える
	// checkf(IsInRenderingThread(), TEXT("Can only access RegisteredGroups on render thread otherwise need a critical section"));
	if (!IsInRenderingThread())
	{
		if (InRayTracingGeometryGroupHandle != INDEX_NONE)
		{
			FScopeLock Lock(&PendingCachedRenderStateLock);
			PendingCachedRenderStateUpdates.Add(InRayTracingGeometryGroupHandle);
		}
		return;
	}
 
	checkf(IsRayTracingAllowed(), TEXT("Should only register proxies with FRayTracingGeometryManager when ray tracing is allowed"));
 
	// 変更:解放済みグループの場合は assert せずそのまま終了
	// checkf(RegisteredGroups.IsValidIndex(InRayTracingGeometryGroupHandle), TEXT("InRayTracingGeometryGroupHandle must be valid"));
	if (!RegisteredGroups.IsValidIndex(InRayTracingGeometryGroupHandle))
	{
		return;
	}

​**.\Engine\Source\Runtime\RenderCore\Private\RayTracingGeometry.cpp**

// (259行目辺り:前回の修正はそのまま)

[Attachment Removed]

ご確認ありがとうございます。

一通り適用したもので確認していますが、今のところクラッシュしていた場所でクラッシュしなくなったため効果ありそうです。

もう少し様子を見てみます。

[Attachment Removed]

こちらの修正を一通り入れたもので確認していたところ、以下のコールスタックでクラッシュしました。​

こちらについて本件とは無関係の症状になりますでしょうか?​

 	Application-Win64-Test.exe!WriteInstanceDescriptor(const FRayTracingGeometryInstance & SceneInstance, unsigned int SceneInstanceIndex, unsigned int TransformIndex, unsigned int AccelerationStructureIndex, bool bGpuSceneInstance, bool bUseUniqueUserData, bool bUseLightingChannels, bool bForceOpaque, bool bDisableTriangleCull, unsigned int BaseInstanceIndex, unsigned int BaseTransformIndex, FRayTracingInstanceDescriptor & OutInstanceDescriptor) Line 325	C++
>	Application-Win64-Test.exe!FillRayTracingInstanceUploadBuffer::__l2::<lambda>(int SceneInstanceIndex) Line 433	C++
 	[Inline Frame] Application-Win64-Test.exe!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::FFunctionRefStoragePolicy,void __cdecl(int)>::operator()(int <Params_0>) Line 414	C++
 	[Inline Frame] Application-Win64-Test.exe!ParallelForImpl::CallBody(const TFunctionRef<void __cdecl(int)> &) Line 81	C++
 	Application-Win64-Test.exe!`ParallelForImpl::ParallelForInternal<TFunctionRef<void __cdecl(int)>,`ParallelFor'::`2'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &),std::nullptr_t>'::`2'::FParallelExecutor::operator()(const bool bIsMaster) Line 358	C++
 	[Inline Frame] Application-Win64-Test.exe!LowLevelTasks::FTask::Init::__l5::<lambda>(const bool) Line 499	C++
 	[Inline Frame] Application-Win64-Test.exe!Invoke(LowLevelTasks::FTask::Init::__l5::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &) &) Line 47	C++
 	[Inline Frame] Application-Win64-Test.exe!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::TTaskDelegateImpl<`LowLevelTasks::FTask::Init<`ParallelForImpl::ParallelForInternal<TFunctionRef<void __cdecl(int)>,`ParallelFor'::`2'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &),std::nullptr_t>'::`2'::FParallelExecutor>'::`5'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &),0>::Call(void *) Line 162	C++
 	Application-Win64-Test.exe!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::TTaskDelegateImpl<`LowLevelTasks::FTask::Init<`ParallelForImpl::ParallelForInternal<TFunctionRef<void __cdecl(int)>,`ParallelFor'::`2'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &),std::nullptr_t>'::`2'::FParallelExecutor>'::`5'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &),0>::CallAndMove(LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48> & Destination, void * InlineData, unsigned int DestInlineSize, bool <Params_0>) Line 171	C++
 	[Inline Frame] Application-Win64-Test.exe!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::CallAndMove(LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48> &) Line 309	C++
 	Application-Win64-Test.exe!LowLevelTasks::FTask::ExecuteTask() Line 627	C++
 	[Inline Frame] Application-Win64-Test.exe!FCpuProfilerTrace::FEventScope::{ctor}(unsigned int &) Line 197	C++
 	Application-Win64-Test.exe!LowLevelTasks::FScheduler::ExecuteTask(LowLevelTasks::FTask * InTask) Line 396	C++
 	[Inline Frame] Application-Win64-Test.exe!LowLevelTasks::FScheduler::TryExecuteTaskFrom(LowLevelTasks::Private::FWaitEvent *) Line 698	C++
 	Application-Win64-Test.exe!LowLevelTasks::FScheduler::WorkerLoop(LowLevelTasks::Private::FWaitEvent * WorkerEvent, LowLevelTasks::Private::TLocalQueueRegistry<1024,1024>::TLocalQueue * WorkerLocalQueue, unsigned int WaitCycles, bool bPermitBackgroundWork) Line 757	C++
 	[Inline Frame] Application-Win64-Test.exe!LowLevelTasks::FScheduler::WorkerMain(LowLevelTasks::Private::FWaitEvent * WorkerEvent, LowLevelTasks::Private::TLocalQueueRegistry<1024,1024>::TLocalQueue * WorkerLocalQueue, unsigned int WaitCycles, bool) Line 816	C++
 	Application-Win64-Test.exe!LowLevelTasks::FScheduler::CreateWorker::__l2::<lambda>() Line 220	C++
 	[Inline Frame] Application-Win64-Test.exe!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl(void)>::operator()() Line 414	C++
 	Application-Win64-Test.exe!FThreadImpl::Run() Line 68	C++
 	Application-Win64-Test.exe!FRunnableThreadWin::Run() Line 159	C++
 	Application-Win64-Test.exe!FRunnableThreadWin::GuardedRun() Line 79	C++
 	[Frames may be missing, no binary loaded for kernel32.dll]	
 	kernel32.dll!00007ffd7434e957()	Unknown

[Attachment Removed]

お世話になっております。

コールスタックの方確認させて頂いておりますが、1点こちらから確認させてください。

本スレッド内においていくつかの修正を行って頂いておりましたが、

それらの修正は現在行っている状態になりますでしょうか?

以下のようなBuildRayTracingSceneInitializationData時にcontinueを挟む対応を頂いておりましたが、

こちらのスキップにより適切に初期化が行えていなかった可能性があるため、

該当修正が導入済みの場合はcheckに戻す対応をお試しいただければと思います。

※!GeometryRHI->IsValid()の場合にはそのまま通し、GetAccelerationStructureAddressで0、PrepareAccelerationStructureBuildでskipする想定です。

FRayTracingSceneInitializationData BuildRayTracingSceneInitializationData(TConstArrayView<FRayTracingGeometryInstance> Instances, const TBitArray<>&    
 VisibleInstances)
 ...
 // 以下checkfをコメントアウトし4行を追加
 // checkf(InstanceDesc.GeometryRHI, TEXT("Ray tracing instance must have a valid geometry."));
 if (!InstanceDesc.GeometryRHI || !InstanceDesc.GeometryRHI->IsValid())
 {
  continue;
 }

お手数おかけしますが、よろしくお願いいたします。

[Attachment Removed]

ご確認ありがとうございます。

CL54000792の取り込み​と、

		// checkf(InstanceDesc.GeometryRHI, TEXT("Ray tracing instance must have a valid geometry."));
		if (!InstanceDesc.GeometryRHI || !InstanceDesc.GeometryRHI->IsValid())
		{
			continue;
		}

と​ HasValidAccelerationStructure() を使用したチェック処理および GRayTracingGeometryManager->RequestUpdateCachedRenderState(GroupHandle) によるState更新、

そしてこのState更新をRenderThreadで行うようにする対応​が含まれています。

ご案内いただいた部分をcheckf に戻して確認いたします。

以上、よろしくお願いいたします。​

[Attachment Removed]

お世話になっております。

確認遅くなり申し訳ありません。

checkf に戻したところ、RayTracingInstanceBufferUtil.cppの

`void FRayTracingInstanceBufferBuilder::FillAccelerationStructureAddressesBuffer(FRHICommandList& RHICmdList)`内で、

`AddressesPtr[GeometryIndex] = ReferencedGeometries[GeometryIndex]->GetAccelerationStructureAddress(GPUIndex);`

の `GetAccelerationStructureAddress()`にアクセスできずクラッシュする症状が再発したため、以下のように変更を加えてみました。

		RHICmdList.EnqueueLambda([AddressesPtr, ReferencedGeometries, GPUIndex](FRHICommandListBase&)
			{
				TRACE_CPUPROFILER_EVENT_SCOPE(GetAccelerationStructuresAddresses);
 
				for (int32 GeometryIndex = 0; GeometryIndex < ReferencedGeometries.Num(); ++GeometryIndex)
				{
                                        // 関数アクセス前に IsValid() をチェックするように変更
					if (ReferencedGeometries[GeometryIndex]->IsValid())
					{
						AddressesPtr[GeometryIndex] = ReferencedGeometries[GeometryIndex]->GetAccelerationStructureAddress(GPUIndex);
					}
					else
					{
						AddressesPtr[GeometryIndex] = 0;
					}
				}
			});

これによってクラッシュの頻度はかなり減ったのですが、以下のコールスタックで不正アクセスが発生しクラッシュすることがありました。

まだ対処が不足しているのかもしれません。

Unhandled exception at 0x00007FF6821C9E60 (Application-Win64-Test.exe) in UEMinidump.dmp: 0xC0000005: Access violation reading location 0xFFFFFFFF5D46B3F0.
 
 
>	[Inline Frame] Application-Win64-Test.exe!FD3D12RayTracingGeometry::HasValidAccelerationStructure(unsigned int) Line 136	C++
 	Application-Win64-Test.exe!PrepareAccelerationStructureBuild(FD3D12CommandContext & CommandContext, FD3D12RayTracingScene & Scene, FD3D12Buffer * ScratchBuffer, unsigned int ScratchBufferOffset, FD3D12Buffer * InstanceBuffer, unsigned int InstanceBufferOffset, unsigned int NumInstances, EAccelerationStructureBuildMode BuildMode, D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC & OutBuildDesc) Line 4516	C++
 	Application-Win64-Test.exe!FD3D12CommandContext::RHIBuildAccelerationStructures(TArrayView<FRayTracingSceneBuildParams const ,int> Params) Line 4819	C++
 	Application-Win64-Test.exe!FRHICommandBuildSceneAccelerationStructures::Execute(FRHICommandListBase & CmdList) Line 509	C++
 	[Inline Frame] Application-Win64-Test.exe!FCpuProfilerTrace::FEventScope::{ctor}(unsigned int &) Line 215	C++
 	Application-Win64-Test.exe!FRHICommand<FRHICommandBuildSceneAccelerationStructures,FUnnamedRhiCommand>::ExecuteAndDestruct(FRHICommandListBase & CmdList) Line 1622	C++
 	Application-Win64-Test.exe!FRHICommandListBase::Execute() Line 539	C++
 	Application-Win64-Test.exe!FRHICommandListExecutor::FTranslateState::Translate(FRHICommandListBase * CmdList) Line 1096	C++
 	[Inline Frame] Application-Win64-Test.exe!FCpuProfilerTrace::FEventScope::{ctor}(unsigned int &) Line 197	C++
 	Application-Win64-Test.exe!FRHICommandListExecutor::FSubmitState::Dispatch::__l4::<lambda_1>::operator()() Line 1044	C++
 	[Inline Frame] Application-Win64-Test.exe!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<0>,void __cdecl(void)>::operator()() Line 414	C++
 	Application-Win64-Test.exe!FRHICommandListExecutor::FTaskPipe::Execute(FRHICommandListExecutor::FTaskPipe::FTask * Task, const TRefCountPtr<FBaseGraphTask> & CurrentEvent) Line 740	C++
 	[Inline Frame] Application-Win64-Test.exe!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &)>::operator()(ENamedThreads::Type <Params_0>, const TRefCountPtr<FBaseGraphTask> &) Line 414	C++
 	[Inline Frame] Application-Win64-Test.exe!TFunctionGraphTaskImpl<void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &),0>::DoTaskImpl(TUniqueFunction<void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &)> &) Line 1113	C++
 	[Inline Frame] Application-Win64-Test.exe!TFunctionGraphTaskImpl<void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &),0>::DoTask(ENamedThreads::Type) Line 1094	C++
 	Application-Win64-Test.exe!TGraphTask<TFunctionGraphTaskImpl<void __cdecl(enum ENamedThreads::Type,TRefCountPtr<FBaseGraphTask> const &),0>>::ExecuteTask() Line 697	C++
 	[Inline Frame] Application-Win64-Test.exe!std::_Atomic_storage<int,4>::load(const std::memory_order) Line 932	C++
 	[Inline Frame] Application-Win64-Test.exe!UE::Trace::Private::AtomicLoadRelaxed(volatile int *) Line 62	C++
 	[Inline Frame] Application-Win64-Test.exe!UE::Trace::FChannel::IsEnabled() Line 18	C++
 	[Inline Frame] Application-Win64-Test.exe!UE::Trace::FChannel::operator bool() Line 24	C++
 	[Inline Frame] Application-Win64-Test.exe!TaskTrace::Finished(unsigned __int64) Line 199	C++
 	[Inline Frame] Application-Win64-Test.exe!TaskTrace::FTaskTimingEventScope::{dtor}() Line 322	C++
 	Application-Win64-Test.exe!UE::Tasks::Private::FTaskBase::TryExecuteTask() Line 519	C++
 	[Inline Frame] Application-Win64-Test.exe!FBaseGraphTask::Execute(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> &) Line 495	C++
 	Application-Win64-Test.exe!FNamedTaskThread::ProcessTasksNamedThread(int QueueIndex, bool bAllowStall) Line 791	C++
 	Application-Win64-Test.exe!FNamedTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 680	C++
 	Application-Win64-Test.exe!FRHIThread::Run() Line 213	C++
 	Application-Win64-Test.exe!FRunnableThreadWin::Run() Line 159	C++
 	Application-Win64-Test.exe!FRunnableThreadWin::GuardedRun() Line 79	C++
 	kernel32.dll!00007ff8ec29e957()	Unknown
 	ntdll.dll!00007ff8ed5e7c1c()	Unknown

一つ前の PrepareAccelerationStructureBuild() で Geometry > FRHIRayTracingAccelerationStructure > SizeInfo の値がかなり大きい値になってそうでした。

[Image Removed]

以上、お手数ですがご確認いただけますと幸いです。

お忙しいところ恐縮ですがよろしくお願いいたします。

[Attachment Removed]

以下のコールスタックで Geometry->HitGroupSystemParameters[Device->GetGPUIndex()] がnullとなっておりクラッシュする事例も発生していました。

一つ上はRHIThreadですがこちらは Foreground Worker でした。

>	Application-Win64-Test.exe!FD3D12RayTracingShaderBindingTableInternal::SetHitGroupGeometrySystemParameters(unsigned int WorkerIndex, ERayTracingLocalShaderBindingType BindingType, unsigned int RecordIndex, const FD3D12RayTracingGeometry * Geometry, unsigned int UserData, unsigned int GeometrySegmentIndex) Line 2156	C++
 	Application-Win64-Test.exe!SetRayTracingHitGroup(FD3D12Device * Device, FD3D12RayTracingShaderBindingTableInternal * ShaderTable, unsigned int RecordIndex, FD3D12RayTracingPipelineState * Pipeline, unsigned int HitGroupIndex, const FD3D12RayTracingGeometry * Geometry, unsigned int GeometrySegmentIndex, unsigned int NumUniformBuffers, FRHIUniformBuffer * const * UniformBuffers, unsigned int LooseParameterDataSize, const void * LooseParameterData, unsigned int UserData, ERayTracingLocalShaderBindingType BindingType, unsigned int WorkerIndex) Line 5822	C++
 	[Inline Frame] Application-Win64-Test.exe!FD3D12CommandContext::RHISetBindingsOnShaderBindingTable::__l2::<lambda>(const FD3D12CommandContext::RHISetBindingsOnShaderBindingTable::__l2::FTaskContext &) Line 6004	C++
 	[Inline Frame] Application-Win64-Test.exe!ParallelForImpl::CallBody(const FD3D12CommandContext::RHISetBindingsOnShaderBindingTable::__l2::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &) &) Line 74	C++
 	Application-Win64-Test.exe!`ParallelForImpl::ParallelForInternal<`FD3D12CommandContext::RHISetBindingsOnShaderBindingTable'::`2'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &),`ParallelForWithExistingTaskContext<`FD3D12CommandContext::RHISetBindingsOnShaderBindingTable'::`2'::FTaskContext,`FD3D12CommandContext::RHISetBindingsOnShaderBindingTable'::`2'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &)>'::`2'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &),`FD3D12CommandContext::RHISetBindingsOnShaderBindingTable'::`2'::FTaskContext>'::`2'::FParallelExecutor::operator()(const bool bIsMaster) Line 360	C++
 	[Inline Frame] Application-Win64-Test.exe!LowLevelTasks::FTask::Init::__l5::<lambda>(const bool) Line 499	C++
 	[Inline Frame] Application-Win64-Test.exe!Invoke(LowLevelTasks::FTask::Init::__l5::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &) &) Line 47	C++
 	[Inline Frame] Application-Win64-Test.exe!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::TTaskDelegateImpl<`LowLevelTasks::FTask::Init<`ParallelForImpl::ParallelForInternal<`FD3D12CommandContext::RHISetBindingsOnShaderBindingTable'::`2'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &),`ParallelForWithExistingTaskContext<`FD3D12CommandContext::RHISetBindingsOnShaderBindingTable'::`2'::FTaskContext,`FD3D12CommandContext::RHISetBindingsOnShaderBindingTable'::`2'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &)>'::`2'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &),`FD3D12CommandContext::RHISetBindingsOnShaderBindingTable'::`2'::FTaskContext>'::`2'::FParallelExecutor>'::`5'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &),0>::Call(void *) Line 162	C++
 	Application-Win64-Test.exe!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::TTaskDelegateImpl<`LowLevelTasks::FTask::Init<`ParallelForImpl::ParallelForInternal<`FD3D12CommandContext::RHISetBindingsOnShaderBindingTable'::`2'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &),`ParallelForWithExistingTaskContext<`FD3D12CommandContext::RHISetBindingsOnShaderBindingTable'::`2'::FTaskContext,`FD3D12CommandContext::RHISetBindingsOnShaderBindingTable'::`2'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &)>'::`2'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &),`FD3D12CommandContext::RHISetBindingsOnShaderBindingTable'::`2'::FTaskContext>'::`2'::FParallelExecutor>'::`5'::void <lambda>(const TArray<FString,TSizedDefaultAllocator<32>> &),0>::CallAndMove(LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48> & Destination, void * InlineData, unsigned int DestInlineSize, bool <Params_0>) Line 171	C++
 	[Inline Frame] Application-Win64-Test.exe!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::CallAndMove(LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48> &) Line 309	C++
 	Application-Win64-Test.exe!LowLevelTasks::FTask::ExecuteTask() Line 627	C++
 	[Inline Frame] Application-Win64-Test.exe!FCpuProfilerTrace::FEventScope::{ctor}(unsigned int &) Line 197	C++
 	Application-Win64-Test.exe!LowLevelTasks::FScheduler::ExecuteTask(LowLevelTasks::FTask * InTask) Line 396	C++
 	[Inline Frame] Application-Win64-Test.exe!LowLevelTasks::FScheduler::TryExecuteTaskFrom(LowLevelTasks::Private::FWaitEvent *) Line 698	C++
 	Application-Win64-Test.exe!LowLevelTasks::FScheduler::WorkerLoop(LowLevelTasks::Private::FWaitEvent * WorkerEvent, LowLevelTasks::Private::TLocalQueueRegistry<1024,1024>::TLocalQueue * WorkerLocalQueue, unsigned int WaitCycles, bool bPermitBackgroundWork) Line 757	C++
 	[Inline Frame] Application-Win64-Test.exe!LowLevelTasks::FScheduler::WorkerMain(LowLevelTasks::Private::FWaitEvent * WorkerEvent, LowLevelTasks::Private::TLocalQueueRegistry<1024,1024>::TLocalQueue * WorkerLocalQueue, unsigned int WaitCycles, bool) Line 816	C++
 	Application-Win64-Test.exe!LowLevelTasks::FScheduler::CreateWorker::__l2::<lambda>() Line 220	C++
 	[Inline Frame] Application-Win64-Test.exe!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl(void)>::operator()() Line 414	C++
 	Application-Win64-Test.exe!FThreadImpl::Run() Line 68	C++
 	Application-Win64-Test.exe!FRunnableThreadWin::Run() Line 159	C++
 	Application-Win64-Test.exe!FRunnableThreadWin::GuardedRun() Line 79	C++
 	[Frames may be missing, no binary loaded for kernel32.dll]	
 	kernel32.dll!00007ff91adce8d7()	Unknown

[Image Removed]

[Attachment Removed]