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

metal : add debug capture backend function #694

Merged
merged 2 commits into from
Jan 29, 2024

Conversation

jmousseau
Copy link
Contributor

ggml_backend_metal_capture_next_compute will capture all command buffers the next time ggml_backend_graph_compute is called, simplifying the Metal debugger workflow.

// Example usage
if (ggml_backend_is_metal(model.backend)) {
    ggml_backend_metal_capture_next_compute(model.backend);
}

@@ -109,6 +109,9 @@ GGML_API ggml_backend_buffer_type_t ggml_backend_metal_buffer_type(void);
// ref: https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf
GGML_API bool ggml_backend_metal_supports_family(ggml_backend_t backend, int family);

// capture all command buffers committed the next time `ggml_backend_graph_compute` is called
GGML_API void ggml_backend_metal_capture_next_compute(ggml_backend_t backend);
Copy link
Owner

Choose a reason for hiding this comment

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

@slaren Is it a good idea to extend the backend API with these type of calls or should we try to avoid it. In this case, it could remain a compile-time option (ggerganov/llama.cpp@2a7c94d), but it might be useful to control at runtime in some cases

Copy link
Collaborator

Choose a reason for hiding this comment

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

Generally I don't see an issue with adding more backend-specific functions, as long as they are not required for normal usage.

@ggerganov ggerganov merged commit a120e20 into ggerganov:master Jan 29, 2024
4 checks passed
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.

None yet

3 participants