Updated May 31, 2023 following the release of AMD Software: Adrenalin Edition™ 23.5.2
AMD is pleased to support the recently released Microsoft® DirectML optimizations for Stable Diffusion. AMD has worked closely with Microsoft to help ensure the best possible performance on supported AMD devices and platforms. Stable Diffusion is a text-to-image model that transforms natural language into stunning images.
Microsoft has provided a path in DirectML for vendors like AMD to enable optimizations called ‘metacommands’. In the case of Stable Diffusion with the Olive pipeline, AMD has released driver support for a metacommand implementation intended to improve performance and reduce the time it takes to generate output from the model.
Using the recently released AMD Software: Adrenalin Edition 23.5.2 we can observe the following average 2X performance improvement with Stable Diffusion 1.5 on an AMD Radeon™ RX 7900 XTX graphics card.1

The bulk of the performance gains were achieved by enabling driver optimizations for the Multi-Head Attention (MHA) operator on AMD hardware using the metacommand path provided by Microsoft within DirectML. Using a Python environment with the Microsoft Olive pipeline and Stable Diffusion 1.5, along with the ONNX runtime and AMD Software: Adrenalin Edition 23.5.2 installed, we ran the DirectML example scripts from the Olive repository to generate output and test the performance. Some tips on how to get this running can be found on the Microsoft blog post.
These optimizations have been validated on AMD RDNA™ 3 devices that feature compute units with AI accelerators, including AMD Radeon™ RX 7900 Series graphics cards.
AMD Software: Adrenalin Edition™ 23.5.2 with Microsoft Olive optimized DirectML performance for Stable Diffusion can be downloaded here: https://www.amd.com/en/support
Learn more about:
Microsoft DirectML and Stable Diffusion
Microsoft DirectML
Stable Diffusion
DISCLAIMERS AND FOOTNOTES
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
ATTRIBUTIONS
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.