You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Scan aiperf.plugins entry points for plugins.yaml files
2. Loading
Parse YAML, validate with Pydantic, register with conflict resolution
3. Access
get_class() imports module, caches class for reuse
Registry Singleton Pattern
The plugin registry follows the singleton pattern with module-level exports:
fromaiperf.pluginimportpluginsfromaiperf.plugin.enumsimportPluginType# Get a plugin class by nameEndpointClass=plugins.get_class(PluginType.ENDPOINT, "chat")
# Iterate all plugins in a categoryforentry, clsinplugins.iter_all(PluginType.ENDPOINT):
print(f"{entry.name}: {entry.description}")
Plugin Categories
AIPerf supports 25 plugin categories organized by function:
Service orchestration (multiprocessing, Kubernetes)
Visualization and Telemetry Categories
Category
Enum
Description
plot
PlotType
Chart types (scatter, histogram, timeline, etc.)
gpu_telemetry_collector
GPUTelemetryCollectorType
GPU metric collection (DCGM, pynvml)
Infrastructure Categories (Internal)
Category
Enum
Description
communication
CommunicationBackend
ZMQ backends (IPC, TCP, dual-bind)
communication_client
CommClientType
Socket patterns (PUB, SUB, PUSH, PULL)
zmq_proxy
ZMQProxyType
Message routing proxies
Using Plugins
fromaiperf.pluginimportpluginsfromaiperf.plugin.enumsimportPluginType, EndpointType# Get class by name, enum, or full pathChatEndpoint=plugins.get_class(PluginType.ENDPOINT, "chat")
ChatEndpoint=plugins.get_class(PluginType.ENDPOINT, EndpointType.CHAT)
ChatEndpoint=plugins.get_class(PluginType.ENDPOINT, "aiperf.endpoints.openai_chat:ChatEndpoint")
# Iterate pluginsforentry, clsinplugins.iter_all(PluginType.ENDPOINT):
print(f"{entry.name}: {entry.class_path}")
# Get metadata (raw dict or typed)metadata=plugins.get_metadata("endpoint", "chat")
endpoint_meta=plugins.get_endpoint_metadata("chat") # Returns EndpointMetadata
Function
Returns
Use Case
get_class(category, name)
type
Get plugin class
iter_all(category)
Iterator[tuple[PluginEntry, type]]
List all plugins
get_metadata(category, name)
dict
Raw metadata
get_endpoint_metadata(name)
EndpointMetadata
Typed endpoint config
get_transport_metadata(name)
TransportMetadata
Typed transport config
get_plot_metadata(name)
PlotMetadata
Typed plot config
get_service_metadata(name)
ServiceMetadata
Typed service config
Creating Custom Plugins
**Contributing directly to AIPerf?** You only need two things:
1. Add your class under `src/aiperf/`
2. Register it in `src/aiperf/plugin/plugins.yaml`
The pyproject.toml entry points and separate package install below are only needed for external/third-party plugins.
Quick Start (4 steps):
Step
File
Action
1
my_endpoint.py
Create class extending BaseEndpoint
2
plugins.yaml
Register with class path, description, and metadata
# yaml-language-server: $schema=https://raw.githubusercontent.com/ai-dynamo/aiperf/refs/heads/main/src/aiperf/plugin/schema/plugins.schema.json# my_package/plugins.yamlschema_version: "1.0"endpoint:
my_custom:
class: my_package.endpoints.custom_endpoint:MyCustomEndpointdescription: Custom endpoint for my API.metadata: { endpoint_path: /v1/generate, supports_streaming: true, produces_tokens: true, tokenizes_input: true, metrics_title: My Custom Metrics }
Extend base classes (`BaseEndpoint`, etc.) to get logging, helpers, and default implementations. Only implement core methods.
Plugin Configuration
categories.yaml Schema
Defines plugin categories with their protocols and metadata schemas:
# yaml-language-server: $schema=https://raw.githubusercontent.com/ai-dynamo/aiperf/refs/heads/main/src/aiperf/plugin/schema/categories.schema.jsonschema_version: "1.0"endpoint:
protocol: aiperf.endpoints.protocols:EndpointProtocolmetadata_class: aiperf.plugin.schema.schemas:EndpointMetadataenum: EndpointTypedescription: | Endpoints define how to format requests and parse responses for different APIs.internal: false # Set to true for infrastructure categories