DarthAffe / StableDiffusion.NET

C# Wrapper for StableDiffusion.cpp
MIT License
60 stars 10 forks source link

Rocm Backend: Fix regex for detecting version in Linux #4

Closed DGdev91 closed 6 months ago

DGdev91 commented 6 months ago

Hi, i'm trying out your library on my machine, but i can't use the ROCm backend on Linux i'm using ArchLinux and rocm 6.0.2 (the version currently included in official arch repos)

The output from hipconfig is something like this:

HIP version  : 6.0.32831-

== hipconfig
HIP_PATH     : /opt/rocm
ROCM_PATH    : /opt/rocm
HIP_COMPILER : clang
HIP_PLATFORM : amd
HIP_RUNTIME  : rocclr
.......

...and so on.

As you can see HIP_PATH points to /opt/rocm, and it's not possible to find out rocm's version from there. but we can use the "HIP version" string just on top.

Also, the $ at the end makes the regex never match if there are other characters after the matched string, wich is not what we want.

I made a new regex wich takes the version from "HIP version"

also.... i'm not sure that checking just the major version is enough, but we can talk about that in another thread

DarthAffe commented 6 months ago

Hey, thanks for contributing. that's interesting - the hipconfig output this is based on had shown the version in the path (but since I don't own a device on my own I just had to take what others sent me) - maybe there is a difference between distributions. But this is a better solution and should work in all cases.

Checking only the major version should be fine (at least as far as I know there aren't breaking changes between minor versions)