Skip to content

Conversation

@ochougul
Copy link
Contributor

@ochougul ochougul commented Oct 2, 2025

Should improve perf for models that use sliding window like gemma, mistral etc.

Signed-off-by: Onkar Chougule <ochougul@qti.qualcomm.com>
# Original Gather
ctx_len = self.key_cache[layer_idx].shape[2]
ctx_indices = torch.arange(ctx_len)[None, None, ...]
gather_limit = kv_position_ids.max(1, keepdim=True).values.unsqueeze(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are using position_ids it would go overboard for sliding window right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes and it won't affect the ctx_indices, there will be no invalid values in that case

@quic-mamta
Copy link
Contributor

These changes has been taken in #616

@quic-mamta quic-mamta closed this Nov 17, 2025
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.

4 participants