@@ -26,42 +26,42 @@ import (
26
26
)
27
27
28
28
const (
29
- KvCacheScorerType = "kv-cache-scorer"
29
+ KvCacheUtilizationScorerType = "kv-cache-utilization -scorer"
30
30
)
31
31
32
32
// compile-time type assertion
33
- var _ framework.Scorer = & KVCacheScorer {}
33
+ var _ framework.Scorer = & KVCacheUtilizationScorer {}
34
34
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
38
38
}
39
39
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 },
44
44
}
45
45
}
46
46
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 {
49
49
typedName plugins.TypedName
50
50
}
51
51
52
52
// 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 {
54
54
return s .typedName
55
55
}
56
56
57
57
// WithName sets the name of the scorer.
58
- func (s * KVCacheScorer ) WithName (name string ) * KVCacheScorer {
58
+ func (s * KVCacheUtilizationScorer ) WithName (name string ) * KVCacheUtilizationScorer {
59
59
s .typedName .Name = name
60
60
return s
61
61
}
62
62
63
63
// 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 {
65
65
scores := make (map [types.Pod ]float64 , len (pods ))
66
66
for _ , pod := range pods {
67
67
scores [pod ] = 1 - pod .GetMetrics ().KVCacheUsagePercent
0 commit comments