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

make ggml_is_view_op public. #11936

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

Conversation

foldl
Copy link
Contributor

@foldl foldl commented Feb 18, 2025

Motivation: ggml_is_view_op is a useful API.

Use case 1

It is used by test-backend-ops.cpp.

Use case 2

llama.cpp/src/llama.cpp

Lines 8178 to 8179 in 73e2ed3

if (ggml_backend_supports_op(backend.get(), cur)) {
ggml_backend_sched_set_tensor_backend(lctx.sched.get(), cur, backend.get());

Let's say cur is a view operation and its source is on another backend, then this would be problematic.
if (ggml_backend_supports_op(backend.get(), cur) && !ggml_is_view_op(cur->op)) seems better.

By the way, PR #10825 is useful for checking (visualizing) these scenarios.

@github-actions github-actions bot added testing Everything test related ggml changes relating to the ggml tensor library for machine learning labels Feb 18, 2025
@ggerganov ggerganov requested a review from slaren February 20, 2025 08:37
Copy link
Member

@slaren slaren left a comment

Choose a reason for hiding this comment

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

This function, if made public, does not belong in ggml-backend.cpp. The obvious location would be ggml.c, but moving it there would prevent inlining this function in ggml-backend.cpp, which is not great since it is used very often in ggml_backend_sched.

@foldl
Copy link
Contributor Author

foldl commented Feb 21, 2025

@slaren, I think view_op is a concept defined by backends, so it is ok to be in ggml-backend.cpp. Then, the question is: Is ggml_is_view_op a good name. How about change it to ggml_backend_is_view_op?

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 testing Everything test related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants