Skip to content

code : normalize enum names - #5697

Merged
ggerganov merged 3 commits into
masterfrom
gg/normalize-enums
Feb 25, 2024
Merged

code : normalize enum names#5697
ggerganov merged 3 commits into
masterfrom
gg/normalize-enums

Conversation

@ggerganov

Copy link
Copy Markdown
Member

I noticed we haven't been very consistent with naming the enums. For example:

    // here we repeat the full enum name and add suffix
    enum llama_token_type {
        LLAMA_TOKEN_TYPE_UNDEFINED    = 0,
        LLAMA_TOKEN_TYPE_NORMAL       = 1,
        LLAMA_TOKEN_TYPE_UNKNOWN      = 2,
        LLAMA_TOKEN_TYPE_CONTROL      = 3,
        LLAMA_TOKEN_TYPE_USER_DEFINED = 4,
        LLAMA_TOKEN_TYPE_UNUSED       = 5,
        LLAMA_TOKEN_TYPE_BYTE         = 6,
    };

    // in contrast, here we omit "_type" from the enum name before adding the suffix
    enum ggml_task_type {
        GGML_TASK_INIT = 0,
        GGML_TASK_COMPUTE,
        GGML_TASK_FINALIZE,
    };

With this PR, I propose that we always follow the convention to suffix the full enum name:

enum some_enum_name {
    SOME_ENUM_NAME_VAL_0, // OK
    SOME_ENUM_VAL_0,      // not OK
};

Is this change worth it? It touches a lot of lines

@ggerganov
ggerganov requested a review from slaren February 24, 2024 09:17

@slaren slaren left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Personally I would prefer to do it the other way around, and remove all the _TYPE _NAME _MODE etc suffixes from the enum values, but ultimately I think that the most important is to be consistent with the style.

@ggerganov
ggerganov merged commit ab336a9 into master Feb 25, 2024
@ggerganov
ggerganov deleted the gg/normalize-enums branch February 25, 2024 10:09
jordankanter pushed a commit to jordankanter/llama.cpp that referenced this pull request Mar 13, 2024
* coda : normalize enum names

ggml-ci

* code : cont

* code : cont
kou added a commit to kou/llama.cpp that referenced this pull request Aug 16, 2024
LLAMA_SPLIT_* were renamed to LLAMA_SPLIT_MODE_* in ggml-org#5697.
slaren pushed a commit that referenced this pull request Aug 30, 2024
LLAMA_SPLIT_* were renamed to LLAMA_SPLIT_MODE_* in #5697.
dsx1986 pushed a commit to dsx1986/llama.cpp that referenced this pull request Oct 29, 2024
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Nov 15, 2024
arthw pushed a commit to arthw/llama.cpp that referenced this pull request Nov 18, 2024
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
* coda : normalize enum names

ggml-ci

* code : cont

* code : cont
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
* coda : normalize enum names

ggml-ci

* code : cont

* code : cont
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
* coda : normalize enum names

ggml-ci

* code : cont

* code : cont
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
* coda : normalize enum names

ggml-ci

* code : cont

* code : cont
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
* coda : normalize enum names

ggml-ci

* code : cont

* code : cont
my-other-github-account pushed a commit to my-other-github-account/llama.cpp that referenced this pull request May 15, 2026
phibya pushed a commit to ziee-ai/llama.cpp that referenced this pull request May 29, 2026
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
* coda : normalize enum names

ggml-ci

* code : cont

* code : cont
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
* coda : normalize enum names

ggml-ci

* code : cont

* code : cont
AlexiAlp pushed a commit to minghaop/llama.cpp that referenced this pull request Jun 2, 2026
fukuro-kun pushed a commit to fukuro-kun/fukuro-llama-cpp-turboquant that referenced this pull request Jul 5, 2026
* coda : normalize enum names

ggml-ci

* code : cont

* code : cont
fukuro-kun pushed a commit to fukuro-kun/fukuro-llama-cpp-turboquant that referenced this pull request Jul 5, 2026
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