Search Unity

Unity not using all GPU RAM

Discussion in 'General Graphics' started by Marco-Playable, Jun 23, 2021.

  1. Marco-Playable

    Marco-Playable

    Joined:
    Nov 12, 2020
    Posts:
    53
    As part of a shader stress test I created a couple hundred 2048x2048 textures that go on billboards and keep adding more to the scene until the framerate tanks. The graphics card I am testing this on is an nvidia 1650 with 4GB of VRAM.
    Everything behaves as expected with linear increases as I load more textured quads into the scene up until I reach 3.1GB of VRAM used. At that point the VRAM usage remains fixed at those 3.1GB and instead the "Shared GPU memory" usage begins to climb up. Because that means textures now get swapped in/out of VRAM all the time resulting in terrible performance.
    Screen resolution is 1920x1080 so I understand that the nvidia driver would hold on to maybe 100MB for its own buffers, but almost 1GB of unavailable RAM seems excessive.

    In the attached image you can see the growth in the top chart up until the last 4 columns where it switches to shared memory.

    Questions: Why don't all 4GB of GPU RAM get used? Is this a Unity or nvidia thing?
     

    Attached Files:

    • 3GB.PNG
      3GB.PNG
      File size:
      15.2 KB
      Views:
      303
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    This isn't anything Unity has control over. All it can do is hand assets off to the graphics API and it handles all of the GPU memory allocation.
     
  3. Marco-Playable

    Marco-Playable

    Joined:
    Nov 12, 2020
    Posts:
    53
    Okay, then why is the driver "reserving" 900MB?
    I am not questioning that some overhead is involved, just the amount here seems odd- almost 25% of RAM is unused as far as I can tell. Of course nvidia dev support being what it is I am not getting answers from them either.
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,352
    * shrug * No idea. The only ones who know the answer to that question is Nvidia, and as you already said, you're not going to get any answers from them.
     
  5. Marco-Playable

    Marco-Playable

    Joined:
    Nov 12, 2020
    Posts:
    53
    I did a bit more research:

    Windows 7/8 make all VRAM available. Windows 10 originally "reserved" 20% of VRAM. Then in the February 2021 patch they changed it so that Windows usually reserves 900MB instead.
    At this point I would call this a bug in Windows. However, supposedly nvidia's workstation drivers allow an override which is not available in their GameReady drivers. So 50/50 blame ?
     
  6. MiladZarour

    MiladZarour

    Joined:
    Mar 21, 2021
    Posts:
    4
    I have the exakt thing here
    I used 7 / 8 gb
    and I have shared memory which is used just 1 / 32 !!!!!!
    and my game that I created is not smooth , so when the game is not smooth then Unity should reserve more from the Shared GPU memory , but it is not , hence that's why the game is no smooth....
    anyone found a solution for this bug ?