stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: Addition of "cudnn.benchmark = true" breaks 2080 Ti card with CUDA Out Of Memory

Open MasterZap opened this issue 2 years ago • 8 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

Tried to run latest webui last night. I know it worked some weeks ago so I did a git-bisect. The PR https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/4407 which added the use of cudnn.benchmark = true, and that made my 2080 card give me CUDA out of memory errors.

Steps to reproduce the problem

  1. Use a 2080 Ti Card
  2. Try webui
  3. Watch CUDA memory errors

What should have happened?

It should've worked :)

And it does if I comment out the line that sets cudnn.benchmark = True

Commit where the problem happens

cd6c55c1ab14fcab15329cde599cf79e8d555657

What platforms do you use to access UI ?

Windows

What browsers do you use to access the UI ?

Google Chrome

Command Line Arguments

set COMMANDLINE_ARGS=--server-name=10.100.100.166 --theme=dark

Additional information, context and logs

I think the problem is the line:

if any([torch.cuda.get_device_capability(devid) == (7, 5) for devid in range(0, torch.cuda.device_count())]):

....not sure what it is checking (don't know enough CUDA) but it breaks my 2080 Ti card

MasterZap avatar Dec 11 '22 10:12 MasterZap

@MasterZap I have the same card RTX 2080 Ti and I'm running the latest 685f9631b56ff8bd43bce24ff5ce0f9a0e9af490 commit but not encountering this issue. Maybe there's some way I could help diagnose.

jhogsett avatar Dec 11 '22 16:12 jhogsett

Maybe it's CUDA version related, or maybe driver version related? I'm stuck on a slightly out-of-date driver coz my system runs Windows 8.1 ....

MasterZap avatar Dec 11 '22 17:12 MasterZap

@MasterZap OK that seems probable. I am on Windows 10 with the most up-to-date NVIDIA drivers and Cuda version.

jhogsett avatar Dec 11 '22 17:12 jhogsett

If it's just me, I'm fine with my local workaround. I just wonder, what the heck that line of code is supposed to do :P

MasterZap avatar Dec 11 '22 18:12 MasterZap

@MasterZap I am scratching my head on that as well!

jhogsett avatar Dec 11 '22 18:12 jhogsett

This is expected. This option increases performance by reducing VRAM fragmentation at the cost of increased VRAM usage. You can just comment it out.

aliencaocao avatar Dec 12 '22 03:12 aliencaocao

Could we make it an option, so I don't have to live with a one line local change?

MasterZap avatar Dec 12 '22 07:12 MasterZap

I dont think it should be an option because you can just use the medvram or lowvram switches. The vram overhead this brings is minimal, and it is likely that you have something else also using your vram.

aliencaocao avatar Dec 12 '22 08:12 aliencaocao