Universe
universe
¶
xDSL leverages Python plugins for user-provided compiler infrastructure.
Python packages that want to extend the passes, dialects, targets, and frontends available in xdsl-opt can
implement their own Universe, which will be discovered by Multiverse at runtime.
To opt into this behavior first add a Universe instance somewhere in your project,
for example in your_project/universe.py:
def get_dialect():
...
def get_pass():
...
def get_frontend():
...
YOUR_UNIVERSE = Universe(
all_dialects={"your_dialect": get_dialect},
all_passes={"your-pass": get_pass},
all_frontends={"your-frontend": get_frontend},
)
Then, add the following entry in your pyproject.toml file:
Note that any clashes in names of dialects, passes, targets, or frontends will result in an error.
XDSL_UNIVERSE = Universe(all_dialects=get_all_dialects(), all_passes=get_all_passes(), all_targets=get_all_targets(), all_frontends=get_all_frontends())
module-attribute
¶
Universe
¶
Contains all the dialects, passes, and targets from modules in the environment.
Source code in xdsl/universe.py
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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
all_dialects: dict[str, Callable[[], Dialect]] = {} if all_dialects is None else all_dialects
instance-attribute
¶
Dialects from all modules in the current environment.
all_passes: dict[str, Callable[[], type[ModulePass]]] = {} if all_passes is None else all_passes
instance-attribute
¶
Passes from all modules in the current environment.
all_targets: dict[str, Callable[[], type[Target]]] = {} if all_targets is None else all_targets
instance-attribute
¶
Targets from all modules in the current environment.
all_frontends: dict[str, Callable[[], type[Frontend]]] = {} if all_frontends is None else all_frontends
instance-attribute
¶
Frontends from all modules in the current environment.
__init__(*, all_dialects: dict[str, Callable[[], Dialect]] | None = None, all_passes: dict[str, Callable[[], type[ModulePass]]] | None = None, all_targets: dict[str, Callable[[], type[Target]]] | None = None, all_frontends: dict[str, Callable[[], type[Frontend]]] | None = None) -> None
¶
Source code in xdsl/universe.py
get_multiverse() -> Universe
staticmethod
¶
Traverses the current environment looking for entry points in the
xdsl.universe group.