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

Completing default values for enumerations. #650

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

Conversation

GitEventhandler
Copy link

The values of an enum are often used to define constants in a program, which will remain unchanged throughout the program's entire lifecycle. Therefore, manually defining the specific values of an enum will make the code easier to read, porting and prevent accidental modification that could lead to compatibility issues later on.

Completing default values for enumerations. Reduce the possibility of compatibility issues caused by inserting enumeration items during development.
@GitEventhandler GitEventhandler changed the title Update ggml.h Completing default values for enumerations. Dec 14, 2023
@GitEventhandler
Copy link
Author

The purpose of doing this is: when ggml needs to be ported to other programming languages environments, such as ggml-python, programmers do not need to guess the specific values of the enumeration. For example, the following code comes from ggml-python:

# enum ggml_object_type {
#     GGML_OBJECT_TENSOR,
#     # If an enumeration value is inserted here, ggml-python will need to be midified
#     GGML_OBJECT_GRAPH,
#     GGML_OBJECT_WORK_BUFFER
# };
GGML_OBJECT_TENSOR = 0
GGML_OBJECT_GRAPH = 1
GGML_OBJECT_WORK_BUFFER = 2

@gwenzek
Copy link
Contributor

gwenzek commented Dec 15, 2023

this would be useful when debugging python code calling GGML.

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.

2 participants