Heterogeneous Computing: What is LLVM and How Does Rust (rustc) Utilize It?
Описание
In this stream, we'll explore LLVM and its role in the Rust compiler. This serves as a continuation of one of my earlier streams about programming for Apple GPUs.
We cover the basics of the Rust compilation pipeline and provide an overview of LLVM's architecture, including the front end, midend, and backend. You'll receive a straightforward explanation of LLVM's core IR syntax and how it is optimized. We also demonstrate the Godbolt Compiler Explorer for visualizing LLVM IR and show how to create LLVM IR using the Inkwell crate. Finally, we examine the LLVM IR generated for Metal kernels on Apple GPUs.
#llvm #compiler #rust #optimization #gpu #heterogeneous #computing #mlir
Apple GPU programming with Rust - https://youtu.be/O_jT0kslGCM?si=KxV7NDWoR6ZBnb3g
GitHub repo for the Inkwell - LLVM IR demo: https://github.com/nihalpasham/gen-llvm
00:00:00 Recap and Intro to LLVM
00:02:39 Rust compilation phases
00:04:55 LLVM's modular architecture
00:07:50 A side-note on Zig
00:08:53 What is LLVM IR?
00:14:24 LLVM by hand using a rust crate - (Inkwell)
00:17:03 A better way to visualize LLVM IR - Godbolt
00:18:55 Back to Inkwell
00:26:15 A side-by-side comparison of LLVM IR generated by Inkwell.
00:29:00 Passing notes on MLIR, graph compilers, machine learning and RISC-V arch
00:31:10 A quick note on the type of LLVM IR produced for Apple GPUs.
00:33:00 Wrap up and summary