Zulip Chat Archive
Stream: lean4
Topic: GPU kernel generation and use?
Geoffrey Irving (Sep 25 2023 at 22:35):
I’m curious whether anyone has explored dispatching Lean 4 code to GPU kernels, in particular for straight line code operating on simple types used inside Array.map. It seems like one could write a quite general plugin to do this given the flexibility of the system.
Geoffrey Irving (Sep 25 2023 at 22:37):
Note that both the Metal and CUDA shading languages are C-based, so conceivably one could try to restrict to the mutually compatible fragment and re-use the existing code generator.
Geoffrey Irving (Sep 25 2023 at 22:52):
@Daniel Selsam: Do you know whether people have tried this?
Tomas Skrivan (Sep 25 2023 at 22:55):
A long time ago I attempted something like that, but I knew very little metaprogramming and got nowhere. I would be quite happy to try again. I'm thinking of writing bindings for CUDA Thrust library and some meta code to generate transformations and reduction kernels based on Lean code.
Tomas Skrivan (Sep 25 2023 at 22:56):
I'm not aware of anyone giving it a proper try.
Tomas Skrivan (Sep 25 2023 at 23:01):
Soon I should have backpropagation working in Lean. Generating reasonable GPU code would be really useful to properly test it out.
Schrodinger ZHU Yifan (Sep 25 2023 at 23:35):
I do know another project focusing on using dependently typed arrays to program GPU/CPU parallel kernels. https://github.com/google-research/dex-lang
Daniel Selsam (Sep 26 2023 at 01:57):
Geoffrey Irving said:
Daniel Selsam: Do you know whether people have tried this?
Hi @Geoffrey Irving! I am afraid I have no idea.
Last updated: Dec 20 2023 at 11:08 UTC