Mi25, Stable Diffusion's $100 hidden beast

make sure that you have PATH variable set for the rocm directories , you may also want to setting
torch==< version >+rocm5.4.2 torchvision==< version >+rocm5.4.2
instead of just leaving it to decide, I’ve had problems with it installing the wrong versions. both can lead to that error.

also small discovery, seems that using --precision=full --no-half, offers a significant speedup over with fp16 being enabled, so it seems double rate is borked.

1 Like

Thanks @536k !
I’ll admit for my almost 5 years of using Linux I have never had to deal with $PATH variable :slight_smile: . ROCm from the repo is installed in /usr/lib/x86_64-linux-gnu/ so to me this looks like one of core Linux lib directories. I’m not sure if adding that to $PATH is safe?
My $PATH right now is /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

I’m also very new to PyTorch, so pardon those basic questions too.
Those torch settings should be done during install or after?
Should they be set in a config file, or run from/in venv?

I cant seem to get my Asus b550 mobo to post with this card flashed to the vega64 bios. I threw in a second GPU with HDMI out so my mobo knows for sure there is a GPU, since my mobo wont POST without a GPU. Now If I add in this Mi25 as a secondary card, the computer starts up, the mobo lights are good, no errors. However, I just boot to a monitor with a green light but a black screen. Never seems to get past that. For some reason booting in CSM ON mode gets me further , I can boot into my OS ( proxmox ) but a bunch of errors are throw in console, mostly PCI Iommu group like errors. My current line of thinking is that maybe I need to boot with only this card in and get the mini display port cable? Anyone facing this issue?

Did you also enable above 4g decoding

you should be fine with that Path variable, I had a problem on arch where its installed to /opt/rocm, You can add to the path variable by adding :$PATH to the end, in my case PATH=/opt/rocm/bin:$PATH

as for the torch settings its just adding the version specified to the torch command mine is

TORCH_COMMAND=“pip install torch==2.1.0.dev.< a number>+rocm5.4.2 torchvision=0.16.dev.< a number >+rocm5.4.2 --extra-index-url https://download.pytorch.org/whl/nightly/rocm5.4.2 --no-cache-dir”

recommend picking a nightly that works and just sticking to it for stability reasons, until the next release of pytorch that supports python 3.11

also you may want to clear some stuff in the your $HOME/.cache folder, for me there was an miopen folder, and I had to delete it once after a crash because the contents became corrupted and It caused problems.

1 Like

Ah OK. Now it’s more clear, thanks. I tried and with the latest PyTorch nightly build and ROCm5.4.2 version I still get the same hang. I purged all related stuff from .cache before the installation.

The difference is that now there are no warnings about missing NV drivers.
I will try all nightly builds to find one that might work.

One other thing, do I understand this right that the GUI should launch in the default web browser?

yes , it will just spit out a link/launch the default browser,

also I just remembered , I had it start segfaulting once, and I think it had something to do with having 2 gpus installed, so if you’re running with IGP enabled or multiple cards, might be applicable, What was weird about it , is once I got it to work once, it never happened again.

huh, I have two RVII installed in this machine. So the workaround is to find the correct version of pytorch and that would be it?

no it had nothing to do with the version, I tried a bunch of things , I think I had to run the it on the primary card first, and I set --precision=full --no-half, and then it just started working ?:person_shrugging:, sorry I can’t be more helpful about that.

1 Like

I have set both --precision=full --no-half from the start, so that is ok.

Now that I think of it there is no MIOpen ROCm package available, because it’s not packaged yet in Debian. And during initialization either pytorch or GUI checks it, otherwise there would be no this error output in the SD FAQ:

MIOpen(HIP): Warning [SQLiteBase] Missing system database file: gfx1030_18.kdb Performance may degrade. Please follow instructions to install: https://github.com/ROCmSoftwarePlatform/MIOpen#installing-miopen-kernels-package

Run the command rocminfo and post what you have

rocminfo.txt (12.6 KB)

Well they’re showing up as roc devices that’s good

Maybe rocminfo is too generic for AI/ML specific execute paths? I doubt it is checking for specific libraries.

Here is the state of ROCm libs (outside of libamdhip). I marked in green those that are in the Debian repo. Rest, including pytorch and tensorflow are not in (hopefully - yet).

So here is what some light tuning can get you

same prompt, with anything 4.5 euler a 20 step ,
with --precision=full --no-half --opt-sub-quad-attention
330w powerlimit + 75mv undervolt, and 1040mhz on the hbm.
what is note worthy, is that the core is still only hitting 1.27ghz, so if you wanted to run house fire mode with sufficient cooling, it mightbe able to do 1500-1700mhz depending on the sample. might be possible to get close to or excceed 3.4 it/s.

OK, I was wrong. The ROCm stack from Debian repo is sufficient for SD to run. This hang is purely Automatic1111 GUI problem. I tested other interface (link below) and it runs:

It was also much easier to install once you have python venv running. I installed latest nightly PyTorch 20230504.

Also swapped FP16 to FP32 and now the speed is much better:

2 Likes

ya I did …

image

Any thoughts here, failure to read rom? bricked card? I’m considering trying the MI25 in the top x16 slot but it’s a pita with water loop

use a hardware flash, its 100x easier.

thanx, but this link also leads to an error page - funny aliexpress behaves this way :slight_smile:
Of course, when I enter the search terms, I get 172817 offers, some with adapter X, some with voltage mod y, some with clip z… So I have to work my way through the offers to find a complete up to date package with 1.8v mod already implemented with a sane price and shipping way. I will eventually find one - a link to a proven working good package would have made it quicker - but I will manage :slight_smile: Thank you.