Skip to content

Commit 216d5bf

Browse files
authored
renamed kvcache-scorer to kvcache-utilization-scorer (#1238)
Signed-off-by: Nir Rozenbaum <[email protected]>
1 parent d849810 commit 216d5bf

File tree

9 files changed

+28
-29
lines changed

9 files changed

+28
-29
lines changed

cmd/epp/runner/runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ func (r *Runner) registerInTreePlugins() {
375375
plugins.Register(picker.MaxScorePickerType, picker.MaxScorePickerFactory)
376376
plugins.Register(picker.RandomPickerType, picker.RandomPickerFactory)
377377
plugins.Register(profile.SingleProfileHandlerType, profile.SingleProfileHandlerFactory)
378-
plugins.Register(scorer.KvCacheScorerType, scorer.KvCacheScorerFactory)
378+
plugins.Register(scorer.KvCacheUtilizationScorerType, scorer.KvCacheUtilizationScorerFactory)
379379
plugins.Register(scorer.QueueScorerType, scorer.QueueScorerFactory)
380380
// register filter for test purpose only (used in conformance tests)
381381
plugins.Register(testfilter.HeaderBasedTestingFilterType, testfilter.HeaderBasedTestingFilterFactory)

config/charts/inferencepool/templates/epp-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ data:
5959
kind: EndpointPickerConfig
6060
plugins:
6161
- type: queue-scorer
62-
- type: kv-cache-scorer
62+
- type: kv-cache-utilization-scorer
6363
- type: prefix-cache-scorer
6464
parameters:
6565
hashBlockSize: 64
@@ -74,7 +74,7 @@ data:
7474
plugins:
7575
- pluginRef: queue-scorer
7676
weight: 1
77-
- pluginRef: kv-cache-scorer
77+
- pluginRef: kv-cache-utilization-scorer
7878
weight: 1
7979
- pluginRef: prefix-cache-scorer
8080
weight: 1

config/manifests/inferencepool-resources.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ data:
153153
kind: EndpointPickerConfig
154154
plugins:
155155
- type: queue-scorer
156-
- type: kv-cache-scorer
156+
- type: kv-cache-utilization-scorer
157157
- type: prefix-cache-scorer
158158
parameters:
159159
hashBlockSize: 64
@@ -168,7 +168,7 @@ data:
168168
plugins:
169169
- pluginRef: queue-scorer
170170
weight: 1
171-
- pluginRef: kv-cache-scorer
171+
- pluginRef: kv-cache-utilization-scorer
172172
weight: 1
173173
- pluginRef: prefix-cache-scorer
174174
weight: 1

pkg/epp/scheduling/framework/plugins/filter/filter_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ func TestDecisionTreeFilterFactory(t *testing.T) {
271271
loraAffinityFilter := NewLoraAffinityFilter(config.Conf.LoraAffinityThreshold)
272272
lowQueueFilter := NewLowQueueFilter(config.Conf.QueueingThresholdLoRA)
273273

274-
kvCacheScorer := scorer.NewKVCacheScorer()
274+
kvCacheScorer := scorer.NewKVCacheUtilizationScorer()
275275

276276
testHandle := utils.NewTestHandle(context.Background())
277277

@@ -365,7 +365,7 @@ func TestDecisionTreeFilterFactory(t *testing.T) {
365365
}
366366

367367
cmpOptions := cmpopts.IgnoreUnexported(LeastKVCacheFilter{}, LeastQueueFilter{},
368-
LoraAffinityFilter{}, LowQueueFilter{}, scorer.KVCacheScorer{}, plugins.TypedName{})
368+
LoraAffinityFilter{}, LowQueueFilter{}, scorer.KVCacheUtilizationScorer{}, plugins.TypedName{})
369369

370370
for _, test := range tests {
371371
rawParameters := struct {

pkg/epp/scheduling/framework/plugins/scorer/kvcache.go renamed to pkg/epp/scheduling/framework/plugins/scorer/kvcache_utilization.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,42 +26,42 @@ import (
2626
)
2727

2828
const (
29-
KvCacheScorerType = "kv-cache-scorer"
29+
KvCacheUtilizationScorerType = "kv-cache-utilization-scorer"
3030
)
3131

3232
// compile-time type assertion
33-
var _ framework.Scorer = &KVCacheScorer{}
33+
var _ framework.Scorer = &KVCacheUtilizationScorer{}
3434

35-
// KvCacheScorerFactory defines the factory function for KVCacheScorer.
36-
func KvCacheScorerFactory(name string, _ json.RawMessage, _ plugins.Handle) (plugins.Plugin, error) {
37-
return NewKVCacheScorer().WithName(name), nil
35+
// KvCacheUtilizationScorerFactory defines the factory function for KVCacheUtilizationScorer.
36+
func KvCacheUtilizationScorerFactory(name string, _ json.RawMessage, _ plugins.Handle) (plugins.Plugin, error) {
37+
return NewKVCacheUtilizationScorer().WithName(name), nil
3838
}
3939

40-
// NewKVCacheScorer initializes a new KVCacheScorer and returns its pointer.
41-
func NewKVCacheScorer() *KVCacheScorer {
42-
return &KVCacheScorer{
43-
typedName: plugins.TypedName{Type: KvCacheScorerType, Name: KvCacheScorerType},
40+
// NewKVCacheUtilizationScorer initializes a new KVCacheUtilizationScorer and returns its pointer.
41+
func NewKVCacheUtilizationScorer() *KVCacheUtilizationScorer {
42+
return &KVCacheUtilizationScorer{
43+
typedName: plugins.TypedName{Type: KvCacheUtilizationScorerType, Name: KvCacheUtilizationScorerType},
4444
}
4545
}
4646

47-
// KVCacheScorer scores list of candidate pods based on KV cache utilization.
48-
type KVCacheScorer struct {
47+
// KVCacheUtilizationScorer scores list of candidate pods based on KV cache utilization.
48+
type KVCacheUtilizationScorer struct {
4949
typedName plugins.TypedName
5050
}
5151

5252
// TypedName returns the type and name tuple of this plugin instance.
53-
func (s *KVCacheScorer) TypedName() plugins.TypedName {
53+
func (s *KVCacheUtilizationScorer) TypedName() plugins.TypedName {
5454
return s.typedName
5555
}
5656

5757
// WithName sets the name of the scorer.
58-
func (s *KVCacheScorer) WithName(name string) *KVCacheScorer {
58+
func (s *KVCacheUtilizationScorer) WithName(name string) *KVCacheUtilizationScorer {
5959
s.typedName.Name = name
6060
return s
6161
}
6262

6363
// Score returns the scoring result for the given list of pods based on context.
64-
func (s *KVCacheScorer) Score(_ context.Context, _ *types.CycleState, _ *types.LLMRequest, pods []types.Pod) map[types.Pod]float64 {
64+
func (s *KVCacheUtilizationScorer) Score(_ context.Context, _ *types.CycleState, _ *types.LLMRequest, pods []types.Pod) map[types.Pod]float64 {
6565
scores := make(map[types.Pod]float64, len(pods))
6666
for _, pod := range pods {
6767
scores[pod] = 1 - pod.GetMetrics().KVCacheUsagePercent

pkg/epp/scheduling/framework/plugins/scorer/kvcache_test.go renamed to pkg/epp/scheduling/framework/plugins/scorer/kvcache_utilization_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import (
2727
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/types"
2828
)
2929

30-
func TestKvCacheScorer(t *testing.T) {
30+
func TestKvCacheUtilizationScorer(t *testing.T) {
3131
tests := []struct {
3232
name string
3333
pods []types.Pod
@@ -83,8 +83,7 @@ func TestKvCacheScorer(t *testing.T) {
8383

8484
for _, test := range tests {
8585
t.Run(test.name, func(t *testing.T) {
86-
scorer := &KVCacheScorer{}
87-
scores := scorer.Score(context.Background(), types.NewCycleState(), &types.LLMRequest{}, test.pods)
86+
scores := NewKVCacheUtilizationScorer().Score(context.Background(), types.NewCycleState(), &types.LLMRequest{}, test.pods)
8887

8988
for i, pod := range test.pods {
9089
expectedScore := test.expectedScoresPod[i]

site-src/guides/epp-configuration/config-text.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ Picks a random pod from the list of candidates.
250250

251251
Scores the candidate pods based on their KV cache utilization.
252252

253-
- *Type*: kv-cache-scorer
253+
- *Type*: kv-cache-utilization-scorer
254254
- *Parameters*: none
255255

256256
#### **QueueScorer**

site-src/guides/inferencepool-rollout.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ data:
355355
kind: EndpointPickerConfig
356356
plugins:
357357
- type: queue-scorer
358-
- type: kv-cache-scorer
358+
- type: kv-cache-utilization-scorer
359359
- type: prefix-cache-scorer
360360
parameters:
361361
hashBlockSize: 64
@@ -370,7 +370,7 @@ data:
370370
plugins:
371371
- pluginRef: queue-scorer
372372
weight: 1
373-
- pluginRef: kv-cache-scorer
373+
- pluginRef: kv-cache-utilization-scorer
374374
weight: 1
375375
- pluginRef: prefix-cache-scorer
376376
weight: 1

test/testdata/inferencepool-e2e.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ data:
150150
kind: EndpointPickerConfig
151151
plugins:
152152
- type: queue-scorer
153-
- type: kv-cache-scorer
153+
- type: kv-cache-utilization-scorer
154154
- type: prefix-cache-scorer
155155
parameters:
156156
hashBlockSize: 64
@@ -165,7 +165,7 @@ data:
165165
plugins:
166166
- pluginRef: queue-scorer
167167
weight: 1
168-
- pluginRef: kv-cache-scorer
168+
- pluginRef: kv-cache-utilization-scorer
169169
weight: 1
170170
- pluginRef: prefix-cache-scorer
171171
weight: 1

0 commit comments

Comments
 (0)