mitsuba-renderer / enoki

Enoki: structured vectorization and differentiation on modern processor architectures
Other
1.26k stars 94 forks source link

AMD GPU code generation? #123

Closed jammm closed 3 years ago

jammm commented 3 years ago

Hey @wjakob, Hope you're doing well and staying safe!

I was wondering, what would be needed here in order to provide support for AMD GPU's? You mentioned the LLVM backend at https://github.com/mitsuba-renderer/enoki/issues/80. Does this mean that Enoki can potentially generate LLVM IR ? If so, maybe we can leverage the LLVM amdgpu backend as mentioned here https://llvm.org/docs/AMDGPUUsage.html#introduction. What do you think?

Cheers, jam

wjakob commented 3 years ago

Hi Aaryaman,

since the new version generates LLVM IR, it is in principle possible to use that as a mechanism to create new backends (e.g. Metal, AMDGPU, etc.). But there are many details (specific "flavor" of LLVM IR, hand-written GPU kernels, buffer management) that would make this a huge undertaking -- I'm guessing at least half a year by somebody who is very familiar with the specific target architecture and the LLVM internals. It's unfortunately not something that we can pursue as our resources are limited (and creating 2 backends was already a lot of work!). If you have that kind of time and expertise, contributions are welcomed.

Wenzel

jammm commented 3 years ago

Thanks for your reply! It does sound like a more complicated issue than I thought. At the very least, having LLVM IR is a great as it opens up avenues for other devices to be supported. The point regarding specific "flavors" of LLVM IR is interesting as well. I'll keep that in mind as I explore more use cases for the AMDGPU LLVM backend.

Cheers, Aaryaman