Keep API and context fields the same whether or not GGML_RECOVERABLE_ERRORS is defined.

This commit is contained in:
KerfuffleV2 2023-05-06 15:48:57 -06:00
parent 1a6987ad92
commit 7523107877
2 changed files with 0 additions and 6 deletions

4
ggml.c
View file

@ -4570,10 +4570,8 @@ struct ggml_context * ggml_init(struct ggml_init_params params) {
/*.objects_end =*/ NULL, /*.objects_end =*/ NULL,
/*.scratch =*/ { 0, 0, NULL, }, /*.scratch =*/ { 0, 0, NULL, },
/*.scratch_save =*/ { 0, 0, NULL, }, /*.scratch_save =*/ { 0, 0, NULL, },
#ifdef GGML_RECOVERABLE_ERRORS
/*.last_error_code =*/ GGML_ERRCODE_SUCCESS, /*.last_error_code =*/ GGML_ERRCODE_SUCCESS,
/*.last_error_msg =*/ { 0 }, /*.last_error_msg =*/ { 0 },
#endif
}; };
GGML_ASSERT(ctx->mem_buffer != NULL); GGML_ASSERT(ctx->mem_buffer != NULL);
@ -4628,7 +4626,6 @@ size_t ggml_set_scratch(struct ggml_context * ctx, struct ggml_scratch scratch)
return result; return result;
} }
#ifdef GGML_RECOVERABLE_ERRORS
// enum ggml_errcode ggml_clear_error(struct ggml_context * ctx) { // enum ggml_errcode ggml_clear_error(struct ggml_context * ctx) {
// enum ggml_errcode last_code = ctx->last_error_code; // enum ggml_errcode last_code = ctx->last_error_code;
@ -4644,7 +4641,6 @@ enum ggml_errcode ggml_last_error_code(struct ggml_context * ctx) {
char * ggml_last_error_msg(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; return ctx->last_error_code == GGML_ERRCODE_SUCCESS ? "Success" : &ctx->last_error_msg;
} }
#endif
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

2
ggml.h
View file

@ -464,14 +464,12 @@ extern "C" {
GGML_API size_t ggml_set_scratch(struct ggml_context * ctx, struct ggml_scratch scratch); 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( // GGML_API enum ggml_errcode ggml_clear_error(
// struct ggml_context * ctx); // struct ggml_context * ctx);
GGML_API enum ggml_errcode ggml_last_error_code( GGML_API enum ggml_errcode ggml_last_error_code(
struct ggml_context * ctx); struct ggml_context * ctx);
GGML_API char * ggml_last_error_msg( GGML_API char * ggml_last_error_msg(
struct ggml_context * ctx); struct ggml_context * ctx);
#endif
GGML_API struct ggml_tensor * ggml_new_tensor( GGML_API struct ggml_tensor * ggml_new_tensor(
struct ggml_context * ctx, struct ggml_context * ctx,