Skip to content

[Unity][Support] PagedKVCache support growth control#16112

Merged
junrushao merged 1 commit intoapache:unityfrom
MasterJH5574:unity-dev/2023-11-11-cache-grow
Nov 12, 2023
Merged

[Unity][Support] PagedKVCache support growth control#16112
junrushao merged 1 commit intoapache:unityfrom
MasterJH5574:unity-dev/2023-11-11-cache-grow

Conversation

@MasterJH5574
Copy link
Contributor

This PR supports controlling whether KV cache automatic growth is allowed through constructor parameter. Previously we always allow the KV cache to grow whenever it is full and more capacity is demanded.

Although automatic growth can be good, in practice we often want the pre-allocated memory to be static, large enough and not changeable, which will make the memory management more controllable. Hence, this PR supports to specify if growth is allowed, and will throw error when growing in unallowed cases.

This PR also adds an auxiliary function to KV cache to query the number of available pages.

This PR supports controlling whether KV cache automatic
growth is allowed through constructor parameter. Previously
we always allow the KV cache to grow whenever it is full
and more capacity is demanded.

Although automatic growth can be good, in practice we
often want the pre-allocated memory to be static, large enough
and not changeable, which will make the memory management more
controllable. Hence, this PR supports to specify if growth
is allowed, and will throw error when growing in unallowed cases.

This PR also adds an auxiliary function to KV cache to query
the number of available pages.
@junrushao junrushao merged commit 7a0c3f9 into apache:unity Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants