[How-To] Automatic1111 Stable Diffusion WebUI with DirectML Extension on AMD GPUs (2025)

Prepared byHisham Chowdhury (AMD),Sonbol Yazdanbakhsh (AMD), Justin Stoecker (Microsoft), and Anirban Roy (Microsoft)

Microsoft and AMD continue to collaborate enabling and accelerating AI workloads across AMD GPUs on Windows platforms. We published an earlier article about accelerating Stable Diffusion on AMD GPUs using Automatic1111 DirectML fork.

Now we are happy to share that with ‘Automatic1111 DirectML extension’ preview from Microsoft, you can run Stable Diffusion 1.5 with base Automatic1111 with similar upside across AMD GPUs mentioned in our previous post

[How-To] Automatic1111 Stable Diffusion WebUI with DirectML Extension on AMD GPUs (1)

Fig 1: up to 12X faster Inference on AMD Radeon™ RX 7900 XTX GPUs compared to non ONNXruntime default Automatic1111 path

Microsoft and AMD engineering teams worked closely to optimize Stable Diffusion to run on AMD GPUs accelerated via Microsoft DirectML platform API and AMD device drivers. AMD device driver resident ML acceleration layers utilize AMD Matrix Processing Cores via wavemma intrinsics to accelerate DirectML based ML workloads including Stable Diffusion, Llama2 and others.

[How-To] Automatic1111 Stable Diffusion WebUI with DirectML Extension on AMD GPUs (2)

Fig 2:OnnxRuntime-DirectML on AMD GPUs

1.Prerequisites

2. Overview of Microsoft Olive

Olive is a Python tool that can be used to convert, optimize, quantize, and auto-tune models for optimal inference performance with ONNX Runtime execution providers like DirectML. Olive greatly simplifies model processing by providing a single toolchain to compose optimization techniques, which is especially important with more complex models like Stable Diffusion that are sensitive to the ordering of optimization techniques. The DirectML sample for Stable Diffusion applies the following techniques:

  • Model conversion:translates the base models from PyTorch to ONNX.
  • Transformer graph optimization:fuses subgraphs into multi-head attention operators and eliminating inefficient from conversion.
  • Quantization:converts most layers from FP32 to FP16 to reduce the model's GPU memory footprint and improve performance.

Combined, the above optimizations enable DirectML to leverage AMD GPUs for greatly improved performance when performing inference with transformer models like Stable Diffusion.

3. Automatic1111 WebUI DirectML Extension(Preview)

Follow these steps to enable DirectML extension on Automatic1111 WebUI and run with Olive optimized models on your AMD GPUs:

**only Stable Diffusion 1.5 is supported with this extension currently

**generate Olive optimized models using our previous post or Microsoft Olive instructions when using the DirectML extension

**not tested with multiple extensions enabled at the same time

Open Anaconda Terminal

Open the Extensions tab

Copy the Unet model optimized by Olive to models\Unet-dml folder

  • example \models\optimized\runwayml\stable-diffusion-v1-5\unet\model.onnx -> stable-diffusion-webui\models\Unet-dml\model.onnx folder.

Return to the Settings Menu on the WebUI interface

  • Settings → User Interface → Quick Settings List, add sd_unet
  • Apply settings, Reload UI

[How-To] Automatic1111 Stable Diffusion WebUI with DirectML Extension on AMD GPUs (3)

Navigate to the "Txt2img" tab of the WebUI Interface

  • Select the DML Unet model from the sd_unet dropdown

[How-To] Automatic1111 Stable Diffusion WebUI with DirectML Extension on AMD GPUs (4)

Run your inference!

[How-To] Automatic1111 Stable Diffusion WebUI with DirectML Extension on AMD GPUs (5)

Result is up to 12X faster Inference on AMD Radeon™ RX 7900 XTX GPUs compared to non-Olive-ONNXRuntime default Automatic1111 path.

4. Disclaimers & Footnotes

The information presented in this document is for informational purposes only and may contain technical inaccuracies, omissions, and typographical errors. The information contained herein is subject to change and may be rendered inaccurate for many reasons, including but not limited to product and roadmap changes, component and motherboard version changes, new model and/or product releases, product differences between differing manufacturers, software changes, BIOS flashes, firmware upgrades, or the like. Any computer system has risks of security vulnerabilities that cannot be completely prevented or mitigated. AMD assumes no obligation to update or otherwise correct or revise this information. However, AMD reserves the right to revise this information and to make changes from time to time to the content hereof without obligation of AMD to notify any person of such revisions or changes. GD-18.

Links to third-party sites are provided for convenience and unless explicitly stated, AMD is not responsible for the contents of such linked sites, and no endorsement is implied. GD-98

Testing conducted by AMD as of November 16th, 2023, on a test system configured with a Ryzen 9 7950X CPU, 32GB DDR5, Radeon RX 7900 XTX GPU, and Windows 11 Pro, with AMD Software: Adrenalin Edition 23.11.1, using the application Stable Diffusion 1.5 with Microsoft Olive under Automatic 1111 vs. Default Automatic 1111. Performance may vary. System manufacturers may vary configurations, yielding different results. RS-621

Automatic1111 is an active branch which changes often, so the interfaces and setup may look slightly different depending on when the branch is downloaded.

**not tested with multiple extensions enabled at the same time

ATTRIBUTIONS

THIS INFORMATION IS PROVIDED ‘AS IS.” AMD MAKES NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE CONTENTS HEREOF AND ASSUMES NO RESPONSIBILITY FOR ANY INACCURACIES, ERRORS, OR OMISSIONS THAT MAY APPEAR IN THIS INFORMATION. AMD SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR ANY PARTICULAR PURPOSE. IN NO EVENT WILL AMD BE LIABLE TO ANY PERSON FOR ANY RELIANCE, DIRECT, INDIRECT, SPECIAL, OR OTHER CONSEQUENTIAL DAMAGES ARISING FROM THE USE OF ANY INFORMATION CONTAINED HEREIN, EVEN IF AMD IS EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Copyright 2023 Advanced Micro Devices, Inc. All rights reserved. AMD, the AMD Arrow logo, [insert all other AMD trademarks used in the material IN ALPHABETICAL ORDER here per AMD's Guidelines on Using Trademark Notice and Attribution] and combinations thereof are trademarks of Advanced Micro Devices, Inc. Microsoft is a registered trademark of Microsoft Corporation in the US and/or other countries. Other product names used in this publication are for identification purposes only and may be trademarks of their respective owners. Other product names used in this publication are for identification purposes only and may be trademarks of their respective owners.

[How-To] Automatic1111 Stable Diffusion WebUI with DirectML Extension on AMD GPUs (2025)

FAQs

Does Stable Diffusion work with AMD GPU? ›

In conclusion, Stable Diffusion's compatibility with AMD GPUs has come a long way, thanks to the collaborative efforts of companies like AMD and Microsoft, as well as the open-source community.

How to install Stable Diffusion on Windows AMD GPU? ›

  1. Install python 3.10. Stable Diffusion utilizes Python, so the first step is to get Python set up on your AMD Windows PC. ...
  2. Install git. ...
  3. Clone the Stable Diffusion GitHub Repository. ...
  4. Download a checkpoint model. ...
  5. Run Stable Diffusion on AMD computers.
Jul 10, 2024

How do I set up AUTOMATIC1111 Stable Diffusion? ›

How to install Stable Diffusion on Windows (AUTOMATIC1111)
  1. Step 1: Install python.
  2. Step 2: Install git.
  3. Step 3: Clone web-ui.
  4. Step 4: Download a model file.
  5. Step 5: Run webui.
Jan 16, 2024

How do I run Stable Diffusion on my GPU? ›

Disclaimer: You must have a GPU to run Stable Diffusion locally.
  1. Step 1: Install Python and Git. ...
  2. Step 2: Create a GitHub and Hugging Face account. ...
  3. Step 3: Clone Stable Diffusion Web-UI. ...
  4. Step 4: Download the latest Stable Diffusion model. ...
  5. Step 5: Setup the Stable Diffusion web UI. ...
  6. Step 6: Run Stable Diffusion locally.

What is the fastest GPU for Stable Diffusion? ›

The Nvidia GeForce RTX 4090 symbolizes the top consumer GPUs, providing the highest performance for stable diffusion tasks. With more VRAM than most experts will ever require, the RTX 4090 ensures that memory bandwidth is never a constraint, permitting enhanced performance across different tasks.

Should I use CPU or GPU for Stable Diffusion? ›

Stable Diffusion works best with GPUs. No surprise there given that GPUs were designed to handle image processing tasks.

How do I set AMD GPU priority? ›

The steps below explain how to access the GPU Workload option.
  1. Open the AMD Radeon Settings application. ...
  2. Click on the Gaming menu option.
  3. Click on Global Settings.
  4. On the Global Graphics tab, click on GPU Workload. ...
  5. Select the desired GPU Workload.
  6. Click Yes to restart AMD Radeon Settings for the change to take effect.

How to configure AMD GPU? ›

Always use your AMD Card
  1. Completely close the Launcher.
  2. Make sure you have the latest AMD driver installed.
  3. Open AMD Radeon Settings or control center.
  4. Select Preferences, then Radeon Additional Settings.
  5. Expand Power and click Switchable Graphics Global Settings.
  6. Select High performance for the Graphic Setting.
Jan 9, 2024

How do I force my computer to use AMD GPU? ›

Here's how:
  1. Open AMD Radeon Software. ...
  2. Click on the Gaming tab.
  3. Click on Add a Game.
  4. Navigate to the location where your game is installed and select the game's executable file.
  5. Once the game is added, click on it in the list of games.
  6. Click on the Graphics tab.
  7. Under Graphics Profile, select High Performance.
Jul 8, 2023

What is the minimum GPU for AUTOMATIC1111? ›

You need to meet the following requirements. 16GB RAM. NVIDIA (GTX 7xx or newer) GPU with at least 2GB VRAM. At least 10GB disk space.

What is automatic 1111? ›

Automatic 1111 is a popular open-source UI tool built to help enthusiasts and artists play around with SD and apply many advanced features.

Does Stable Diffusion work on AMD GPU? ›

ComfyUI a Nodes/graph/flowchart interface for stable Diffusion can be installed and run smoothly on AMD GPU machine.

Can Stable Diffusion do NSFW? ›

In conclusion, while Stable Diffusion possesses the technical capabilities to generate NSFW content, its developers have implemented an NSFW filter to promote responsible and ethical use. This filter aims to prevent the generation of explicit or adult-oriented content, mitigating the risks of misuse and potential harm.

Does Stable Diffusion Web UI use GPU? ›

Download and Install CUDA for Nvidia GPUs

You can use the Stable Diffusion Web UI without a GPU or CUDA installation. The Web UI is capable of running on the CPU and can provide quick results.

What GPUs support Stable Diffusion? ›

RTX NVIDIA GPUs are the only GPUs natively supported by Stable Diffusion at the time this article was written in December 2022. Any of the following NVIDIA RTX cards will work out of the box: RTX 2060 (12GB), RTX 2070, RTX 2070 Super, RTX 2080, RTX 2080 Super, RTX 2080 Ti, or RTX Titan.

Can you use Stable Diffusion without Nvidia GPU? ›

Stable Diffusion, a powerful image generation model, is typically associated with NVIDIA GPUs. However, with the right setup, it's possible to run Stable Diffusion on laptops lacking NVIDIA hardware.

Can Stable Diffusion run on RTX 3060? ›

The RTX 3060 is a solid choice for stable diffusion tasks, thanks to its capable hardware and performance. Its ray tracing capabilities and computational power make it suitable for various diffusion applications, including rendering and simulations.

Do I need CUDA to run Stable Diffusion? ›

You can use the Stable Diffusion Web UI without a GPU or CUDA installation. The Web UI is capable of running on the CPU and can provide quick results. However, to obtain faster results, it is highly recommended that you use GPU acceleration if possible.

References

Top Articles
Latest Posts
Recommended Articles
Article information

Author: Barbera Armstrong

Last Updated:

Views: 5743

Rating: 4.9 / 5 (59 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Barbera Armstrong

Birthday: 1992-09-12

Address: Suite 993 99852 Daugherty Causeway, Ritchiehaven, VT 49630

Phone: +5026838435397

Job: National Engineer

Hobby: Listening to music, Board games, Photography, Ice skating, LARPing, Kite flying, Rugby

Introduction: My name is Barbera Armstrong, I am a lovely, delightful, cooperative, funny, enchanting, vivacious, tender person who loves writing and wants to share my knowledge and understanding with you.