there are so many cores

Just another WordPress.com site

Monthly Archives: July 2011

This is one of those weird open source projects

It’s probably obvious this is one of those weird open source projects.

First, it’s about weird stuff. GPGPU on a managed platform… embedded inside C++. Why? I believe more brute force is needed for machine learning and quantitative applications.

Second, this entire project is being done by one guy. Me. I stepped off the conventional salaryperson track to see what would happen. This is it.

Most of the time, I just keep working in obscurity. My belief: good technology at the right price has lasting value to people. And people are what the world is all about. So I had better make technology that helps people solve their problems. Then this technology can have lasting value.

A few times in the last year or so, I’ve had contact with commercial and research interests as a consequence of this project. This has been a new experience for me. Issues around IP and NDA contracts are first and foremost. That’s true even for a free and open source project like this one.

One thing I marvel at now is how any new technology is created at all. There are so many distractions and competitive disincentives to deep investments in science and engineering. Developing technology is a very long, risky bet.

JIT working again

Got the JIT working again at 3 am this morning. It’s been a long way back.

There was a working JIT six months ago: Trivial example of the JIT with OpenCL. The design was based on functional programming concepts: code as data; memory management and concurrency with deep copies; laziness and boxes everywhere. You can see where this is going… nowhere.

Stream processing may not require explicit shared mutable data. It does require gather/scatter of threads into kernels. Another requirement for a PeakStream style tracing JIT is heuristic loop rolling. That might be possible with a clever recursion over boxed ASTs. But now this is becoming compiler rocket-science. Why make things complicated?

So I threw out the entire design and started over.

Memory management turned out to be far more complex in this new design. There are effectively three different memory spaces requiring active management: application data; host runtime memory; OpenCL compute device memory buffers and images. There are also multiple compute devices and an interpreter, all of which may run concurrently and interdependently within an application.

Well, I figured it out.

Uploaded project source code to Github

I uploaded the source code as of today (2011-07-12 in the pacific time zone of the USA) to Github. It is not working code, although it does compile and the samples do run.

My original plan was to upload working code as an alpha release. However, unexpected events have changed these priorities somewhat.

I feel it is important to establish clearly the intellectual property, copyright and licensing of what I’ve spent the last year of my life working on. The worst thing would be for this technology to die due to legal ambiguity. My hope is that publishing this work, though it is unfinished, establishes greater clarity when it comes to issues of IP.

The source code licensing is The Artistic License 2.0 of The Perl Foundation. I didn’t put too much thought into this. I really admire Perl and the culture around it. So I thought if it is good enough for Perl 6, it must be good enough for this project.

The project name “chai” has no special meaning. I just drink huge amounts of chai tea. It’s my favorite. I also liked this name as it is short with four letters, like Java. Java coffee and chai tea, get the joke?

I also don’t claim any of this code is the best or the right way. The project has and continues to be very organic. I just muddle my way through problems. So far, every problem has had a solution.

So where are things? It’s all about the JIT now. All the other pieces are in place: virtual machine front-end; middle-end tracing; scheduling; memory management. The JIT may be the sexy core and what gives the performance. But without the other supporting parts, it can’t work. They had to be built first.

I feel a little guilty as I took a month off recently. I had lots of fun visiting fine arts museums, thinking about economics and people, and rediscovering photography. This waste of time may have been necessary, though. Afterwards, the last problem of memory management came together. It was deeper than I had first thought.

Please bear with me. I will not disappoint!