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

Incorrect Error Handling in ggml_backend_graph_compute Function in example/magika/main.cpp #760

Closed
charloco opened this issue Mar 7, 2024 · 1 comment

Comments

@charloco
Copy link

charloco commented Mar 7, 2024

Describe the bug
There seems to be an error in the error handling logic of the ggml_backend_graph_compute function. The function returns a status code of 0 when it executes successfully. However, the current logic treats a successful execution as an error due to the use of the logical NOT operator (!).

To Reproduce
Here is the problematic code snippet:

if (!ggml_backend_graph_compute(model.backend, gf)) {
    fprintf(stderr, "%s: ggml_backend_graph_compute() failed\n", __func__);
    return false;
}

Expected behavior The if condition should not be negated. The correct code should be:

if (ggml_backend_graph_compute(model.backend, gf) != GGML_STATUS_SUCCESS) {
    fprintf(stderr, "%s: ggml_backend_graph_compute() failed\n", __func__);
    return false;
}
@slaren slaren closed this as completed in f5adbb0 Mar 7, 2024
@slaren
Copy link
Collaborator

slaren commented Mar 7, 2024

Should be fixed now, thanks.

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

No branches or pull requests

2 participants