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
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
c_type_context: CTypeContext = CTypeContext()
instance-attribute
IR attribute to C type registry.
__init__()
Initialize an empty :class:~xdsl.jit.c_type_context.CTypeContext.
Source code in xdsl/jit/context.py
29 30 31 32 | |
jit(mlir_module: builtin.ModuleOp, symbol: str, ir_context: Context) -> RawJITFunc
abstractmethod
Lower mlir_module and JIT-compile symbol.
Source code in xdsl/jit/context.py
34 35 36 37 38 39 40 41 42 | |
JITContext
Combine a frontend, call-boundary type mappings, and a JIT backend.
Source code in xdsl/jit/context.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
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.
Source code in xdsl/jit/context.py
57 58 59 60 61 | |
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
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
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.
Source code in xdsl/jit/context.py
86 87 88 89 90 91 92 93 94 95 | |