Skip to content

Provide a way to enable the PDFilter #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ To enable LoadAwareScorer, the following env vars must be configured:
export ENABLE_LOAD_AWARE_SCORER=true
export LOAD_AWARE_SCORER_WEIGHT=1.0
```

To enable PDFilter, the following env var must be configured:
```
export ENABLE_PD_FILTER=true
```
---
[Inference Gateways]:#concepts-and-definitions

Expand Down Expand Up @@ -96,8 +101,8 @@ See our website at https://gateway-api-inference-extension.sigs.k8s.io/ for deta
## Roadmap

As Inference Gateway builds towards a GA release. We will continue to expand our capabilities, namely:
1. Prefix-cache aware load balancing with interfaces for remote caches
1. Recommended LoRA adapter pipeline for automated rollout
1. Prefix-cache aware load balancing with interfaces for remote caches
1. Recommended LoRA adapter pipeline for automated rollout
1. Fairness and priority between workloads within the same criticality band
1. HPA support for autoscaling on aggregate metrics derived from the load balancer
1. Support for large multi-modal inputs and outputs
Expand All @@ -121,4 +126,3 @@ Contributions are readily welcomed, follow the [dev guide](./docs/dev.md) to sta
### Code of conduct

Participation in the Kubernetes community is governed by the [Kubernetes Code of Conduct](code-of-conduct.md).

16 changes: 16 additions & 0 deletions pkg/epp/scheduling/local_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ package scheduling

import (
"context"

"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/plugins/filter"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/plugins/picker"
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/plugins/scorer"
envutil "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/util/env"
Expand All @@ -28,6 +30,7 @@ import (
const (
kvCacheScorerEnablementEnvVar = "ENABLE_KVCACHE_AWARE_SCORER"
loadAwareScorerEnablementEnvVar = "ENABLE_LOAD_AWARE_SCORER"
pdFilterEnablementEnvVar = "ENABLE_PD_FILTER"

kvCacheScorerWeightEnvVar = "KVCACHE_AWARE_SCORER_WEIGHT"
loadAwareScorerWeightEnvVar = "LOAD_AWARE_SCORER_WEIGHT"
Expand All @@ -38,6 +41,7 @@ func setDefaultConfig() {
// this configuration is a temporary state, it should be better streamlined.
setLoadAwareScorer()
setKVCacheAwareScorer()
setPDFilter()

defaultConfig.picker = picker.NewMaxScorePicker()
}
Expand Down Expand Up @@ -75,3 +79,15 @@ func setKVCacheAwareScorer() {
defaultConfig.scorers[kvCacheScorer] = kvCacheScorerWeight
loggerDebug.Info("Initialized KVCacheAwareScorer", "weight", kvCacheScorerWeight)
}

func setPDFilter() {
ctx := context.Background()
loggerDebug := log.FromContext(ctx).WithName("scheduler_config").V(logutil.DEBUG)

if envutil.GetEnvString(pdFilterEnablementEnvVar, "false", loggerDebug) != "true" {
loggerDebug.Info("Skipping PDFilter creation as it is not enabled")
return
}

defaultConfig.filters = append(defaultConfig.filters, filter.PDFilter)
}