carson-katri / dream-textures

Stable Diffusion built-in to Blender
GNU General Public License v3.0
7.78k stars 419 forks source link

4x compute slowdown #652

Closed LukeV1 closed 1 year ago

LukeV1 commented 1 year ago

Description

The new v0.20 build is almost four times slower when generating images on my Nvidia GTX980 Ti (6GB VRAM). That's quite surprising to me, since according to the release notes, speed improvements have been made. At least for me it's the other way around.

Also, I noticed that rendering image with v0.20 slows down the whole PC, even Windows gets pretty sluggish. With the previous version there was no noticeable lag at all.

v0.20 image generation time, 1st run grafik v0.20 image generation time, 2nd run grafik

v0.10 image generation time, 1st run grafik v0.10 image generation time, 2nd run grafik

Steps to Reproduce

  1. generate an image with all set to default (SD 2.1 model) in version v0.10
  2. generate an image with all set to default (same SD2.1 model) in version v0.20
  3. compare results displayed in the blender console

Expected Behavior

According to the release notes the new verison v0.20 should be faster, not way slower.

Addon Version

Windows (CUDA)

GPU

NVIDIA

carson-katri commented 1 year ago

Try disabling SDP attention in the optimization settings. It’s possible it has a negative effect on some cards.

LukeV1 commented 1 year ago

Disabling SDP attention brought the generation time back to its former speed: v0.20 image generation time without SDP attention, 2nd run grafik

so I guess I just have the wrong card to benefit from the optimizations, right?

LukeV1 commented 1 year ago

Well, after checking the changelog, I'm pretty sure the speed improvements aren't working for my card:

As I understand it, xformers was added to speed things up. According to here Xformers - AUTOMATIC1111 this works only for Pascal, Turing, Ampere, Lovelace or Hopper cards. My GTX980 Ti is the last one with a Maxwell core..

LukeV1 commented 1 year ago

I am closing this as it is not a bug but a feature - that is missing for my card type..

carson-katri commented 1 year ago

We didn’t add xformers, but SDP attention is built-in to PyTorch 2 and possibly has those same drawbacks you identified.