Skip to content
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

[minor] Improved repeat_kv eager perf #251

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

awgu
Copy link

@awgu awgu commented Jun 25, 2024

This PR:

  • In forward, this saves 4 aten::slice.
  • In backward, this saves 4 aten::fill and 4 aten::copy_ kernels with shape (bs, seq_len, n_kv_heads, head_dim).

See pytorch/torchtitan#418 for details and traces.

Since this repo is hosting inference (forward-only) code, this change is not significant at all. However, since this repo also hosts the reference model implementation that others base on, even for training, this change could be helpful for others.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Meta Open Source bot.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants