5 ms·
Lessons Learned Implementing Common Lisp with LLVM [video]
- sctb 8y agoThis talk references the Cleavir compiler, which is part of Robert Strandh's (of McCLIM and Climacs fame, at least) modular CL implementation called SICL: https://github.com/robert-strandh/SICL https://github.com/robert-strandh/SICL. Looks like there's at least one discussion on HN: https://news.ycombinator.com/item?id=8284835 https://news.ycombinator.com/item?id=8284835.
- acidflask 8y agoJulia
- nudpiedo 8y agoThere are many languages leveraging LLVM. Get it over. And single word answers are not a proper netiquette, if that still was a thing.
- ngcc_hk 8y agoWow!!! This is a wonderful talk. The title is so old school though that need changing. - How I use lisp to fight human aging or - why I choose lisp over python to combat protein generation - my protein generation using llvm was done all by lisp for. Reason The talk is amazing. This one chemistry prof. who seems to be an IT expert but really just start lisp programming by building a lisp interpreter. Wow!!! https://github.com/clasp-developers/clasp https://github.com/clasp-developers/clasp And The cando one.
- type0 8y agoAmazing talk for sure, I think I saw a similar presentation a couple of years ago. His older video was called "Molecular Metaprogramming", one of the coolest titles ever.
- deleted 8y ago[deleted]
- agumonkey 8y agooh cool, I had no idea it was a new talk on Clasp.
- drmeister 8y agoThank you. It was a talk for the llvm developers meeting and I'd been turned down for talks a couple of times a couple of years before that. I REALLY needed to get to this meeting to talk with llvm developers - so I pitched the title that I thought people there wanted to hear...
- tomcam 8y agoThe video is preternaturally clear. Not sure if it's because I'm on a new monitor or what.
- mark_l_watson 8y agoI have heard him talk before about Clasp, really entertaining. Coincidentally, I just built Clasp from source last weekend. I don’t when I will have time to do this, but I would like to choose a deep learning library with a good C++ interface (perhaps mxnet) and try to get a good Clasp wrapper written.
- currymj 8y agoIf you do this, using PyTorch’s new C++ frontend and API might be better; I think PyTorch is generally more popular, at least for use by individuals (maybe MXNet is better in production or something). https://pytorch.org/cppdocs/ https://pytorch.org/cppdocs/ (i was recently working with PyTorch and wishing I could use Common Lisp instead of Python, for various reasons.)
- jeofken 8y agoHaving a hard time finding words to express how interesting of a topic Mr. Schafmeister is working on! I’m playing around with compilation, self-studying during weekends. I want to learn how to compile Closures from my small Lambda Calculus language into something like C++. “Baby’s first FP codegen”, or the like. I have struggled to find reading material for the intermediate beginner on this subject. So, if anyone on HN has a favourite link on the web about compiling functional languages, please feel free to share them.
- nils-m-holm 8y agoHere's a book dedicated to compiling closures to C: http://t3x.org/clc/index.html http://t3x.org/clc/index.html It starts with lambda calculus and ends with compiling a tiny Scheme subset to portable C code.
- tincholio 8y agoYou might want to look at Ferret (https://github.com/nakkaya/ferret https://github.com/nakkaya/ferret), which compiles a subset of Clojure to C++, it could be useful to help you understand. It's also written in a literate style, so it's also well-explained.
- ken 8y agoThis is fascinating to me because coming at it as a Lisp programmer, my impression of LLVM is that it's primarily a library for doing Lispy things in C. It kind of makes sense, then, that you should be able to use the codegen parts of LLVM for implementing Lisp itself, and I love that someone has actually done that. And that he bootstrapped it using an existing self-hosted compiler. The obvious question I have is why not just use something like SBCL as the starting point. His own benchmarks show it's ~4x faster (so far). Is it not easier to add GPU support to SBCL, than to write a new Lisp compiler from scratch? Of course, this way is more fun.
- jacobush 8y ago"easier to add GPU support to SBCL" excuse me?! Where'd you even begin?
- ken 8y agoI'd begin by adding a new architecture, and merging an existing library which can convert expressions to GPU kernels -- same as he's doing now with his LLVM-based one. Why would it be any different? Is LLVM so GPU-friendly that it's worth it to write 250K lines of code just to be able to call it a bit more easily?
- pjmlp 8y agoYes it is, LLVM toolchain is directly supported by Khronos for GPGPU standards (LLVM <-> SPIR-V integration), NVidia also makes use of it, and it has a backend for shaders emulation on CPUs.
- chrisseaton 8y agoI don’t think anyone anywhere has achieved general GPU offload for a general purpose language yet, so your idea that it would be easier than writing a lisp compiler, which we’ve done millions of times, is probably not realistic.
- pfdietz 8y ago
- rurban 8y agoStill 4x slower than sbcl. And lot of threading problems, thread-unsafe hashes and symbols all over. A proper C++ ffi for CL with a good clbind and GPU binding would probably help him better than this monster.
- agumonkey 8y agoYou should pitch the idea to him, I think he'd probably respond favorably considering how important the biochemistry topic is.
- drmeister 8y ago"A proper C++ ffi for CL with a good clbind" is easy to say but much harder to implement - no one but I have achieved it and I had to implement a Common Lisp to achieve it. It's not just calling functions and translating arguments and return values that is difficult. The much harder problem is unwinding the stack over C++ frames that use RAII.
- drmeister 8y agoThanks, everyone! I missed this thread when it first came out.