__init__.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. """Attention ops for b12x.
  2. - ``paged``: paged-KV self-attention (decode + extend, FP8 KV, MSA
  3. block-sparse variant) with on-device graph-replay metadata staging.
  4. - ``dense_mla``: dense compressed-cache MLA with strided physical records and
  5. optional causal sliding-window masking.
  6. - ``sparse_mla``: top-k-selected MLA, including strided physical records.
  7. - ``compressed_mla``: MLA decode directly from compressed KV pages (DSV4).
  8. - ``nsa_indexer``: the NSA index stage — quantize -> score -> select.
  9. - ``varlen``: contiguous batched/varlen attention (reduced-assurance tier).
  10. """
  11. from __future__ import annotations
  12. import importlib
  13. from typing import Any
  14. _OP_MODULES = (
  15. "paged",
  16. "dense_mla",
  17. "sparse_mla",
  18. "compressed_mla",
  19. "nsa_indexer",
  20. "varlen",
  21. )
  22. def __getattr__(name: str) -> Any:
  23. if name in _OP_MODULES:
  24. module = importlib.import_module(f".{name}", __name__)
  25. globals()[name] = module
  26. return module
  27. raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
  28. def __dir__() -> list[str]:
  29. return sorted(_OP_MODULES)
  30. __all__ = list(_OP_MODULES)