[pypy-dev] Automatic SIMD vectorization

Tuom Larsen tuom.larsen at gmail.com
Tue Oct 20 10:20:19 EDT 2015


Hello all!

I just read with great interest the blog post "Automatic SIMD
vectorization support in PyPy".

Please, I have a few questions:

- Does regular Python code benefit from the vectorization? I mean, the
article on one hand says "it is not specifically targeted for the
NumPy library" but on the other it says "Any interpreter (written in
RPython)".

- I would like to write a vector class as much suitable for PyPy as
possible, what approach should I take in order to implement it? For
example, what would suit PyPy JIT the best:

    class Vector3d:
        def __init__(a, x, y, z):
            (a.x, a.y, a.z) = x, y, z
        def __add__(a, b):
            return Vector3d(a.x + b.x, a.y+b.y, a.z+b.z)

    def add1(a, b):
        (ax, ay, az) = a
        (bx, by, bz) =  b
        return [ax + bx, ay + by, az + bz]

   def add2(a, b):
        (ax, ay, az) = a
        (bx, by, bz) =  b
        return (ax + bx, ay + by, az + bz)

    def add3((ax, ay, az), (bx, by, bz)):
        return (ax + bx, ay + by, az + bz)

    def add3:
        ???

- Is NumPyPy going to be included with regular PyPy download/install?

Thanks a lot in advance!


More information about the pypy-dev mailing list