Using smoke & mirrors to compile a (...) to efficient GPU code | Troels Henriksen | Lambda Days 2022

Conference: Lambda Days 2022

Year: 2022

This video was recorded at Lambda Days 2022 -https://www.lambdadays.org/lambdadays2022 Using smoke and mirrors to compile a functional programming language to efficient GPU code | Troels Henriksen - Assistant Professor at the University of Copenhagen ABSTRACT It's been often said that pure functional programming is a great fit for parallel programming, because it is free of side effects. So how come GPUs, perhaps the most parallel mainstream devices, are not dominated by functional programming languages? It turns out that GPUs and similar high-performance processors are heavily restricted in what they can efficiently do, and the way we normally compile functional languages tends to run face-first into most of these restrictions. How do you compile a functional language when even something as simple as allocating memory becomes a struggle? The trick is to carefully design a functional language that can be transformed into the kind of heavily restricted code expected by the hardware. The programmer may think they're using all the lovely higher-order functions we know and love, but really they're writing the kind of code you'd expect from a C compiler, full of loops, in-place updates, and up-front memory allocations! We have designed one such language, Futhark, which really feels like you're programming in a pretty decent subset of a language such as OCaml or Haskell, but with strategically placed limitations (and a very aggressive compiler) that lets it generate GPU code that is competitive with hand-written code. In my talk, I'll talk about some of the crucial transformations, how the compiler transforms the program, and how it lays out data in memory in ways that allow efficient access - without the programmer having to worry about anything but writing nice, parallel, purely functional code. • Follow us on social: Twitter: https://twitter.com/LambdaDays LinkedIn: https://www.linkedin.com/company/lambda-days/ • Looking for a unique learning experience? Attend the next Lambda Days conference near you! • SUBSCRIBE TO OUR CHANNEL https://www.youtube.com/channel/UC47eUBNO8KBH_V8AfowOWOw See what's coming up at: https://codesync.global