5 Ways to Boost Stable Diffusion Performance on Windows
Table of Contents
- Disable GPU Scheduling
- Disable Browser Hardware Acceleration
- Increase GPU Power Budget
- Use Command Line Arguments
- Benchmark Your GPU
- Conclusion
Disable GPU Scheduling to Improve Stable Diffusion Performance
One way to improve Stable Diffusion performance on Windows is by disabling GPU scheduling. This feature allows the GPU to be shared between multiple applications, but can slow things down for AI image generation. Here's how to turn it off:
First, open the Windows search bar and look for 'Graphics Settings'. Click to open the graphics settings window. Next, select 'Change default graphics settings' under Related settings on the right. In the next window that opens, turn off the toggle for 'Hardware accelerated GPU scheduling'.
The last step is to restart your Windows PC. After rebooting, GPU scheduling will be disabled, allowing your GPU to dedicate all its resources to Stable Diffusion for faster image generation.
Locate Graphics Settings
To find the Windows Graphics Settings, open the Windows search bar and type in 'Graphics Settings'. Click on the result to open up the graphics settings interface.
Turn Off Hardware Accelerated GPU Scheduling
In the Graphics Settings window, look under Related settings on the right-hand side. Click on 'Change default graphics settings'. This will open a new window. Turn off the toggle next to 'Hardware accelerated GPU scheduling' to disable this feature.
Restart Your PC
After toggling off GPU scheduling, a restart of your Windows PC is required for the changes to take effect. Make sure to save any open work before rebooting.
Disable Browser Hardware Acceleration for Better Stable Diffusion Performance
In addition to GPU scheduling, browser hardware acceleration can also slow down Stable Diffusion. Turning this off for your browser can provide a performance boost. Here are the steps:
First, open your browser settings menu. For Chrome or Edge, click the three-dot icon in the upper right and select Settings. For Firefox, click the three-line 'hamburger' icon and choose Settings. Next, search for the System or Performance section. There will be a Hardware Acceleration setting you can toggle off.
After disabling hardware acceleration in your browser, make sure to restart it. Once reopened, your browser will no longer use GPU resources for things like rendering and compositing. Combined with disabling GPU scheduling in Windows, you should see faster Stable Diffusion performance.
Open Browser Settings
To access browser settings, locate the main menu icon. For Chrome and Edge it is three dots in the upper right. For Firefox it is three horizontal lines in the upper right, also called the hamburger icon. Click this and select Settings from the menu.
Turn Off Hardware Acceleration
Once in Settings, search or scroll down to locate the System or Performance section. There will be a Hardware Acceleration option that can be toggled off to disable GPU use in the browser.
Restart Your Browser
For hardware acceleration changes to fully take effect, you'll need to restart your web browser. Close all tabs and completely quit out before reopening to ensure no background processes are still running.
Increase GPU Power Limits to Boost Stable Diffusion Speed
Pushing your graphics card's power limits can also translate to better Stable Diffusion performance. Here's how to configure your GPU's power settings:
First, open your GPU's control panel. For Nvidia cards, this would be the Nvidia Control Panel. For AMD, use Radeon Software. Go to the performance or power settings. There should be an option for Power Management Mode or Power Limit. Set this to Prefer Maximum Performance or slide the power limit to the maximum.
Finally, apply any changes made in the control panel and save the new configuration. Your graphics card will now sustain higher power draws and clock speeds, providing more rendering power for AI image generation in Stable Diffusion.
Open GPU Control Panel
Locate and launch your graphics card's control panel software. For Nvidia GPUs this would be the Nvidia Control Panel. For AMD graphics cards, open Radeon Software.
Set Power Management to Prefer Maximum Performance
Navigate to the Performance or Power section in your GPU's control panel. Look for Power Management Mode or Power Limit and set to Prefer Maximum Performance or maximum power limit.
Apply Changes and Save
Make sure to click Apply after adjusting your graphics card's power settings. Additionally, save the changes so they persist after restarting your PC.
Use Command Line Arguments to Optimize Stable Diffusion
There are a variety of command line arguments that can be passed to Automatic1111 to optimize Stable Diffusion in different ways. Here are the steps to add arguments like --medvram or --upcast-sampling:
First, locate the Automatic1111 files on your system. If using Windows, find the webui-user.bat file. For WSL2 or Linux systems, edit webui-user.sh instead. Open this file in a text editor.
Next, scroll down to the line with either set COMMANDLINE_ARGS= or export COMMANDLINE_ARGS=. Add your desired arguments within the quotes, separated by spaces if using multiple. For example, set COMMANDLINE_ARGS="--medvram --upcast-sampling". Refer to the documentation for details on available arguments.
Finally, save the file after adding args, then restart Automatic1111. It will now launch with your optimized Stable Diffusion command line arguments, potentially boosting speed, memory usage, and output quality.
Locate webui-user.bat or webui-user.sh File
On Windows based systems, locate the webui-user.bat file within your Automatic1111 directory. For WSL2 or Linux systems, find the webui-user.sh file instead. This contains startup commands for Automatic1111.
Add Desired Command Line Arguments
Open the webui-user.bat or webui-user.sh file in a text editor. Add any desired command line arguments within the quotes after set COMMANDLINE_ARGS= or export COMMANDLINE_ARGS=. Separate multiple args using spaces.
Save File and Restart Automatic1111
After adding optimizations args, save the webui-user file and close. Then restart Automatic1111 and it will launch using the new arguments.
Benchmark Your GPU to Compare Stable Diffusion Performance
There is a handy GPU benchmarking tool in Automatic1111 that lets you test and compare Stable Diffusion speeds. Here is how to use it:
First, install the System Info extension from the Extensions menu. Click on Available, search for System, then click Install. Next restart the UI so it is activated. Now there is a System Info tab with device data and benchmarking tools.
Go to the benchmark section and click Run Benchmark. Choose from Quick, Normal, or Extensive testing profiles. The tool will measure iterations per second for different batch sizes like 1, 2, 4, etc. Finally, you can submit results to the public database and compare your hardware against others for optimizing.
Install System Info Extension
From the Extensions menu, go to Available extensions. Search for 'System' and click to install the System Info extension. This provides system data and benchmarking capabilities.
Run GPU Benchmark
After activating the System Info extension, go to the new System Info tab. Scroll down to the benchmarking section and click Run Benchmark. Choose Quick, Normal or Extensive profile.
Submit Results and Compare Performance
Once benchmarking completes, the iterations per second at different batch sizes will be shown. You can submit these results to compare your hardware against others for optimization ideas.
Conclusion
Optimizing Stable Diffusion performance on Windows and PC hardware can involve toggling GPU scheduling, disabling browser acceleration, increasing GPU power limits, using command line arguments, and benchmarking your system.
With these various techniques combined, you should experience meaningfully faster image generation times. The community database also lets you compare optimizations across different hardware for further improvements.
FAQ
Q: How do I locate my GPU control panel?
A: The GPU control panel will depend on your graphics card manufacturer. For Nvidia cards, open the Nvidia Control Panel. For AMD cards, use the Radeon Software.
Q: Where can I find documentation on SD command line arguments?
A: Check the links in the video description for documentation on optimized command line arguments for Stable Diffusion.
Q: What batch size should I use for benchmarking?
A: Use the "extensive" benchmark level to test batch sizes 1, 2, 4, 8, and 16 for a thorough GPU performance analysis.
Q: How often should I benchmark my GPU?
A: Benchmark your GPU whenever you make a configuration change like adding command line arguments. This will show if performance has improved.
Q: Can I damage my GPU by overclocking?
A: Yes, overclocking increases wear and can damage your GPU over time if not done properly. Do so at your own risk and research safe overclocking methods.
Q: Why does disabling GPU scheduling help?
A: Disabling GPU scheduling reduces GPU overhead and frees up more GPU resources for Stable Diffusion, improving performance.
Q: How do browser extensions affect SD performance?
A: Too many browser extensions can consume additional GPU/CPU resources. Disable unnecessary extensions when running Stable Diffusion.
Q: Should I upgrade to an RTX GPU for better performance?
A: Yes, RTX GPUs like the 3060 Ti, 3070, and 3080 will provide significantly better performance over GTX GPUs for AI image generation.
Q: Can I run SD on integrated graphics?
A: Stable Diffusion requires a dedicated Nvidia or AMD GPU. Integrated graphics lack the VRAM and compute power needed for reasonable performance.
Q: Why am I getting out of memory errors?
A: Try command line arguments like --medvram or --lowvram to reduce VRAM usage. Or lower your resolution, batch size, or model size.