-
Notifications
You must be signed in to change notification settings - Fork 200
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
Prefix caching improvements #758
Prefix caching improvements #758
Conversation
namespace ov { | ||
namespace genai { | ||
size_t Sequence::_make_hash(size_t content_length) { | ||
auto sequence_group = get_sequence_group_ptr(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to add an assert that content_length corresponds to last uncomputed block? E.g. if we have 1 block with has, but content_length is 3x of block_size.
E.g. block_start_idx / block_size == m_prefix_hashes.size()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a case when block_start_idx / block_size < m_prefix_hashes.size()
.
When we restore blocks of prompt first we check hash of full block and it is saved in m_prefix_hashes
, then if we couldn't find hash of full block in cashed_blocks
we check hashes of partially completed content of this block. So content_length
in this case is less than m_prefix_hashes.size() * block_size
.
So I added assert block_start_idx / block_size <= m_prefix_hashes.size()
.
Applied comments from #675