vllm.v1.attention.backends.mla.prefill.registry ¶
Registry for MLA prefill backends.
This module provides an enumeration of all available MLA prefill backends and utilities for loading and registering them.
MLAPrefillBackendEnum ¶
Bases: Enum
Enumeration of all supported MLA prefill backends.
Source code in vllm/v1/attention/backends/mla/prefill/registry.py
clear_override ¶
get_class ¶
get_class() -> type[MLAPrefillBackend]
Get the backend class (respects overrides).
Returns:
| Type | Description |
|---|---|
type[MLAPrefillBackend] | The backend class |
Raises:
| Type | Description |
|---|---|
ImportError | If the backend class cannot be imported |
ValueError | If CUSTOM is used without being registered |
Source code in vllm/v1/attention/backends/mla/prefill/registry.py
get_path ¶
get_path() -> str
Get the class path for this backend (respects overrides).
Returns:
| Type | Description |
|---|---|
str | The fully qualified class path string |
Raises:
| Type | Description |
|---|---|
ValueError | If Backend.CUSTOM is used without being registered |
Source code in vllm/v1/attention/backends/mla/prefill/registry.py
_MLAPrefillBackendEnumMeta ¶
Bases: EnumMeta
Metaclass for MLAPrefillBackendEnum to provide better error messages.
Source code in vllm/v1/attention/backends/mla/prefill/registry.py
register_mla_prefill_backend ¶
register_mla_prefill_backend(
backend: MLAPrefillBackendEnum,
class_path: str | None = None,
) -> Callable[[type], type]
Register or override an MLA prefill backend implementation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backend | MLAPrefillBackendEnum | The MLAPrefillBackendEnum member to register. | required |
class_path | str | None | Optional class path. If not provided and used as decorator, will be auto-generated from the class. | None |
Returns:
| Type | Description |
|---|---|
Callable[[type], type] | Decorator function if class_path is None, otherwise a no-op. |
Examples:
Override an existing MLA prefill backend¶
@register_mla_prefill_backend(MLAPrefillBackendEnum.FLASH_ATTN) class MyCustomFlashAttn(MLAPrefillBackend): ...
Register a custom third-party MLA prefill backend¶
@register_mla_prefill_backend(MLAPrefillBackendEnum.CUSTOM) class MyCustomPrefillBackend(MLAPrefillBackend): ...
Direct registration¶
register_mla_prefill_backend( MLAPrefillBackendEnum.CUSTOM, "my.module.MyCustomPrefillBackend" )