Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan: VoxelGI VRAM size estimation is inaccurate #55641

Open
Tracked by #55328
Calinou opened this issue Dec 5, 2021 · 5 comments
Open
Tracked by #55328

Vulkan: VoxelGI VRAM size estimation is inaccurate #55641

Calinou opened this issue Dec 5, 2021 · 5 comments

Comments

@Calinou
Copy link
Member

Calinou commented Dec 5, 2021

Godot version

4.0.dev (2a9dd65)

System information

Fedora 34, GeForce GTX 1080 (NVIDIA 470.74)

Issue description

VoxelGI VRAM size estimation in the editor appears to be too conservative. Actual VRAM usage seems much higher.

In the testing project linked below, these are the VRAM size deltas I measured from my system:

Mode Estimated Actual Estimated → Actual factor
No VoxelGI N/A 0 MB N/A
VoxelGI Subdiv 64 0.25 MB 5 MB 20 times larger
VoxelGI Subdiv 128 2 MB 260 MB 130 times larger
VoxelGI Subdiv 256 16 MB 510 MB ~31.88 times larger
VoxelGI Subdiv 512 128 MB 2260 MB ~17.66 times larger

The delta is measured from the "No GI" VRAM size mentioned in the absolute VRAM usage values below:

GPU has 8192 MB of VRAM.

Engine not running: 750 MB
No GI: 970 MB
64 subdiv: 975 MB
128 subdivisions: 1230 MB
256 subdivisions: 1480 MB
512 subdivisions: 3230 MB

Antialiasing and other effects were disabled, and the project is running at the default window size of 1024×600. All other setting were left to their default values.

It seems there is no singular amplification value that would be reliable in all cases. From the above testing, we can conclude that the average amplification factor across all subdivision sizes is 50. However, the testing project uses mostly horizontal VoxelGI extents, which means the Y axis has 4 times less voxels than in a VoxelGI with fully cubic extents (Y axis as tall as others). This can likely influence the amplification factor.

Steps to reproduce

  • Look at your VRAM usage when the editor is not running (use nvidia-smi on Linux, or any other program that displays VRAM usage). This is the "Engine off" VRAM usage scenario.
  • Create a project with some meshes. Save the scene, then quit to the project list. Run the project. Look at VRAM usage again. This is the "No GI" VRAM usage scenario.
  • Open the project in the editor again, then add a VoxelGI node. Configure some meshes with their global illumination mode set to Baked.
  • Look at the VRAM size estimation. Note that you will currently have to modify the source code and recompile to see the label, as per VoxelGI information label is cut off #53529.
  • Bake VoxelGI. Quit to the project list a second time.
  • Run the project from the project manager (to ensure the editor isn't running at the same time). Look at VRAM usage a third time. This is the "VoxelGI Subdiv 128" VRAM usage scenario.
  • Repeat this operation with higher and lower VoxelGI subdivision sizes.

Minimal reproduction project

test_voxelgi_large.zip

@KoBeWi
Copy link
Member

KoBeWi commented Jun 4, 2022

Is this still valid in newest alpha?

@KoBeWi KoBeWi moved this to To Assess in 4.x Priority Issues Jun 4, 2022
@Calinou
Copy link
Member Author

Calinou commented Jun 11, 2022

Is this still valid in newest alpha?

Yes (tested on 4.0.alpha 1847094). The amplification factor seems similar, and is pretty much always greater than 16 (even when vertical extents are identical to horizontal extents).

@KoBeWi KoBeWi moved this from To Assess to Todo in 4.x Priority Issues Jun 11, 2022
@clayjohn clayjohn modified the milestones: 4.0, 4.x Jan 12, 2023
@JustASquid
Copy link

I've noticed this too. VoxelGI has a large performance impact on one of my targets, and the large VRAM usage feels like it might be the cause. Is the actual VRAM usage for VoxelGI expected to be this high?

@Calinou
Copy link
Member Author

Calinou commented Dec 27, 2024

I've noticed this too. VoxelGI has a large performance impact on one of my targets, and the large VRAM usage feels like it might be the cause. Is the actual VRAM usage for VoxelGI expected to be this high?

What GPU model is it, and how much VRAM is actually being used when the project is run (without the editor running in the background)? If VRAM utilization is below 90%, it's unlikely to be impacting performance. (GPUs generally don't encounter big performance drops until they reach 90% VRAM utilization or so.)

VoxelGI is expected to require a fair amount of VRAM at high subdivision sizes (especially 512). Each subdivision increase will increase the size of voxel data by a factor of 8 (e.g. 512 needs 8 times more memory than 256 to store all the voxel data).

There may still be something off going on, but I doubt it'll be fixed quickly given not many people are knowledgeable with VoxelGI's implementation.

@JustASquid
Copy link

@Calinou

I don't think the editor overhead is a factor, as the GPU memory metrics within the editor change by numbers similar to the original issue posted when voxelGI is enabled/disabled. i.e. with a single 512 subdivision instance I was seeing 2.3gb of memory usage, without it, 0.3gb. From skimming the literature it does seem that VoxelGI in general is expected to use a lot of memory however since it uses a sparse voxel octree, estimating the memory usage may be more difficult than a simple calculation?

I'm still evaluating voxelGI for my project but if I do end up using it I will definitely be looking into this issue in more detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants