Why is the Nanite VRAM Cache hardcoded to NVIDIA 2GB vs AMD 4GB?

Hi!

I recently fought with high VRAM usage. Weirdly, my nvidia PC uses 6GB VRAM while the AMD PC uses 8GB. While investigating using the resource viewer tool, I got interested in the Nanite ClusterPageData buffer. I couldn’t reduce it by CVAR so I took a look into the engine code.

UE allocates 4GB by default on AMD cards instead of 2GB everywhere else.

Now I am just wondering. Why is this hardcoded and why do AMD cards get 2GB VRAM per default more?
Not saying that this is wrong. But I would like to gain insight to the reasoning for this.

NaniteStreamingManager.cpp on UE5.6:

Have no idea why 2 vs 4 gb, but when i try to get answers for something like this i usually just go to UE github and look for related commits history.

These lines were added in this commit in UE5.4 : https://github.com/EpicGames/UnrealEngine/commit/bccf39e9bcd4c8a3afd05fefaa9acfc7511481ab

“Implemented support for Nanite streaming pool larger than 2GB when it is supported by the hardware.”

In UE 5.7 it was changed a bit because of VulkanRHI implementation with a comment “VulkanRHI: Make sure the Nanite Streaming Manager doesn’t allocate a buffer beyond the device’s limits.”

So i guess it’s just a hardware thing and AMD somehow can support more than 2 gb while others can’t, otherwise epic wouldn’t add that.

https://github.com/EpicGames/UnrealEngine/commit/732f00d844ac50860d0b6fc630ea980b82de1e19

And in UE 5.5 there was this commit :

https://github.com/EpicGames/UnrealEngine/commit/c5b2ebada8b850a6780297fa907b0562c665b2b1

“Added the ability to resize the Nanite streaming pool dynamically using r.Nanite.Streaming.StreamingPoolSize.

Added command to reset the streaming pool state, so all streaming data will be loaded again (r.Nanite.Streaming.ResetStreamingPool).”

And description of r.Nanite.Streaming.StreamingPoolSize Cvar was changed by adding this line at the end "Size of streaming pool in MB. Does not include memory used for root pages. Be careful with setting this close to the GPU resource size limit (typically 2-4GB) as root pages are allocated from the same physical buffer.”

So i would play around wih “r.Nanite.Streaming.StreamingPoolSize”, “r.Nanite.Streaming.NumInitialRootPages”, etc to see what can reduce it / fit better for your use case.

2 Likes