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

Refactor unary ops in ggml #405

Merged
merged 7 commits into from
Jul 23, 2023
Merged

Conversation

Ivan-Z
Copy link
Contributor

@Ivan-Z Ivan-Z commented Jul 21, 2023

Resolves #285. Removes duplicated code from unary op constructors to a shared ggml_unary. No changes to usage.

Copy link
Owner

@ggerganov ggerganov left a comment

Choose a reason for hiding this comment

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

Looks good, but a few things need fixes.

I'll push a change now to finalize this

src/ggml.c Show resolved Hide resolved
src/ggml.c Outdated Show resolved Hide resolved
src/ggml.c Outdated Show resolved Hide resolved
src/ggml.c Outdated Show resolved Hide resolved
src/ggml.c Outdated Show resolved Hide resolved
Copy link
Owner

@ggerganov ggerganov left a comment

Choose a reason for hiding this comment

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

What is missing now is to figure out a neat way to print and dump the names of the unary ops, because now it will simply print unary which is not very useful for debugging purposes.

@slaren Do you think this change is OK?

@ggerganov ggerganov requested a review from slaren July 23, 2023 16:18
src/ggml.c Outdated Show resolved Hide resolved
src/ggml.c Outdated Show resolved Hide resolved
@slaren
Copy link
Collaborator

slaren commented Jul 23, 2023

A function that returns the name of a unary op would be useful. Maybe also one that returns either the name of the op or the name of the unary. Something like this:

if (t->op == GGML_OP_UNARY) {
    return ggml_unary_op_name(t);
}
return ggml_op_name(t);

And another similar function for ggml_op_symbol. That should address this:

What is missing now is to figure out a neat way to print and dump the names of the unary ops, because now it will simply print unary which is not very useful for debugging purposes.

@ggerganov ggerganov merged commit be4c8ba into ggerganov:master Jul 23, 2023
2 checks passed
@Ivan-Z
Copy link
Contributor Author

Ivan-Z commented Jul 25, 2023

Thanks for the help @ggerganov @slaren. Do we want to make a similar change for binary ops? There are only a few right now, but might be worth making the change now if ggml intends on supporting more in the future.

@ggerganov
Copy link
Owner

Let's use the unary API for a while and decide later depending on if we like the API or not

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.

ggml : reduce the values of ggml_op enum
4 participants