ROCm SPIR-V compiler target
Hi folks,
I was talking with Alexandru Voicu and briefly discussed his work
towards enabling SPIR-V as a compilation target for the HIP language.
The initial steps towards enabling this in LLVM were highlighted on
Phoronix a few days ago [1]. The compiler support is not entirely
finished and there is no runtime or library support for this target, so
this is still extremely early in the development process. Nevertheless,
I found it quite interesting.
The ROCm math libraries will require some changes if they are to support
the SPIR-V target. It might be relatively straightforward to have SPIR-V
as a fallback in most libraries, but I suspect even that will require
patches. Optimizing for performance may require more significant
changes. For example, the libraries would need to move from using macros
for checking the architecture within the preprocessor and use instead
use language features to query available hardware features.
There have been no commitments made upstream to support the SPIR-V
target for building the ROCm libraries. Nevertheless, I feel this is a
promising feature for expanding hardware compatibility and limiting
binary bloat. The 'generic' targets I've discussed in the past [2] serve
a similar purpose. However, there are different tradeoffs to the
specific targets, generic targets, and SPIR-V targets.
It is not yet clear what the future of this functionality will be, but
it is something to keep an eye on.
Sincerely,
Cory Bloor
[1]: https://www.phoronix.com/news/LLVM-AMDGCN-Flavored-SPIR-V
[2]: https://lists.debian.org/debian-ai/2024/01/msg00064.html
Reply to: