[Python-Dev] Python-acceleration instructions on ARM

Cesare Di Mauro cesare.dimauro at a-tono.com
Wed Feb 11 12:02:59 CET 2009


On Feb, 11 2009 at 04:11:AM, Benjamin M. Schwartz <bmschwar at fas.harvard.edu> wrote:

> Brett Cannon wrote:
>> On Tue, Feb 10, 2009 at 18:45, Benjamin Schwartz
>> <bmschwar at fas.harvard.edu>wrote:
>>
> ...
>>> According to ARM [4]:
>>>
>>> """Jazelle RCT can be used to significantly reduce the code bloat
>>> associated
>>> with AOT and JIT compilation, making AOT technology viable on mass-market
>>> devices. It can also be used to support execution environments beyond Java,
>>> such as Microsoft .NET Compact Framework, Python and others."""
>>>
>>> """Jazelle RCT provides an excellent target for any run-time compilation
>>> technology, including JIT and AOT for .NET MSIL, Python and Perl as well as
>>> Java. ARM is working with leading software providers to enable solutions
>>> ready for market with Jazelle RCT."""
> ...
>>> Question:
>>> ARM is specifically claiming that these instructions can be used to
>>> accelerate Python interpretation.
>>
>> Wow, really? One of the links below mention that?
>
> Yes.  The quotes above from [4], as well as the white paper [6].  No
> specific data, just these broad claims.
>
>>> What would the process be to incorporate the use of ThumbEE instructions
>>> into CPython?
>>>
>>
>> Well, this all depends on how you try to integrate the instructions. If you
>> hide it behind the macro or in a clean way that does not penalize skipping
>> the instructions then you write a patch. But if this can't be done it would
>> be better to maintain an external set of patches against trunk for this.
>
> Interesting.  Sugar Labs will probably not attempt this if we would have
> to maintain a patched interpreter forever.  However, I hope it will be
> possible to integrate into CPython in a manner that does not uglify the
> code or affect other architectures.
>
> Anyone else interested in ARM?  ThumbEE support would benefit anyone
> running Python on recent ARM chips.  Maybe we need to create a working
> group/project team/whatever.
>
>>> [4] http://www.arm.com/products/multimedia/java/jazelle_architecture.html
>>> [6] http://www.arm.com/pdfs/JazelleRCTWhitePaper_final1-0_.pdf

It's not useful for CPython, since it's based on a loop which evaluates a bytecode
at the time.

You have to rewrite the virtual machine implementing a JIT compiler that
generates Thumb-EE instructions. But it's a big effort, since ceval.c works in a
completely different manner.

I don't know if a form of JIT will be implemented in future CPython
implementations, but if a step in this direction will be made, writing a back-end
that uses Thumb-EE will be much easier.

Cheers,
Cesare


More information about the Python-Dev mailing list