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

vulkan : improve ggml_vk_create_buffer error handling #9898

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

Conversation

FanShupei
Copy link
Contributor

This PR solves a segfault on Mali GPU. Sorry I can't give an easy reproduction since I can't reproduce it on my desktop GPU.

In ggml_vk_create_buffer, when device->device.createBuffer throws an exception (e.g. out of memory if size is too large), the program will crash. Note in this case buf->size is already set but buf->device is not set, the destructor of vk_buffer_struct will cause trouble since its device is invalid.

The PR solves the problem by setting buf->size only at the end of success path. Now when the context length is too long or model is too large, it will print a proper error message instead of segfault.

@github-actions github-actions bot added Vulkan Issues specific to the Vulkan backend ggml changes relating to the ggml tensor library for machine learning labels Oct 15, 2024
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 Vulkan Issues specific to the Vulkan backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant