chaiNNer-org / chaiNNer

A node-based image processing GUI aimed at making chaining image processing tasks easy and customizable. Born as an AI upscaling application, chaiNNer has grown into an extremely flexible and powerful programmatic image processing application.
https://chaiNNer.app
GNU General Public License v3.0
4.59k stars 283 forks source link

PyTorch OpenCL backend #2709

Open Efenstor opened 7 months ago

Efenstor commented 7 months ago

Motivation It would be amazing to be able to run PyTorch nodes on AMD GPU via OpenCL.

Description I think theoretically now it should be possible because now we have RustICL OpenCL implementation (already included with all the major Linux distros) and Pytorch OpenCL on dlprimitives (also take a look on dlprimitives themselves).

Alternatives There is a ROCm backend but it is a much worse alternative because it requires proprietary drivers (which are also hard to install).

joeyballentine commented 7 months ago

Looks like that library doesn't have any prebuilt packages and is still experimental, so for now we will not be adding this. Feel free to experiment with it and report back on how well it works though

Efenstor commented 7 months ago

I tried to build it but stuck: it requires Kineto but Kineto cannot be built without CUDA. Probably older versions of Torch would do without it but anyway I better wait when the project becomes more user-friendly, e.g. at least has prebuilt packages. Too bad the whole AI landscape is so dependent on NVidia and only a few nerds seems to do care. If not for NCNN then I couldn't even try it at all, at least not so easily. But unfortunately NCNN is slow and a bit rudimentary in many aspects.

Efenstor commented 7 months ago

Just as an additional note: it seems that still it's PyTorch for ROCm is the most reasonable choice after all, as there seems to be a lot of work going on behind the scenes to include it into all the major distros in the nearest year or two. For example, it was mentioned here that Debian Trixie (TBA in 2025) is to have it in the main repos. I don't know how they are going to pull that without the need for the proprietary drivers (amdgpu-pro) but as far as I remember there was a way to build only the OpenCL part of it for the active kernel without DKMS, may be the same trick can be pulled for HIP as well.