Research Projects

Selective Embedded Just-in-time Specialization (SEJITS)

Armando Fox and Jeffrey Morlan

Selective, Embedded Just-in-Time Specialization (SEJITS). Application writers require 3-10x fewer lines of code and can develop 3-5x faster when using productivity-layer languages (PLLs) like Ruby or Python rather than efficiency-layer languages (ELLs) like C or C++, and they don’t need to internalize new programming models like GPU’s or hybrid architectures to do so. But PLL implementations can be 1-3 orders of magnitude slower than carefully-coded ELL implementations. SEJITS combines the best of both approaches by maintaining a catalog of hand-crafted specializers, each of which can generate ELL code to perform a particular computation pattern on a particular hardware programming model; for example, FFT on a CUDA GPU, or stencil computations on MPI. Modern scripting languages such as Python and Ruby include the necessary facilities to allow late binding of a particular specializer to execute a function in the PLL application. In particular, introspection allows a function to inspect its own abstract syntax tree (AST) when first called, and determine whether the AST matches a specializer in the catalog. If yes, the metaprogramming support of the PLL is used to generate, compile and link ELL code to the running interpreter, and call the ELL implementation of the function; if no, the unmodified source program continues executing as usual in the PLL, albeit with lower performance. Our approach does not require modifying the source PLL program, which would wreck portability. Unlike generic JIT, SEJITS selectively specializes only those functions for which we have a matching ELL code generator, making the decision at the latest possible moment and leaving the rest to the PLL. The introspection and metaprogramming facilities of modern scripting languages to embed the specialization machinery directly in the PLL rather than having to modify the PLL interpreter, which makes life easier for the author of a specializer (i.e. for ELL programmers). In this way, SEJITS frees both the PLL and ELL programmers to concentrate on their respective specialties.