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

Parallel RoPE on metal #3024

Merged
merged 2 commits into from
Sep 7, 2023
Merged

Parallel RoPE on metal #3024

merged 2 commits into from
Sep 7, 2023

Conversation

ikawrakow
Copy link
Contributor

@ikawrakow ikawrakow commented Sep 5, 2023

Brings a small improvement in TG (~2%).

But the main utility of this PR is to allow for a future change where the KV cache is stored before the RoPE operation, and therefore RoPE needs to be redone for every new token, without major impact on performance as we would have with the current RoPE implementation on metal.

I don't have a Neox model handy, can someone check that I didn't break it? Thanks.

ggml-metal.metal Outdated Show resolved Hide resolved
@ggerganov ggerganov added the need feedback Testing and feedback with results are needed label Sep 5, 2023
@ikawrakow
Copy link
Contributor Author

Nobody seems to be objecting. So, merge and see?

@ggerganov
Copy link
Owner

I just tested Flacon 7B (it is a GPT NeoX model) and it looks like we have broken Metal inference somewhere along the way because master produces junk with Metal. Will first need to fix that and then will check this PR

@ggerganov
Copy link
Owner

ggerganov commented Sep 7, 2023

Looks like something related to Falcon also broke in ca82cf7

Using the previous commit (6a31a3b), text generation is OK

Edit: b7f2aa9 also does not work, so it definitely looks the problem is in ca82cf7

@ikawrakow
Copy link
Contributor Author

Fixed the issue observed for Falcon in #3060. If I then cherry-pick the #3060 commit into this branch, Falcon continues to work with this RoPE implementation.

@ggerganov ggerganov merged commit be8c9c2 into master Sep 7, 2023
6 checks passed
@ikawrakow ikawrakow deleted the ik/metal_rope branch September 24, 2023 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need feedback Testing and feedback with results are needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants