The AIPerf plugin system provides a flexible, extensible architecture for customizing benchmark behavior. It uses YAML-based configuration with lazy loading, priority-based conflict resolution, and dynamic enum generation.
The plugin system enables:
Hierarchy:
The plugin registry follows the singleton pattern with module-level exports:
AIPerf supports 33 plugin categories organized by function, including api_router and public_dataset_loader:
Contributing directly to AIPerf? You only need two things:
src/aiperf/src/aiperf/plugin/plugins.yamlThe pyproject.toml entry points and separate package install below are only needed for external/third-party plugins.
Quick Start (4 steps):
Extend base classes (BaseEndpoint, etc.) to get logging, helpers, and default implementations. Only implement core methods.
Defines plugin categories with their protocols and metadata schemas:
Registers plugin implementations:
Category-specific metadata is validated against Pydantic models in aiperf.plugin.schema.schemas:
Shadowed plugins remain accessible via full class path: plugins.get_class("endpoint", "my_pkg.endpoints:MyEndpoint")
Type Safety:
get_class()returns typed results (e.g.,type[EndpointProtocol]) with IDE autocomplete.
Solutions:
plugins.yamlpyproject.tomluv pip install -e .aiperf plugins --validate to check for errorsSolutions:
module.path:ClassNamepython -c "import module.path"Solutions:
aiperf plugins --validate for detailed errorIf your plugin is being shadowed by another:
priority: 10 in plugins.yamlplugins.get_class("endpoint", "my_pkg.endpoints:MyEndpoint")aiperf plugins to see which packages are loaded