[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] speculation: a JIT for Pygame



Hi René,

Orc looks interesting. Certainly it needs further consideration. LLVM itself has abstract vector instructions. It can also return a C function that can be called directly.

Lenard

On 23/01/11 02:00 PM, René Dudfield wrote:
Hi,

Sounds cool.

have you seen orc?   http://www.schleef.org/blog/category/liboil/

cya.


On Sun, Jan 23, 2011 at 8:14 PM, Lenard Lindstrom<len-l@xxxxxxxxx>  wrote:
The problem:

Unlike other image packages, Pygame supports operations on many different
pixel formats: 32 bit pixel with alpha can blit to 24 bit without alpha,
eight bit palette can blit to 16 bit without alpha, and so on. This makes it
cumbersome to add new blit operations, like exclusive-or, and even more
difficult to add a new pixel format.

The proposal:

With the acceptance of PEP 3146 the Unladen Swallow offshoot of CPython will
be merged back into trunk Python sometime around Python 3.3. Unladen Swallow
brings with it a Python JIT powered by LLVM. LLVM is a compiler tool kit
that also provides runtime compilation to machine code. So the idea is to
generate blitters on demand for various pixel configurations with LLVM.

Alternatives:

Another possibility is to design as generic a blitter loop as possible, then
include some specialized loops for common pixel formats. Or one could
develop a preprocessor that translates a specialized blit description
language into corresponding C code, much the way Pyrex transforms Python
like code into C. This approach is used to write sound modules for the Lisp
based sound processing language Nyquist.


This is all just far out speculation. It is a long term goal not intended
for the next Pygame release.

Lenard Lindstrom