clearlinux / distribution

Placeholder repository to allow filing of general bugs/issues/etc against the Clear Linux OS for Intel Architecture linux distribution
520 stars 29 forks source link

Compile PyTorch with USE_VULKAN=1 #2921

Open OpenSourceAnarchist opened 1 year ago

OpenSourceAnarchist commented 1 year ago

Given the abysmal state of ROCM on Linux, and especially Clear Linux, there is a workaround using Vulkan that is GPU-agnostic and a potential path to better and more unified support for all consumer compute cases.

This can be done by modifying https://github.com/clearlinux-pkgs/pytorch based on the following: https://pytorch.org/tutorials/prototype/vulkan_workflow.html

For Linux: USE_VULKAN=1 USE_VULKAN_SHADERC_RUNTIME=1 USE_VULKAN_WRAPPER=0 python setup.py install

In this case, I would really appreciate rebuilding pytorch with USE_VULKAN=1 USE_VULKAN_SHADERC_RUNTIME=1 (and whatever option is correct with USE_VULKAN_WRAPPER=0 or =1 for Clear's build system) so that we can support users like me trying to make use of our RDNA cards... plus it works for Intel iGPUs too, in case there's any worries about this only helping AMD users! :))

Thoughts? Thanks for considering it!

bryteise commented 1 year ago

I just went down a rabbit hole of this, stopping at shaderc which is very unfriendly for building unfortunately so this is probably not getting enabled any time soon. On the upside, I did get pytorch 2 building so that'll be in the next release.

OpenSourceAnarchist commented 1 year ago

So sorry for causing a rabbit hole, I really expected it to be a simple change with just adding in vulkan deps and changing the makefile options. My use case for this is fairly niche as I really want to use Clear with ROCm for my consumer RDNA card, but I suppose I can stick to a fully supported and separate Ubuntu/Fedora install that I maintain just for pytorch :)

Thanks for taking a stab at this, I truly appreciate it. At the least, if/when it is enabled, hopefully it will simplify all the pipelines massively by having a unified backend for all 3 main desktop GPU vendors with vulkan in pytorch as well as vulkan video decoding in ffmpeg/gstreamer/mpv/vlc!