From: Georgi Gerganov Date: Fri, 16 Dec 2022 16:00:12 +0000 (+0200) Subject: ggml : make more compatible with c99 (#262) X-Git-Tag: upstream/1.7.4~1715 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=0f117594066a213cc3cc9261c8906f316e6fb153;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp ggml : make more compatible with c99 (#262) --- diff --git a/ggml.c b/ggml.c index e3c0db35..bab5cc71 100644 --- a/ggml.c +++ b/ggml.c @@ -14,9 +14,10 @@ #include #include -// if C99 - static_assert is nop +// if C99 - static_assert is noop +// ref: https://stackoverflow.com/a/53923785/4039976 #ifndef static_assert -#define static_assert(cond, msg) +#define static_assert(cond, msg) struct global_scope_noop_trick #endif #if defined _MSC_VER || defined(__MINGW32__) diff --git a/ggml.h b/ggml.h index 6dd5d044..7f24e531 100644 --- a/ggml.h +++ b/ggml.h @@ -681,34 +681,32 @@ struct ggml_opt_params { bool print_forward_graph; bool print_backward_graph; - union { - // ADAM parameters - struct { - int n_iter; - - float alpha; // learning rate - float beta1; - float beta2; - float eps; // epsilon for numerical stability - float eps_f; // epsilon for convergence test - float eps_g; // epsilon for convergence test - } adam; - - // LBFGS parameters - struct { - int m; // number of corrections to approximate the inv. Hessian - int n_iter; - int max_linesearch; - - float eps; // convergence tolerance - float ftol; // line search tolerance - float wolfe; - float min_step; - float max_step; - - enum ggml_linesearch linesearch; - } lbfgs; - }; + // ADAM parameters + struct { + int n_iter; + + float alpha; // learning rate + float beta1; + float beta2; + float eps; // epsilon for numerical stability + float eps_f; // epsilon for convergence test + float eps_g; // epsilon for convergence test + } adam; + + // LBFGS parameters + struct { + int m; // number of corrections to approximate the inv. Hessian + int n_iter; + int max_linesearch; + + float eps; // convergence tolerance + float ftol; // line search tolerance + float wolfe; + float min_step; + float max_step; + + enum ggml_linesearch linesearch; + } lbfgs; }; struct ggml_opt_params ggml_opt_default_params(enum ggml_opt_type type);