Documentation
¶
Overview ¶
Package disagg provides profile handler plugins for the epp.
Package disagg provides pre-request plugins for GIE.
Package disagg provides profile handler plugins for the epp.
Package disagg provides profile handler plugin for the epp.
Index ¶
- Constants
- Variables
- func AlwaysDisaggMulimodalDeciderPluginFactory(name string, _ *json.Decoder, _ plugin.Handle) (plugin.Plugin, error)
- func AlwaysDisaggPDDeciderPluginFactory(name string, _ *json.Decoder, _ plugin.Handle) (plugin.Plugin, error)
- func DisaggDecisionType(encodeUsed, prefillUsed bool) string
- func HandlerFactory(name string, rawParameters *json.Decoder, handle plugin.Handle) (plugin.Plugin, error)
- func HeadersHandlerFactory(name string, rawParameters *json.Decoder, _ plugin.Handle) (plugin.Plugin, error)deprecated
- func PdProfileHandlerFactory(name string, rawParameters *json.Decoder, handle plugin.Handle) (plugin.Plugin, error)deprecated
- func PrefixBasedPDDeciderPluginFactory(name string, rawParameters *json.Decoder, handle plugin.Handle) (plugin.Plugin, error)
- func RecordDisaggDecision(pluginName, pluginType, modelName, decisionType string)
- func RecordPDDecision(pluginName, pluginType, modelName, decisionType string)deprecated
- type AlwaysDisaggMultimodalDecider
- type AlwaysDisaggPDDecider
- type Handler
- func (*Handler) Consumes() plugin.DataDependencies
- func (h *Handler) Pick(ctx context.Context, request *scheduling.InferenceRequest, ...) map[string]scheduling.SchedulerProfile
- func (h *Handler) PreRequest(ctx context.Context, request *scheduling.InferenceRequest, ...)
- func (h *Handler) ProcessResults(_ context.Context, request *scheduling.InferenceRequest, ...) (*scheduling.SchedulingResult, error)
- func (h *Handler) TypedName() plugin.TypedName
- func (h *Handler) WithName(name string) *Handler
- type HeadersHandlerdeprecated
- type PdProfileHandlerdeprecated
- func (h *PdProfileHandler) Consumes() plugin.DataDependencies
- func (h *PdProfileHandler) Pick(ctx context.Context, request *scheduling.InferenceRequest, ...) map[string]scheduling.SchedulerProfile
- func (h *PdProfileHandler) ProcessResults(_ context.Context, request *scheduling.InferenceRequest, ...) (*scheduling.SchedulingResult, error)
- func (h *PdProfileHandler) TypedName() plugin.TypedName
- func (h *PdProfileHandler) WithName(name string) *PdProfileHandler
- type PrefixBasedPDDecider
- type PrefixBasedPDDeciderConfig
Constants ¶
const ( // DisaggHeadersHandlerType is the type of the HeadersHandler. // // Deprecated: Use DisaggProfileHandlerType instead, disagg-profile-handler now implements PreRequest natively. DisaggHeadersHandlerType = "disagg-headers-handler" // PrefillHeaderHandlerType is a deprecated alias for DisaggHeadersHandlerType. // // Deprecated: Use DisaggProfileHandlerType instead, disagg-profile-handler now implements PreRequest natively. PrefillHeaderHandlerType = "prefill-header-handler" )
const ( // DecisionTypeDecodeOnly is for requests that are routed to decode instance only. DecisionTypeDecodeOnly = "decode-only" // DecisionTypePrefillDecode is for requests that are gone through P/D or EP/D. DecisionTypePrefillDecode = "prefill-decode" // DecisionTypeEncodeDecode is for requests that are gone through E/PD. DecisionTypeEncodeDecode = "encode-decode" // DecisionTypeEncodePrefillDecode is for requests that are gone through E/P/D. DecisionTypeEncodePrefillDecode = "encode-prefill-decode" )
const (
// AlwaysDisaggMulimodalPluginType is the type-name of the AlwaysDisaggMultimodalDecider plugin.
AlwaysDisaggMulimodalPluginType = "always-disagg-multimodal-decider"
)
const (
// AlwaysDisaggPDDeciderPluginType is the type-name of the alwaysDisaggPDDecider plugin.
AlwaysDisaggPDDeciderPluginType = "always-disagg-pd-decider"
)
const (
// DisaggProfileHandlerType is the canonical type for the unified disaggregation profile handler.
DisaggProfileHandlerType = "disagg-profile-handler"
)
const (
// PdProfileHandlerType is a legacy alias for DisaggProfileHandlerType.
PdProfileHandlerType = "pd-profile-handler"
)
const (
// PrefixBasedPDDeciderPluginType is the type-name of the prefixBasedPDDecider plugin.
PrefixBasedPDDeciderPluginType = "prefix-based-pd-decider"
)
Variables ¶
var ( // SchedulerPDDecisionCount records request P/D decision. // // Deprecated: Use LlmdPDDecisionCount instead. // Tracked in: https://github.com/llm-d/llm-d-inference-scheduler/issues/1070 SchedulerPDDecisionCount = prometheus.NewCounterVec( prometheus.CounterOpts{ Subsystem: eppmetrics.SchedulerSubsystem, Name: "pd_decision_total", Help: metricsutil.HelpMsgWithStability("[Deprecated: Use llm_d_epp_pd_decision_total] Total number of P/D disaggregation decisions made", compbasemetrics.ALPHA), }, []string{"model_name", "decision_type"}, ) // LlmdPDDecisionCount records request P/D decision. LlmdPDDecisionCount = prometheus.NewCounterVec( prometheus.CounterOpts{ Subsystem: eppmetrics.LLMDRouterEndpointPickerSubsystem, Name: "pd_decision_total", Help: metricsutil.HelpMsgWithStability("Total number of P/D disaggregation decisions made", compbasemetrics.ALPHA), }, []string{"plugin_name", "plugin_type", "model_name", "decision_type"}, ) // SchedulerDisaggDecisionCount records disaggregation routing decisions, // covering all stages: decode-only, prefill-decode, encode-decode, encode-prefill-decode. // // Deprecated: Use llm_d_epp_disagg_decision_total instead. // Tracked in: https://github.com/llm-d/llm-d-inference-scheduler/issues/1070 SchedulerDisaggDecisionCount = prometheus.NewCounterVec( prometheus.CounterOpts{ Subsystem: eppmetrics.SchedulerSubsystem, Name: "disagg_decision_total", Help: metricsutil.HelpMsgWithStability("[Deprecated: Use llm_d_epp_disagg_decision_total] Total number of disaggregation routing decisions made", compbasemetrics.ALPHA), }, []string{"model_name", "decision_type"}, ) // LlmdDisaggDecisionCount records disaggregation routing decisions. LlmdDisaggDecisionCount = prometheus.NewCounterVec( prometheus.CounterOpts{ Subsystem: eppmetrics.LLMDRouterEndpointPickerSubsystem, Name: "disagg_decision_total", Help: metricsutil.HelpMsgWithStability("Total number of disaggregation routing decisions made", compbasemetrics.ALPHA), }, []string{"plugin_name", "plugin_type", "model_name", "decision_type"}, ) )
Functions ¶
func AlwaysDisaggMulimodalDeciderPluginFactory ¶
func AlwaysDisaggMulimodalDeciderPluginFactory(name string, _ *json.Decoder, _ plugin.Handle) (plugin.Plugin, error)
AlwaysDisaggMulimodalDeciderPluginFactory defines the factory function for creating a new instance of the AlwaysDisaggEncodeDecider.
func AlwaysDisaggPDDeciderPluginFactory ¶
func AlwaysDisaggPDDeciderPluginFactory(name string, _ *json.Decoder, _ plugin.Handle) (plugin.Plugin, error)
AlwaysDisaggPDDeciderPluginFactory defines the factory function for creating a new instance of the AlwaysDisaggPDDecider.
func DisaggDecisionType ¶
DisaggDecisionType returns the DecisionType* constant corresponding to which disaggregation stages were used for a request.
func HandlerFactory ¶
func HandlerFactory(name string, rawParameters *json.Decoder, handle plugin.Handle) (plugin.Plugin, error)
HandlerFactory is the unified factory for all disaggregation profile handlers.
if parameters.deciders.prefill is set - P disaggregation will be supported if parameters.deciders.encode is set - E disaggregation will be supported
func HeadersHandlerFactory
deprecated
func PrefixBasedPDDeciderPluginFactory ¶
func PrefixBasedPDDeciderPluginFactory(name string, rawParameters *json.Decoder, handle plugin.Handle) (plugin.Plugin, error)
PrefixBasedPDDeciderPluginFactory defines the factory function for creating a new instance of the prefixBasedPDDecider.
func RecordDisaggDecision ¶
func RecordDisaggDecision(pluginName, pluginType, modelName, decisionType string)
RecordDisaggDecision increments the counter for a disaggregation routing decision. The decisionType must be one of the DecisionType* constants (DecisionTypeDecodeOnly, DecisionTypePrefillDecode, DecisionTypeEncodeDecode, DecisionTypeEncodePrefillDecode). The model parameter should be the target model name; if empty, "unknown" is used.
func RecordPDDecision
deprecated
func RecordPDDecision(pluginName, pluginType, modelName, decisionType string)
RecordPDDecision increments the counter for a specific P/D routing decision.
Deprecated: Use RecordDisaggDecision instead.
Types ¶
type AlwaysDisaggMultimodalDecider ¶
type AlwaysDisaggMultimodalDecider struct {
// contains filtered or unexported fields
}
AlwaysDisaggMultimodalDecider is an EP decider plugin which always decides to encode.
func (*AlwaysDisaggMultimodalDecider) TypedName ¶
func (d *AlwaysDisaggMultimodalDecider) TypedName() plugin.TypedName
TypedName returns the typed name of the plugin.
func (*AlwaysDisaggMultimodalDecider) WithName ¶
func (d *AlwaysDisaggMultimodalDecider) WithName(name string) *AlwaysDisaggMultimodalDecider
WithName sets the name of the plugin.
type AlwaysDisaggPDDecider ¶
type AlwaysDisaggPDDecider struct {
// contains filtered or unexported fields
}
AlwaysDisaggPDDecider is a PD decider plugin which always decide to disaggregate PD
func (*AlwaysDisaggPDDecider) TypedName ¶
func (d *AlwaysDisaggPDDecider) TypedName() plugin.TypedName
TypedName returns the typed name of the plugin.
func (*AlwaysDisaggPDDecider) WithName ¶
func (d *AlwaysDisaggPDDecider) WithName(name string) *AlwaysDisaggPDDecider
WithName sets the name of the plugin.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the unified disaggregation profile handler. It drives one or more of the following stages, each optional except decode:
- Encode (E): schedules encoder pods for multimodal content
- Prefill (P): schedules a prefill pod for KV-cache disaggregation
- Decode (D): schedules the decode pod (always runs first)
All four handler types (D, P/D, E/PD, E/P/D) share this single implementation; active stages are selected by setting encodeProfile / prefillProfile.
func NewDisaggProfileHandler ¶
func NewDisaggProfileHandler(decodeProfile, prefillProfile, encodeProfile string, pdDecider, encodeDecider deciderPlugin) *Handler
NewDisaggProfileHandler creates a Handler directly. Active stages are determined by non-empty deciders.
func (*Handler) Consumes ¶
func (*Handler) Consumes() plugin.DataDependencies
Consumes defines data types consumed by this plugin (through the PD decider).
func (*Handler) Pick ¶
func (h *Handler) Pick(ctx context.Context, request *scheduling.InferenceRequest, profiles map[string]scheduling.SchedulerProfile, profileResults map[string]*scheduling.ProfileRunResult) map[string]scheduling.SchedulerProfile
Pick implements scheduling.ProfileHandler. Stages run in order: decode → encode (optional) → prefill (optional). Returns the next profile to execute, or an empty map when all stages are done.
func (*Handler) PreRequest ¶
func (h *Handler) PreRequest(ctx context.Context, request *scheduling.InferenceRequest, schedulingResult *scheduling.SchedulingResult)
PreRequest wires prefill and encode SchedulerProfile results into headers so the sidecar knows which pods to contact for disaggregated work.
func (*Handler) ProcessResults ¶
func (h *Handler) ProcessResults( _ context.Context, request *scheduling.InferenceRequest, profileResults map[string]*scheduling.ProfileRunResult, ) (*scheduling.SchedulingResult, error)
ProcessResults implements scheduling.ProfileHandler. Builds the final SchedulingResult from whichever stages ran successfully.
type HeadersHandler
deprecated
type HeadersHandler struct {
// contains filtered or unexported fields
}
HeadersHandler PreRequest plugin that sets both prefill and encode disaggregation headers.
Deprecated: Use Handler instead, disagg-profile-handler now implements PreRequest natively.
func NewHeadersHandler
deprecated
func NewHeadersHandler(prefillProfile, encodeProfile string) *HeadersHandler
NewHeadersHandler initializes a new HeadersHandler and returns its pointer.
Deprecated: Use NewDisaggProfileHandler instead, disagg-profile-handler now implements PreRequest natively.
func (*HeadersHandler) PreRequest ¶
func (p *HeadersHandler) PreRequest(ctx context.Context, request *scheduling.InferenceRequest, schedulingResult *scheduling.SchedulingResult)
PreRequest wires prefill and encode SchedulerProfile results into headers to indicate disaggregation workers.
func (*HeadersHandler) TypedName ¶
func (p *HeadersHandler) TypedName() plugin.TypedName
TypedName returns the typed name of the plugin.
func (*HeadersHandler) WithName ¶
func (p *HeadersHandler) WithName(name string) *HeadersHandler
WithName sets the name of the plugin.
type PdProfileHandler
deprecated
type PdProfileHandler struct {
// contains filtered or unexported fields
}
PdProfileHandler handles scheduler profiles for PD.
Deprecated: Use Handler instead.
func NewPdProfileHandler
deprecated
func NewPdProfileHandler(name string, parameters pdProfileHandlerParameters, deciderPlugin deciderPlugin) (*PdProfileHandler, error)
NewPdProfileHandler initializes a new PdProfileHandler and returns its pointer.
Deprecated: Use NewDisaggProfileHandler instead.
func (*PdProfileHandler) Consumes ¶
func (h *PdProfileHandler) Consumes() plugin.DataDependencies
Consumes defines data types consumed by this plugin (through the PD decider).
func (*PdProfileHandler) Pick ¶
func (h *PdProfileHandler) Pick(ctx context.Context, request *scheduling.InferenceRequest, profiles map[string]scheduling.SchedulerProfile, profileResults map[string]*scheduling.ProfileRunResult) map[string]scheduling.SchedulerProfile
Pick selects the SchedulingProfiles to run from the list of candidate profiles, while taking into consideration the request properties and the previously executed cycles along with their results.
func (*PdProfileHandler) ProcessResults ¶
func (h *PdProfileHandler) ProcessResults(_ context.Context, request *scheduling.InferenceRequest, profileResults map[string]*scheduling.ProfileRunResult) (*scheduling.SchedulingResult, error)
ProcessResults handles the outcome of the profile runs after the selected profiles ran. In case of an error in any of the profiles, the matching entry in the profileResults will contain nil, to indicate there was an error while running the profile.
func (*PdProfileHandler) TypedName ¶
func (h *PdProfileHandler) TypedName() plugin.TypedName
TypedName returns the typed name of the plugin.
func (*PdProfileHandler) WithName ¶
func (h *PdProfileHandler) WithName(name string) *PdProfileHandler
WithName sets the name of the plugin.
type PrefixBasedPDDecider ¶
type PrefixBasedPDDecider struct {
// contains filtered or unexported fields
}
PrefixBasedPDDecider is a PD decider plugin which decision is based prefix aware
func NewPrefixBasedPDDecider ¶
func NewPrefixBasedPDDecider(config PrefixBasedPDDeciderConfig) (*PrefixBasedPDDecider, error)
NewPrefixBasedPDDecider initializes a NewPrefixBasedPDDecider prefix based PD decider Plugin and returns its pointer. If the configuration is invalid an error is returned.
func (*PrefixBasedPDDecider) TypedName ¶
func (d *PrefixBasedPDDecider) TypedName() plugin.TypedName
TypedName returns the typed name of the plugin.
func (*PrefixBasedPDDecider) WithName ¶
func (d *PrefixBasedPDDecider) WithName(name string) *PrefixBasedPDDecider
WithName sets the name of the plugin.
type PrefixBasedPDDeciderConfig ¶
type PrefixBasedPDDeciderConfig struct {
// NonCachedTokens non cached minimum tokens that triggers disaggregated PD
NonCachedTokens int `json:"nonCachedTokens"`
}
PrefixBasedPDDeciderConfig holds the configuration for the prefixBasedPDDecider plugin.