Lessons Learned Implementing Common Lisp with LLVM [video]
youtube.com
youtube.com
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 And The cando one.
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.
Good to see ansi-tests mentioned. :)
I'm not saying GPU offload is easy. As you point out, no general-purpose language today does that (and LLVM doesn't seem to offer it as a feature), so you'd have to implement that either way. The choice is "new compiler + GPU target" versus "mature portable compiler + GPU target". Why is the latter "not realistic"?
I find it hard to believe that the architecture of every (free) compiler is so horribly suited to this that we need to start from scratch. We've forked CL compilers many times, for new architectures, but I've never seen any architecture that required starting over.
Worst case, you'd have to write a name mangler, to teach your FFI about C++ symbols, but I imagine that would be at least an order of magnitude easier than an entire compiler (150K lines C++, 85K lines CL).
It's basically explained in the video. He forked ECL, because he wanted to have a CL implementation based on LLVM and very deep C++ integration. ECL is already a C-based Common Lisp.
> SBCL is very good, but it’s hard to say how long it will keep being developed.
As long as people work on it.
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.
It starts with lambda calculus and ends with compiling a tiny Scheme subset to portable C code.
A proper C++ ffi for CL with a good clbind and GPU binding would probably help him better than this monster.
(i was recently working with PyTorch and wishing I could use Common Lisp instead of Python, for various reasons.)