Skip to content

CUDA: fix negative KV_max values in FA #15321

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

Merged
merged 1 commit into from
Aug 14, 2025

Conversation

JohannesGaessler
Copy link
Collaborator

Looking at the code I noticed that, depending on the inputs, there are scenarios where the values in KV_max could become negative. For this to happen there would need to be 16 consecutive tokens that are completely masked out, and the physical batch size would need to be >= 1024. I'm not sure this is going to fix #15294 or #15112 but it should be fixed either way since it could be causing problems in the future.

@JohannesGaessler
Copy link
Collaborator Author

JohannesGaessler commented Aug 14, 2025

I was able to reproduce the issue with the model getting stuck in #15294 and it seems to be fixed by this PR.

The conditions for triggering the issue seem to be inconsistent and I misinterpreted the results I got.

@github-actions github-actions bot added Nvidia GPU Issues specific to Nvidia GPUs ggml changes relating to the ggml tensor library for machine learning labels Aug 14, 2025
@JohannesGaessler JohannesGaessler merged commit 4227c9b into ggml-org:master Aug 14, 2025
42 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ggml changes relating to the ggml tensor library for machine learning Nvidia GPU Issues specific to Nvidia GPUs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Eval bug: Possible CUDA syncronization bug between devices.
2 participants