Nvidia Shadercache setting.

Discussion in 'Videocards - NVIDIA GeForce Drivers Section' started by Smokey25, May 1, 2022.

  1. Shadowdane

    Shadowdane Maha Guru

    Messages:
    1,464
    Likes Received:
    91
    GPU:
    Nvidia RTX 4080 FE
    RDR2 has pre-compile shaders. If you delete the old shader files it will recompile them on launch.
     
  2. Horus-Anhur

    Horus-Anhur Ancient Guru

    Messages:
    8,638
    Likes Received:
    10,689
    GPU:
    RX 6800 XT
    So I tried disabling the nVidia shader cache for a few days.
    And played several games, like Detroit Become Human (Vulkan), Insurgency Sandstorm (DX12), Civilization VI (DX12), The Forgotten City (DX12) and some UE5 tech demos.
    I didn't do any benchmarks, just gamming, but I fell like you are right about disabling the nVidia shader cache and getting less hitching in games.
     
    cucaulay malkin and BlindBison like this.
  3. venturi

    venturi Master Guru

    Messages:
    517
    Likes Received:
    341
    GPU:
    2x 4090 FE RTX
    On the Forgotten City I was getting severe hitching on the upper temple, by the lake, and the cistern. With shader cache disabled the hitching went away.
    Detroit Become Human has hitching regardless, but a lot less hitching with shader cache disabled.

    RDR2 (vulkan) and B3 pre load their own, while it should be transparent and unrelated, the shader cache on gives some hitching, but drops the benchmark in B3.

    Side note about B3, on my system the Resizable Bar ON in the default game profile, gives a lot of stutter and hitching, disable in inspector/profile the B3 Resizable Bar and there is substantial improvement, disable shader cache and the improvements continue.

    RDR2 is already resizable bar enabled.
     
    BlindBison likes this.
  4. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,414
    Likes Received:
    1,139
    GPU:
    RTX 3070
    Thank you for this advice, it does seem to help with The Forgotten City weirdly -- that's a tweak I had forgotten to try out before.

    I have no idea why this is, I would think you would want the shader cache to be on and that it would help with stuttering, not increase it. Very weird.

    After all, how does the game cache its shaders if this setting is OFF? I would love to have more insight into what's actually going on with these stutters and why this seems to help.
     
    Last edited: May 26, 2022

  5. Horus-Anhur

    Horus-Anhur Ancient Guru

    Messages:
    8,638
    Likes Received:
    10,689
    GPU:
    RX 6800 XT
    Since the game is doing it's own cache, it might conflict with nVidia's cache.
    Creating, reading and writing two shader caches is redundant.
     
    BlindBison and venturi like this.
  6. wrobles3D

    wrobles3D Member

    Messages:
    45
    Likes Received:
    2
    GPU:
    GTX 1650
    Does anyone know if this affects emulators? and Emu's that create their own shader cache?, I've never considered if disabling shader cache for the emu via the control panel makes any difference.
     
  7. PapaJohn

    PapaJohn Master Guru

    Messages:
    402
    Likes Received:
    136
    GPU:
    Asus 6700XT OC 12Gb
    Don't get any stutter in Detroit, none in Forgotten City and have my Shader Cache set to unlimited. In fact, I get zero stutter in most games. Even Elden Ring, when it goes under 60, no stutters. Previously had a system where I could notice a lot of stutters. I only have normal Sata SSD with the OS on it, a sata SSD for some games and an 8TB external WD drive. Most games are on the 8TB drive.

    It genuinely interests me what can cause these stutter issues on some systems and yet others don't display any issues.
     
  8. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,414
    Likes Received:
    1,139
    GPU:
    RTX 3070
    What CPU + RAM do you have and what is your RAM frequency / timings?

    One common thread I've seen seems to be that running Zen2 without very fast memory can result in this type of behavior. I'm just speculating mind you, but that's my "guess" off the top of my head.
     
  9. PapaJohn

    PapaJohn Master Guru

    Messages:
    402
    Likes Received:
    136
    GPU:
    Asus 6700XT OC 12Gb
    I have a really simple, no thrills setup. 5700X with a 150 boost, 32Gb 3200 DDR4@3200 Cl16.
     
    Last edited: May 25, 2022
    BlindBison likes this.
  10. venturi

    venturi Master Guru

    Messages:
    517
    Likes Received:
    341
    GPU:
    2x 4090 FE RTX
    I
    I'm not certain that's the case: I'm on xeons 8280L, lots of fast ram, dual GPUs, very fast drives - shader cache stutters are common, have me getting much better performance with shader cache disabled. In fact, -other than some crappy titles- I don't see the stutter with shader cache off. But if I turn it on, (especially on unlimited), I do see the stuttering.
    Now, with every driver update I just disable shader cache. --Sometimes, from curiosity, I turn it back on, -and then promptly get reminded why I had it off.

    Maybe its more mundane an issue: resolution settings, game engine written very specific for resources, more resources than the game engine can see/handle, maybe algorithm was written to take care of the majority of systems, but leaving the minority as the exception, where the median receives the benefits while he other increments of the curve are acceptable casualties.
    Hence, shader cache only benefits most systems at a certain threshold.
     
    Last edited: May 26, 2022
    BlindBison likes this.

  11. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,414
    Likes Received:
    1,139
    GPU:
    RTX 3070
    It's a shame you can't change the Nvidia cache setting on a per profile basis. Same with NIS, would be nice if we could set these things per profile, but alas.
     
    tensai28 likes this.
  12. PapaJohn

    PapaJohn Master Guru

    Messages:
    402
    Likes Received:
    136
    GPU:
    Asus 6700XT OC 12Gb
    The only game I'm aware of that has shader cache off by default in my collection is SOMA which is enforced by Nvidia as it has negative effects when on. Everything else I have it globally on with no issues. It's bizarre.

    @BlindBison You can turn it off or on for each game within Inspector can't you?
     
    BlindBison likes this.
  13. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,414
    Likes Received:
    1,139
    GPU:
    RTX 3070
    I'll have to check if it can be done with Nvidia Inspector, thanks -- I'm not sure off the top of my head. I don't have it downloaded presently since I wasn't using the advanced features it offered really for much, but if you can actually disable the shader cache per-app with it, then it's probably worth having. Thanks for the heads-up.

    The reason why I care about doing it per app is because "usually" you do want it enabled/on globally from what I understand and turning it off globally I assume wipes out whatever shaders have already been cached/disables the shader cache in games that really need it.
     
    PapaJohn likes this.
  14. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,414
    Likes Received:
    1,139
    GPU:
    RTX 3070
    @Horus-Anhur @venturi To test this out, I would like to leave the Shader Cache ON globally and then just switch it OFF as a test for specific game's. With Nvidia Profile Inspector then, is this the correct setting to switch OFF? upload_2022-5-26_13-55-54.png
    Under [Common -> Shadercache -> On]? My aim is to just flip it off for the specific title, not globally. I just wanted to double check this was the correct setting to flip/apply since in the standard control panel they list it more like "shader cache size" so the name isn't quite the same. Thanks!

    Sadly unlike V-Sync you can't really check in the standard control panel if the thing has truly been applied (for example if you enable half refresh v-sync of the non-adaptive variety in nvidia profile inspector it will show as "custom" for V-Sync in the standard control panel so you can verify it's actually been applied in that way -- I don't think you can verify in the same way for the shader cache given it's not listed per profile only globally).

    I'm still very perplexed as to why this would ever improve/reduce stuttering -- if game's truly are doing their own thing for shaders separate from Nvidia's own shader cache then why hasn't Nvidia (or the developer?) set a flag on their own for the game's profile? It just seems really weird/like a strange oversight. Makes me wonder if we're accurately/correctly grasping the "why" behind the behavior we're seeing for these specific cases, I dunno. In any case, if one tests this per profile and it helps then it helps ¯\_(ツ)_/¯ What do I know.
     
    Last edited: May 26, 2022
  15. venturi

    venturi Master Guru

    Messages:
    517
    Likes Received:
    341
    GPU:
    2x 4090 FE RTX
    To test, please delete the cache files before /after or it may cloud the test


    And we have all asked why it occurs for some and under certain conditions. - It may be that a system is faster at doing it the normal way than the caching way where the pre and co-caching in the moment is slower than just direct. Just speculating based on observations so far and on my rig, kids and the wife's PC. maybe its the fact we use server 2022, maybe its the configuration, or maybe its random. All my testing was done between OFF and On/Unlimited.
     
    BlindBison likes this.

  16. aufkrawall2

    aufkrawall2 Ancient Guru

    Messages:
    4,359
    Likes Received:
    1,821
    GPU:
    7800 XT Hellhound
    Did you try with virus scanners disabled? It might stall writing/access to changed files.
     
  17. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,414
    Likes Received:
    1,139
    GPU:
    RTX 3070
    Aah, that's a good idea about wiping the shaders between testing -- I did not do that before. In that case what I'll try is clean reinstalling the driver (to wipe the shaders) then disabling shader cache with nvidia profile inspector for the current game (or, I suppose if it's just for testing I could do so globally thinking on it).
     
  18. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,414
    Likes Received:
    1,139
    GPU:
    RTX 3070
    The only anti-virus I have is windows defender and I've disabled pretty much everything it will let me. Thinking on it I do think there are some lists you can add specific apps to to exclude them from defender's scans/stuff though.
     
  19. BlindBison

    BlindBison Ancient Guru

    Messages:
    2,414
    Likes Received:
    1,139
    GPU:
    RTX 3070
    It's an extremely common problem with Unreal Engine 4 on PC for whatever combination of reasons. If you follow Digital Foundry at all, basically every single UE4 game they've covered in recent times has either Asset Streaming stutter, Shader compilation stutter, or both.

    I have no idea if it's the devs at fault or EPIC, but it's such a pervasive issue on PC with that engine that I'm thinking maybe EPIC needs to fix something on their end and/or at least make it very very clear to developers that this is a problem and what best practice is to resolve it.

    But, if it happens even in EPIC's own in-house games like Fortnite then that doesn't give me a lot of hope. Interestingly I never experience any of these issues when playing the console version's of these UE4 games. I kinda hate how PC often gets treated like a second class citizen to the consoles if I'm honest.

    I recognize that you can't hard code your games in the same way you can for a fixed platform but writing generic scalable code for PC is definitely possible (and it's been done in many modern PC games at that), but the porting effort just doesn't seem to be there often times and we're left with a stuttery mess to deal with.

    Stuttering is, in my mind, the single greatest evil in gaming and it needs to taken more seriously by developers. I would much prefer an approach to asset streaming like the original RAGE had where vague silhouettes of surfaces/objects appear first and the rest draws in when it can to hitching/stuttering and the whole shader compilation thing should just be solved at startup like Horizon Zero Dawn or MW 2019 imo. I know I'm ranting here, it's just such a head ache troubleshooting stutter in PC games, drives me nuts lol.
     
  20. venturi

    venturi Master Guru

    Messages:
    517
    Likes Received:
    341
    GPU:
    2x 4090 FE RTX
    To delete the cache files just change setting in nv control panel to disabled, and then stop the container service, sometimes it requires a user sign-out and login. This takes seconds vs a whole driver reinstall
     
    BlindBison likes this.

Share This Page