distribution icon indicating copy to clipboard operation
distribution copied to clipboard

Compile PyTorch with USE_VULKAN=1

Open OpenSourceAnarchist opened this issue 2 years ago • 2 comments

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!

OpenSourceAnarchist avatar Jul 10 '23 15:07 OpenSourceAnarchist

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.

bryteise avatar Jul 10 '23 20:07 bryteise

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!

OpenSourceAnarchist avatar Jul 13 '23 14:07 OpenSourceAnarchist