Re: [pypy-dev] Floating point computation

2011-07-09 Thread Ilya Osadchiy
>>> The Translation and JIT backend for PyPy may be able to allow Python >>> programmers to use SIMD instructions directly from Python. >> >> We kind of want to do that automatically for numpy operations. > > Can all basic SIMD instructions be mapped to numpy array operations? > If so, why doesn't

Re: [pypy-dev] Floating point computation

2011-07-08 Thread Armin Rigo
Hi, On Thu, Jul 7, 2011 at 10:59 AM, Maciej Fijalkowski wrote: >> The Translation and JIT backend for PyPy may be able to allow Python >> programmers to use SIMD instructions directly from Python. > > We kind of want to do that automatically for numpy operations. Can all basic SIMD instructions

Re: [pypy-dev] Floating point computation

2011-07-07 Thread Maciej Fijalkowski
On Thu, Jul 7, 2011 at 10:47 AM, Vishal wrote: > Hello, > I would like to bring to your notice this article about exposing SIMD > instructions to high level languages. > http://drdobbs.com/blogs/tools/230600043 > The Translation and JIT backend for PyPy may be able to allow Python > programmers to

Re: [pypy-dev] Floating point computation

2011-07-07 Thread Vishal
Hello, I would like to bring to your notice this article about exposing SIMD instructions to high level languages. http://drdobbs.com/blogs/tools/230600043 The Translation and JIT backend for PyPy may be able to allow Python programmers to use SIMD instructions directly from Python.

Re: [pypy-dev] Floating point computation

2011-07-01 Thread Zariko Taba
On Fri, Jul 1, 2011 at 2:54 PM, Armin Rigo wrote: > > There is a third solution: do exactly the same kind of code, but in > RPython instead of in C. This means using the rffi module. For > example: > > builtin_ia32_sqrtss = rffi.llexternal("__builtin_ia32_sqrtss", > [argtypes...], >restype,

Re: [pypy-dev] Floating point computation

2011-07-01 Thread Armin Rigo
Hi, On Fri, Jul 1, 2011 at 2:57 PM, Maciej Fijalkowski wrote: > But it won't become an assembler instruction in the JIT, it'll still be a > call. Indeed. But fixing this is not too hard. Grep for "math_sqrt" and "MATH_SQRT" in pypy/jit/*/*.py for an example of how we turn sqrt_nonneg(x) into

Re: [pypy-dev] Floating point computation

2011-07-01 Thread Maciej Fijalkowski
On Fri, Jul 1, 2011 at 2:54 PM, Armin Rigo wrote: > Hi, > > On Fri, Jul 1, 2011 at 2:41 PM, Zariko Taba wrote: >> // compute a sqrt using intrinsics >> __builtin_ia32_sqrtss(...); >> // get status register of sse2 fpu >> int mxcsr = __builtin_ia32_stmxcsr(); >> // extract overflow bit : >> overfl

Re: [pypy-dev] Floating point computation

2011-07-01 Thread Armin Rigo
Hi, On Fri, Jul 1, 2011 at 2:41 PM, Zariko Taba wrote: > // compute a sqrt using intrinsics > __builtin_ia32_sqrtss(...); > // get status register of sse2 fpu > int mxcsr = __builtin_ia32_stmxcsr(); > // extract overflow bit : > overflow = (mxcsr & 0x8); > // extract ... There is a third solutio

[pypy-dev] Floating point computation

2011-07-01 Thread Zariko Taba
Hi pypy list, I'd like to prototype an interpreter in rpython. But this interpreter must feature floating point support. Something like the context in the decimal module of python : (decimal is basically a floating point unit in python) import decimal # do an operation decimal.Decimal("6e4565465"