ID3D12GraphicsCommandList::Reset can take long time sometime.

Started by
3 comments, last by Gnollrunner 6 months, 1 week ago

I was developing game using Unreal Engine 5.2, in some test I found ID3D12GraphicsCommandList::Reset can take very long time to execute(about 80ms). Does anyone have idea about what happen?? GPU is RTX2070 Super, newest driver, Windows 10.

Advertisement

Just looking at its doc here, on Remarks, it says “… Unlike ID3D12CommandAllocator::Reset, you can call Reset while the command list is still being executed. A typical pattern is to submit a command list and then immediately reset it to reuse the allocated memory for another command list.”

Just my assumption, maybe the command list is still executing when the reset happen, and that it has to wait? if it does, maybe there's a cost of resetting such command list to have it back to initial state? Not sure if the size of the commands related to the command list matters either. That's all I can think of based on that statement, I could be wrong, though.

@arly Thanks for your suggestion. Actually, I have try to reconstruct command list and allocator reuse mechanism, make it the same as example of d3d12. Make command list and command allocator a pair, one command allocator just used by one command list, only put them into pool after GPU fence signal they were finished, reset both of them before reuse. But it still can have this problem, though the chance this problem happen have become lower.

You should be able to reset it and reuse the list near instantly. There are actually two things to worry about however, the ID3D12GraphicsCommandList and the ID3D12CommandAllocator. Resetting the list should be no problem. I use the same list for each sequential frame. That being said, the allocator cannot be reset until a frame is finished. What I do is have an allocator for each frame slot. So for instance, if I allow three inflight frames, I have three allocators. Also, you need an allocator when resetting the command list so it might be the case that if the allocator isn't finished resetting, it waits in the command list reset. I'm just guessing though. Having more inflight frames, each with its own allocator, may help with this. In my system I made it configurable.

I had no clue you even deal with DX12 using Unreal. Probably you would need to look at the rest of the code to figure out what's going on.

This topic is closed to new replies.

Advertisement