43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
"""The multi-backend dispatch substrate.
|
|
|
|
Two tuple-keyed registries (``COMPONENTS``, ``KERNELS``) + a ``Platform`` that detects ``(device,
|
|
arch)`` and resolves both, with the numpy reference as the terminal fallback rung and parity oracle.
|
|
Lets CPU, GPU, and other backends coexist: a model's loops, policies, scheduler, caches, and
|
|
inference code never names a device; it calls through the component/kernel seams and the resolved
|
|
``Platform`` decides the implementation.
|
|
|
|
Importing this package is cheap and cycle-free (registry + platform classes only); the concrete
|
|
backend registrations in ``backends/`` are imported lazily on first ``Platform`` use.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from v2.platform.platform import (
|
|
KernelTable,
|
|
Platform,
|
|
component_matrix,
|
|
ensure_backends_loaded,
|
|
kernel_matrix,
|
|
)
|
|
from v2.platform.registry import (
|
|
COMPONENTS,
|
|
FLOW_MATCH_STEP,
|
|
FLOW_SDE_STEP,
|
|
KERNELS,
|
|
register_component,
|
|
register_kernel,
|
|
)
|
|
|
|
__all__ = [
|
|
"Platform",
|
|
"KernelTable",
|
|
"COMPONENTS",
|
|
"KERNELS",
|
|
"register_component",
|
|
"register_kernel",
|
|
"ensure_backends_loaded",
|
|
"kernel_matrix",
|
|
"component_matrix",
|
|
"FLOW_MATCH_STEP",
|
|
"FLOW_SDE_STEP",
|
|
]
|