add unit test for prefix cache tracking scorer#311
Conversation
|
/assign @vMaroon |
|
@zhengkezhou1 kindly please rebase and sign your commits |
|
/cc @vMaroon |
|
all commits are signed now. |
Signed-off-by: zhengkezhou1 <madzhou1@gmail.com>
|
ok, its works now right? |
|
|
||
| for _, tt := range testcases { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| mockScorer := &mockPodScorer{ |
There was a problem hiding this comment.
The precise prefix-cache scorer is a wrapper of the kvcache.Indexer. The wrapping logic is mostly normalization.
What this test ends up doing is test the latter - which is great, but can be achieved by testing the indexedScoresToNormalizedScoredPods function directly instead of using a mock PodScorer interface.
I think this test should verify correctness of the scorer as-is. This would require:
- Access to the indexer's backing
kvblock.Index - Having the test populate the
kvblock.Indexwith kv-block information - Testing correctness of the scorer as-is
There was a problem hiding this comment.
Adding data to the kvblock.Index alone isn't sufficient; we also need to add data to the tokensIndexer. However, the kv-cache-manager currently only allows access to the KVBlockIndex. Can we add a method to the kv-cache-manager to expose the tokensIndexer?
There was a problem hiding this comment.
You can add data to the tokenization cache by making the calls in a "warmup" step (call once, get no scores). Note that this behavior will change soon once tokenization is synchronous, after-which there would be no need for such a step.
|
@vMaroon - have your comments been addressed? If so, please approve so we can merge. |
|
This PR is marked as stale after 21d of inactivity. After an additional 14d of inactivity, it will be closed. To prevent this PR from being closed, add a comment or remove the |

fix #218