Context
context
¶
P = ParamSpec('P')
module-attribute
¶
R = TypeVar('R')
module-attribute
¶
JITBackend
¶
Bases: ABC
Compile a module symbol to a :class:~xdsl.jit.function.RawJITFunc.
Implementations receive the module produced by the frontend, lower it to the
backend’s dialect, and bind symbol for native calls.
Source code in xdsl/jit/context.py
JITContext
¶
Combine a frontend, call-boundary type mappings, and a JIT backend.
Source code in xdsl/jit/context.py
pyast_ctx: PyASTContext = PyASTContext()
instance-attribute
¶
Frontend used to parse Python functions into IR.
py_type_context: PyTypeContext = PyTypeContext()
instance-attribute
¶
Python type mappings for native calls.
jit_backend: JITBackend = jit_backend
instance-attribute
¶
Backend that lowers IR and produces a :class:~xdsl.jit.function.RawJITFunc.
__init__(jit_backend: JITBackend)
¶
Create empty frontend and type-converter state around jit_backend.
jit(signature: TypeForm[Callable[P, R]]) -> Callable[[Callable[P, R]], WrappedJITFunc[P, R]]
¶
Return a decorator that JIT-compiles a function with signature.
signature selects the Python-to-C type maps and is checked against the
C signature derived by the backend. It is passed explicitly so annotations
need not be evaluated.
Source code in xdsl/jit/context.py
register_builtin_type_maps(ctx: JITContext) -> None
¶
Register the Python float / IR f64 / C double mapping.
Updates the frontend type map and the
:class:~xdsl.jit.py_type_context.PyTypeContext together. The backend registers
the IR side on its own :class:~xdsl.jit.c_type_context.CTypeContext.