Skip to content

Commit c19af0a

Browse files
danbevggerganov
authored andcommitted
ggml : remove redundant set of contexts used field (ggml/978)
This commit removes the setting of the `used` field of the contexts in the global state (g_state) in `ggml_init`. The motivation for this change is that I believe that this additional initialization might not be required after the changes in Commit 45fc4fe ("sync : latest changes from whisper.cpp"), which changed the initialization of the contexts field from `{ 0 }` to `{ { 0 } }`: ```console g_state = (struct ggml_state) { - /*.contexts =*/ { 0 }, + /*.contexts =*/ { { 0 } }, }; ``` My understanding is that the `{0}` initialization might not have zero-initialized all the nested fields in every array element because of compiler differences, and might have been the reason for having the explicit setting of the `used` fields to false.
1 parent ac113a0 commit c19af0a

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

ggml/src/ggml.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3852,10 +3852,6 @@ struct ggml_context * ggml_init(struct ggml_init_params params) {
38523852
},
38533853
};
38543854

3855-
for (int i = 0; i < GGML_MAX_CONTEXTS; ++i) {
3856-
g_state.contexts[i].used = false;
3857-
}
3858-
38593855
const uint64_t t_end = ggml_time_us(); UNUSED(t_end);
38603856

38613857
GGML_PRINT_DEBUG("%s: g_state initialized in %f ms\n", __func__, (t_end - t_start)/1000.0f);

0 commit comments

Comments
 (0)