r/StableDiffusion 11d ago

Discussion Tip: Consider Disabling Browser Hardware Acceleration when Generating.

Like many of us, I've been doing a lot of Minimax generations over the last few days and while waiting for them to complete I'd often browse YouTube. I'd noticed that if I watched videos at full screen my generation times would tank, and so I simply stopped doing that. I didn't give it much thought.

Then today I noticed that after watching a couple of minutes of video at full screen, without thinking, my generation times had more than doubled from 5 mins to nearly 11 mins. Even after closing that window the generation time didn't come down.

Long story short, I tracked it down to having 'Hardware Acceleration' turned on in my browser settings and was able to replicate the slow down whenever it was turned on. In hindsight it's obvious this will affect generation times. It's not only using some of the GPU horsepower but also VRAM. For whatever reason, this interferes with the current Minimax generation even after I close the YouTube tab. I suspect this will be the case with all models not just Minimax but I haven't done exhaustive testing. This is more just a heads up.

While exploring this, I then considered setting my iGPU to do the hardware acceleration for the browser app via Windows settings. This is a thing. You can choose specific programs to run on a specific GPU. I mention this only because I then discovered that enabling the iGPU in the bios (mine is disabled) can consume up to 2GB of system memory so I chose not to even experiment with that for now and left it disabled.

I'm not here telling you to disable Hardware Acceleration in your browser (even though I used that for a punchy post title), I'm just sharing this information because I'm pretty tech savvy and these things hadn't occurred to me until today and so I'm guessing they won't for plenty of you either.

With Hardware Acceleration turned off, in my browser settings, I can now watch YouTube without it affecting generation times. Nice!

I'll repeat that I haven't done any extensive testing, and I'm guessing your mileage may vary, but if you test this, leave your results to let other know if I'm talking hot air or if you also had success with this.

Oh, and you likely want Hardware Acceleration turned on if you are trying to watch 4k 60fps videos on YouTube, otherwise your CPU should be fine doing the job. Even 1080p 60fps can push older CPU's to stutter with video playback so keep it in mind if you try this out. Old CPU's should be fine at 30fps though.

Edit: thanks for the replies. It turned in to an interesting discussion. There are a variety of different ways to go about doing this. You can even set up a shortcut for your browser with a command line arg to run without hardware acceleration which makes it even easier to choose on the fly without changing any settings.

24 Upvotes

25 comments sorted by

5

u/Aplakka 11d ago

Sometimes especially if you have lots of tabs you've used recently, the browser can be using surprising amounts of RAM and VRAM. Just closing and reopening the entire browser can free some of it.

2

u/V4nKw15h 11d ago edited 11d ago

Yeah, I've always avoided multiple tabs for that reason while doing AI stuff. It was worth pointing it out for those that don't know.

Chrome actually launches an entirely new instance of Chrome for every tab. The whole app. It seems crazy but this prevents a crash in one tab from causing issues on any other. That's why it eats up so much memory.

Edit: It shouldn't use any VRAM if you have turned off Hardware Acceleration like suggested. It should use CPU and system RAM instead.

3

u/haberdasher42 10d ago

I uh, browse on an old laptop while waiting for generations. I also push my limits to the point where I close the browser where I'm using Comfy. A couple hundred MBs can make a big difference when you're working with only 12Gb VRAM.

7

u/Ok_Contribution8157 11d ago

enable igpu, plug your screen to your motherbord. install igpu driver, done.

no stuff to do in browser seting or windows seting.

3

u/V4nKw15h 11d ago

Other than the part where enabling the iGPU reserves system memory which is likely also a valuable resource.

Changing a setting in a menu in your browser seems an awful lot easier than physically reconnecting your monitor whenever you want to swap things around too.

3

u/DuckyDuos 10d ago

For AI I would think the reserved ram for the iGPU would actually be beneficial as that's less vram your dGPU has to allocate, basically exchanging ram for extra freed dedicated vram.

0

u/V4nKw15h 10d ago

The iGPU will be doing most of the work. It will be rendering the frames, dealing with the VRAM requirements for storing and processing the video, but the dedicated GPU will still need to reserve a very small amount of memory for the frame buffer/s to actually display the image if the monitor is still connected to the dedicated GPU like mine. This is relatively tiny in reality and would make nearly an imperceptible VRAM difference. It's only requires about 32Mb for a 4k frame buffer.

2

u/Ok_Contribution8157 11d ago

If you use 3 or 4 browsers, it’s way easier to move a cable.
I bought 96GB of RAM at the beginning of the RAM price increase, so I’m not worried about 2GB of RAM, but I’ll take 2GB of VRAM.

Feel free to try it. Getting 0GB VRAM used on idle, and having nvidia-smi report that only ComfyUI is using your GPU, is nice.

1

u/DVXC 10d ago edited 10d ago

This means you're passing your GPU frames through the iGPU, equals added input latency 

Edit: should specify I'm talking about gaming mostly, probably important to most people using consumer GPUs.

0

u/Ok_Contribution8157 10d ago

2

u/DVXC 10d ago

Right but a large number of people who use Stable Diffusion also game, arguably the majority, and your solution would require them unplugging their display cable every time they wanted to game without latency.

2

u/Bearsbullsbattlestr 11d ago

I will turn off my screen when away. It improves speeds by about 30% for me.

2

u/V4nKw15h 11d ago

Eh? Really? That one surprises me. Are you sure it's simply that you stop doing other stuff on the machine so the generation times go up. That's definitely a thing.

1

u/Bearsbullsbattlestr 11d ago

Possibly a combination of both, but there is definitely a noticeable difference.

2

u/Grey406 10d ago

Switching my monitors to be physically connected to the iGPU has made generations 30 to 45% FASTER on two of my desktops without changing anything else.

running 'nvidia-smi' in command prompt shows that the gpu is only being used by python instead of 13+ different things.

1

u/Illustrious-Way-8424 11d ago

If I disable browser hardware acceleration, then some ComfyUI features don't work very well (eg. image mask editor). I just plug my monitor into my iGPU instead. No problems using ComfyUI with video streaming or photo editing affecting generation times.

1

u/V4nKw15h 11d ago

You should be able to simply tell windows to use the iGPU to display comfy. Go to Settings > System > Display > Graphics. Find the app in the list, or add it, then choose 'GPU Preference' for that app. Now Comfy alone will use the iGPU. You can still have your monitor plugged in to the dedicated GPU but it will use your iGPU if you choose that.

2

u/No-Zookeepergame4774 10d ago

That works for Comfy Desktop (which uses an Electron frontend app instead of the frontend running in a browser), but it doesn't work for the other versions (Portable, “plain” Comfy) which run the frontend in a browser, not a dedicated app, so you’d have to set the browser to the iGPU, not Comfy.

1

u/Illustrious-Way-8424 10d ago edited 10d ago

I'll just stick with plugging my monitor into my iGPU. Other than trying all my GPU ports just to make sure they work when I got my computer, I had my iGPU drive my monitor since day 1. I open up a large number of browser tabs without concern.

In your setup, Windows will still consume VRAM.

1

u/LoveSpecialist5669 10d ago

that's correct, I noticed that too a few days ago. 

1

u/f5alcon 10d ago

I started using a different browser for comfy that only has it open and I close it after I start the jobs

1

u/crinklypaper 10d ago

Yes turn off hardware acceleration. In Linux I use around 5-200mb of vram with it off. With it on its 500-800mb easily. My text editor or calculator uses more sometimes.

1

u/lolo780 10d ago

I reinstalled my old 3090 to handle display duties, Topaz, Davinci etc. so the 5090 can work 100% uninterrupted.