Updated AMD ROCm (markdown)

Disty0
2025-05-08 23:15:47 +03:00
parent 7d860a3b46
commit 68ac6ef761
+21 -1
@@ -114,6 +114,26 @@ sudo docker run -it \
> It will install the necessary libraries at the first run so it will take a while depending on your internet.
> Resulting docker image will use 3.2 GB disk space (uncompressed) for the docker image and 20 GB for the venv.
## ROCm performance tuning on Linux
### MIOpen database tuning
On first use, when using a resolution for the first time, or when upgrading Pytorch versions, ROCm runs a series of benchmarks to select the most efficient approach. This can lead to slow (up to 5-8 minutes) startup times, in particular if you use a refine pass at high resolution, but it only happens once per resolution (subsequent runs are much faster). If for any case this is undesirable, you can set the environment variable `MIOPEN_FIND_MODE` to `FAST`. This will reduce a lot the startup time on first use at the price of worse performance when generating.
On the other hand, for best performance during generation (but slower startup on first use), you can set the variable `MIOPEN_FIND_ENFORCE` to `SEARCH`.
### Reduce VRAM consumption
If you use the `bf16` data type (*Settings > Compute Settings > Execution Precision > Device precision type*), which is autodetected on RDNA3 and newer cards, there is the chance that VRAM usage will be very high (16+ GB) when decoding the final image and when upscaling with non-latent upscalers. To workaround the problem, ensure to set `Device precision type` as `fp16`, and disable VAE upcasting in *Variable Auto Encoder > VAE upcasting*.
Setting `fp16` has also a noticeable impact on performance.
### Composable Kernel (CK) Flash attention
On RDNA3 and newer hardware, you can set the option to use CK Flash Attention for improved performance in *Compute Settings > Cross Attention > SDP Options* by toggling `CK Flash attention` and restarting SD.Next. Notice that enabling this option requires `rocm-hip-sdk` installed as it will download and compile an additional Python package from source on startup.
In case you want to install it manually, activate the virtual environment then run `pip`:
`pip install git+https://github.com/Disty0/flash-attention@navi_rotary_fix`
## ROCm Windows Support
This is a guide to build rocBLAS based on the ROCm Official Documentations.
@@ -402,4 +422,4 @@ and tensile [tuning .tex](https://github.com/ROCm/Tensile/blob/develop/tuning_do
A pdf version available in [here](https://github.com/likelovewant/ROCmLibs-for-gfx1103-AMD780M-APU/blob/main/tensile_tuning.pdf)
Please feel welcome to edit this post and contribute optimized logic links. Remember to carefully consider the
impact of any edits or additions.
impact of any edits or additions.