[Python-compilers] Wrapping JIT-compiled functions
markdewing at gmail.com
Sun Jul 10 01:23:44 EDT 2016
The first bullet point for the Python Compilers Workshop talks about
passing JIT'ed code to wrapped C-functions. Let me describe some work on a
special case, which may be useful for the discussion.
The starting point was the scipy integration routines (quad, etc) that
accept a native function for the integrand callback. I wrote a Sympy to
LLVM JIT that would compile expressions into callbacks for scipy quad, and
then extended that to several other libraries.
There is a longer description here:
The python wrappers around the Cubature and Cuba libraries required
modifications to accept native code callbacks. It seems any wrapper around
a native code library that uses
callbacks will need code to handle a native code callback vs. a Python
For details, see these pull requests:
One of the issues in generalizing this is how to scale to different
libraries and callbacks without needing to program knowledge of each of
them into Sympy.
There needs to be some way to describe the parameters expected in the
callback, but it should be at a higher level than just C types - which ones
are inputs, outputs, array lengths, etc.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-compilers