Skip to content

Commit

Permalink
Keep API and context fields the same whether or not GGML_RECOVERABLE_…
Browse files Browse the repository at this point in the history
…ERRORS is defined.
  • Loading branch information
KerfuffleV2 committed May 6, 2023
1 parent 1a6987a commit 7523107
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
4 changes: 0 additions & 4 deletions ggml.c
Original file line number Diff line number Diff line change
Expand Up @@ -4570,10 +4570,8 @@ struct ggml_context * ggml_init(struct ggml_init_params params) {
/*.objects_end =*/ NULL,
/*.scratch =*/ { 0, 0, NULL, },
/*.scratch_save =*/ { 0, 0, NULL, },
#ifdef GGML_RECOVERABLE_ERRORS
/*.last_error_code =*/ GGML_ERRCODE_SUCCESS,
/*.last_error_msg =*/ { 0 },
#endif
};

GGML_ASSERT(ctx->mem_buffer != NULL);
Expand Down Expand Up @@ -4628,7 +4626,6 @@ size_t ggml_set_scratch(struct ggml_context * ctx, struct ggml_scratch scratch)
return result;
}

#ifdef GGML_RECOVERABLE_ERRORS
// enum ggml_errcode ggml_clear_error(struct ggml_context * ctx) {
// enum ggml_errcode last_code = ctx->last_error_code;

Expand All @@ -4644,7 +4641,6 @@ enum ggml_errcode ggml_last_error_code(struct ggml_context * ctx) {
char * ggml_last_error_msg(struct ggml_context * ctx) {
return ctx->last_error_code == GGML_ERRCODE_SUCCESS ? "Success" : &ctx->last_error_msg;
}
#endif

////////////////////////////////////////////////////////////////////////////////

Expand Down
2 changes: 0 additions & 2 deletions ggml.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,14 +464,12 @@ extern "C" {

GGML_API size_t ggml_set_scratch(struct ggml_context * ctx, struct ggml_scratch scratch);

#ifdef GGML_RECOVERABLE_ERRORS
// GGML_API enum ggml_errcode ggml_clear_error(
// struct ggml_context * ctx);
GGML_API enum ggml_errcode ggml_last_error_code(
struct ggml_context * ctx);
GGML_API char * ggml_last_error_msg(
struct ggml_context * ctx);
#endif

GGML_API struct ggml_tensor * ggml_new_tensor(
struct ggml_context * ctx,
Expand Down

0 comments on commit 7523107

Please sign in to comment.