Nvidia Shader cache limit is causing my games stutter badly

Discussion in 'Videocards - NVIDIA GeForce Drivers Section' started by MonicaWeiss010, Aug 14, 2020.

  1. MonicaWeiss010

    MonicaWeiss010 Guest

    Messages:
    8
    Likes Received:
    3
    GPU:
    rtx2070
    Just searched for the issue, I find out the shader cache will purge itself when exceeding a limit, for me it is around 600mb. I have many games in my PC, after some testing it shows Mass Effect Andromeda generates around 200mb cache, Star Wars Battlefront 2 generates 300mb and Battlefield V generates 400mb, which means every time I launch one of these games after the other, the shader is purged, resulting in massive stutter for 5 to 10 minutes... This is a dumb situation. I've noticed that in May 2020 it was said the DEVs were planning to improve the shader cache function, now is already half past Aug.. I really hope this issue can be solved as soon as possible. It would be helpful If Nvidia can let users to control the size of NV_Cache folder .
     
    JonasBeckman likes this.
  2. Astyanax

    Astyanax Ancient Guru

    Messages:
    16,998
    Likes Received:
    7,340
    GPU:
    GTX 1080ti
    The nv_cache isn't used for DX12.
    DX11 titles uses async shader compilation natively, it shouldn't stutter badly even with the cache off.
     
  3. bobblunderton

    bobblunderton Master Guru

    Messages:
    420
    Likes Received:
    199
    GPU:
    EVGA 2070 Super 8gb
    If you're writing anything to the drive, and you haven't cleanly restarted the computer at some point (power failure, BSOD crash, hardware failure), you could be incurring extra latency with every write. This is due to having a 'dirty' disk with bits of lost or unaccounted-for files and such.
    If you're running Windows off a hard drive, this is to be considered normal and you may not need to do this stuff at all. A solid state drive should never really have long lag times unless it's cheap, or broken/misconfigured in some way.

    Save your work in your open programs before continuing. Open an administrator command prompt, and type in "CHKDSK /F C:" and press enter. This assumes your drive is c: You do not need to type in the quotes. Press Y and hit enter when/if it asks you to do this upon next restart.
    Then either manually restart or type in "shutdown -r" to force the machine to restart in 60 seconds if that is what it needs to do, and the work should continue at restart. This work could take 10 seconds to a few minutes on an SSD depending on the hardware that comprises it, and how expensive and new it is (speed of it), and how full it is. Hard drives could take a half hour or more if they're what you're running off of.
    After the computer has 'finished repairing drive c:' then you will see it restart, and then you should finally be able to log back in and resume whatever you were doing.

    You only need to do this if you have an unplanned restart / shutdown at some point. To tell if it needs to be redone just run benchmarks that use the disk, if you notice write speeds that are half or less what they're supposed to be (reads aren't normally affected as much), consider taking the time to run this.
     
  4. Astyanax

    Astyanax Ancient Guru

    Messages:
    16,998
    Likes Received:
    7,340
    GPU:
    GTX 1080ti
    where do you people come up with this nonsense, that is NOT how any of this works.
     

  5. aufkrawall2

    aufkrawall2 Ancient Guru

    Messages:
    4,251
    Likes Received:
    1,758
    GPU:
    7800 XT Hellhound
    Yes, it is.

    Some titles like The Witcher 3 do.
     
  6. Astyanax

    Astyanax Ancient Guru

    Messages:
    16,998
    Likes Received:
    7,340
    GPU:
    GTX 1080ti
    Bah, right, it slipped my mind again.

    The Background optimizations that was added to 19h1 and supporting drivers.

    Prior to that you got the games dx cache or nothing

    I'll have to reinstall.... I don't recall there being any serious stutter.
     
  7. Smough

    Smough Master Guru

    Messages:
    983
    Likes Received:
    302
    GPU:
    GTX 1660
    This could happen when you clean-install a new driver and some games have to rebuild the cache, TW3 will stutter badly with a fresh driver install for a good while and probably some others games too. Other games seem to cache their stuff on their own files, so countless driver changes don't even affect them one bit and other games may stutter a few seconds when you start them and then they just settle down just fine. You still haven't answered if you use a HDD or not, so we cannot know if that could be the cause of your stutter, a HDD will slow things down, moreover considering games on PC are not even close to being optimized like in a console and even more if its not a very fast HDD.

    Battlefront 2 never really stutters (but for some reason seems to do it at Windows 1809 sometimes and at 1803 didn't so it worries me and I am unsure if I must try an older version of Windows to stop this behavior) for me and I never played ME: Andromeda, the game got rid of Denuvo, so I don't see why it should stutter.

    So is this normal? Well, it's expected, but if it happens extremely often, could be something in your system.
     
    Last edited: Aug 15, 2020
  8. CalinTM

    CalinTM Ancient Guru

    Messages:
    1,684
    Likes Received:
    18
    GPU:
    MSi GTX980 GAMING 1531mhz
    Where I can clean this cache? Where it's located?
     
    mapnam charun likes this.
  9. mapnam charun

    mapnam charun Member

    Messages:
    38
    Likes Received:
    8
    GPU:
    GTX 550 Ti 1024 MB
    located at "C:\ProgramData\NVIDIA Corporation\NV_Cache".
     
  10. Astyanax

    Astyanax Ancient Guru

    Messages:
    16,998
    Likes Received:
    7,340
    GPU:
    GTX 1080ti
    @ManuelG you mentioned there was considerations being collected for future improvements?

    1GB seems a bit too small, considering the sizes that DX12 shaders get to.
     
    MonicaWeiss010 likes this.

  11. JonasBeckman

    JonasBeckman Ancient Guru

    Messages:
    17,564
    Likes Received:
    2,961
    GPU:
    XFX 7900XTX M'310
    4 GB perhaps, HDD size and games like Borderlands 3 or Horizon at 1 - 2 GB with Horizon Zero Dawn's 2 GB I guess getting cleaned out every time this runs if the limit is 1 GB and the devs stated the cache can be up to almost 2 GB although that would depend on in the driver cache size actually hits this value or if it's just a part of the full cache the game creates.

    You'd still have the Windows 10 cache though and the games own pipeline / cache so the driver one could be rebuilt faster from having those still available. :)
    (Well the OS and driver caching should be faster as long as the games initial cache is still available and not invalid or damaged/incomplete/otherwise corrupt.)

    And the OS shader file path would be this:
    C:\Users\USERNAME\AppData\Local\D3DSCache\

    And then usually a folder name as a collection of random numbers and letters changing with driver and OS updates. D3D12 cache and stuff like UWP apps far as I can tell, never seen this get populated from running a D3D11 title but something like Borderlands 3 will dump about 100 MB here.
    (Curious what exactly it does cache when the games own cache is over 800 though this varies from game to game where that is stored and then the driver cache for AMD and NVIDIA also.)


    EDIT: Or just make it configurable it seems the simplest like a page file...for shaders.
    (Or not, this one doesn't pseudo-magically make the entire system faster - or so claim are made. - by disabling it entirely. :p )

    It's not really like a page file just to clear that up.



    EDIT: Interesting to read about this too, always fascinating to learn more.
    (AMD user here though, there's some similarities but also some differences between each vendor and certain supported features and functions.)


    EDIT: Actually a per-game limit instead and a option to clear the cache for troubleshooting reasons unless it already exists might be better. 1 - 2 GB per game and it'd be invalidated and cleared on driver updates as required giving users a way to clear it manually sounds like a method but maybe a total size limit could also be useful to have at some higher value now that newer games are making larger shader caches.
    (~In addition to a SSD and some fancy file system improvement where these don't take forever anyway ha ha.)
     
    Last edited: Aug 15, 2020
  12. aufkrawall2

    aufkrawall2 Ancient Guru

    Messages:
    4,251
    Likes Received:
    1,758
    GPU:
    7800 XT Hellhound
    Behavior might be different with AMD, so far no D3D12 game has increased the size of my DxCache folder, only D3DSCache. This was different with Nvidia, at least with Borderlands 3.

    There btw. was already this thread in which ManuelG said the purging behavior would be improved in the future:
    https://forums.guru3d.com/threads/i...crease-the-size-of-nvidia-cache.431234/page-4
    It's taking very long, unfortunately.

    Nvidia Linux driver offers to turn off purging via __GL_SHADER_DISK_CACHE_SKIP_CLEANUP variable...
     
  13. Cyberdyne

    Cyberdyne Guest

    Messages:
    3,580
    Likes Received:
    307
    GPU:
    2080 Ti FTW3 Ultra
    Easy way to clear the Windows generated DX12 cache
    Capture.PNG
     
    Maddness and HandR like this.
  14. MonicaWeiss010

    MonicaWeiss010 Guest

    Messages:
    8
    Likes Received:
    3
    GPU:
    rtx2070
    I'm using a SN750 NVME. All 3 games run in Dx11, every time I start them, CPU usage burst into 100 percent for at least 5minutes, at the same time the game builds shader cache in NV Cache folder. BFV generates over 400mb files in NC Cache. Then I switch to STBF2, it generates 300mb, as soon as the NV Cache folder becomes 600mb, it purges itself. So after playing STBF2 for 30 minutes, the size of the folder becomes 300mb. Then I switch to BFV, it will start building shader cache all over again, resulting in bad stutters.....After several matches BFV is smooth cuz its shaders are complete, but the folder size becomes 400mb, the shaders which is built by STBF2 is purged.
     
  15. Smough

    Smough Master Guru

    Messages:
    983
    Likes Received:
    302
    GPU:
    GTX 1660
    CPU 100% for a while? That's strange, the games I play don't do that.

    "I start them, CPU usage burst into 100 percent for at least 5minutes".

    I am afraid to say that something is really missconfigured on your system.
     
    Last edited: Aug 17, 2020

  16. Smough

    Smough Master Guru

    Messages:
    983
    Likes Received:
    302
    GPU:
    GTX 1660
    Funny, I never had that folder. Are you sure it's there?
     
  17. Astyanax

    Astyanax Ancient Guru

    Messages:
    16,998
    Likes Received:
    7,340
    GPU:
    GTX 1080ti
    for now, you can just uncheck the Delete permissions from any of the accounts added to the nv_cache folder.
     
  18. MonicaWeiss010

    MonicaWeiss010 Guest

    Messages:
    8
    Likes Received:
    3
    GPU:
    rtx2070
    Yup, I did that, the folder sure won't delete itself but after exceeding the limit it also stops building shaders.
     
  19. cricket bones

    cricket bones Master Guru

    Messages:
    946
    Likes Received:
    365
    GPU:
    EVGA RTX 3080 FTW
    It's there.
     
    mapnam charun likes this.
  20. aufkrawall2

    aufkrawall2 Ancient Guru

    Messages:
    4,251
    Likes Received:
    1,758
    GPU:
    7800 XT Hellhound
    Yes, that was also my experience. However, with that trick I at least could reach a few hundred MB bigger folder size than without.
    Of course it sucks when you start a new game that is heavily dependent on cached shaders and nothing gets cached at all...
     
    MonicaWeiss010 likes this.

Share This Page