JIT working again
July 26, 2011
Posted by on
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.