GeGLU kernels split from gelu_kernels.c. More...
#include <math.h>#include <stddef.h>#include <stdint.h>#include "ckernel_engine.h"#include "bf16_utils.h"Go to the source code of this file.
Functions | |
| static float | ck_gelu_tanh_parity_f32 (float x) |
| void | geglu_backward_bf16_mixed (const uint16_t *x, const uint16_t *d_out, float *d_x, int tokens, int dim) |
| void | geglu_backward_fp32 (const float *x, const float *d_out, float *d_x, int tokens, int dim) |
| void | geglu_forward_bf16 (const uint16_t *x, uint16_t *out, int tokens, int dim, float *scratch) |
| void | geglu_forward_exact (const float *x, float *out, int tokens, int dim) |
| void | geglu_forward_fp32 (const float *x, float *out, int tokens, int dim) |
| void | geglu_forward_ggml_native (const float *x, float *out, int tokens, int dim) |
| void | gelu_fast_inplace (float *data, size_t n) |
| void | gelu_ggml_native_inplace (float *data, size_t n) |
GeGLU kernels split from gelu_kernels.c.
Definition in file geglu_kernels.c.
|
inlinestatic |
Definition at line 33 of file geglu_kernels.c.
Referenced by geglu_forward_exact().
| void geglu_backward_bf16_mixed | ( | const uint16_t * | x, |
| const uint16_t * | d_out, | ||
| float * | d_x, | ||
| int | tokens, | ||
| int | dim | ||
| ) |
Definition at line 139 of file geglu_kernels.c.
References bf16_to_float().
| void geglu_backward_fp32 | ( | const float * | x, |
| const float * | d_out, | ||
| float * | d_x, | ||
| int | tokens, | ||
| int | dim | ||
| ) |
Definition at line 99 of file geglu_kernels.c.
| void geglu_forward_bf16 | ( | const uint16_t * | x, |
| uint16_t * | out, | ||
| int | tokens, | ||
| int | dim, | ||
| float * | scratch | ||
| ) |
Definition at line 83 of file geglu_kernels.c.
References bf16_tensor_to_float(), float_tensor_to_bf16(), and geglu_forward_fp32().
| void geglu_forward_exact | ( | const float * | x, |
| float * | out, | ||
| int | tokens, | ||
| int | dim | ||
| ) |
Definition at line 42 of file geglu_kernels.c.
References ck_gelu_tanh_parity_f32().
Referenced by geglu_forward_fp32().
| void geglu_forward_fp32 | ( | const float * | x, |
| float * | out, | ||
| int | tokens, | ||
| int | dim | ||
| ) |
Definition at line 55 of file geglu_kernels.c.
References ck_strict_parity_enabled(), geglu_forward_exact(), and gelu_fast_inplace().
Referenced by geglu_forward_bf16().
| void geglu_forward_ggml_native | ( | const float * | x, |
| float * | out, | ||
| int | tokens, | ||
| int | dim | ||
| ) |
Definition at line 17 of file geglu_kernels.c.
References gelu_ggml_native_inplace().
|
extern |
GELU activation forward (fast approximation, in-place)
test_gelu.py::TestGELUForward::test_gelu_fast_inplace
test_gelu.py::TestGELUForward::test_gelu_vs_exact
test_parity.py::test_gelu_parity
Fast GELU approximation: 0.5 * x * (1 + tanh(sqrt(2/pi) * (x + 0.044715 * x^3))) In-place on contiguous buffer.
After changes: make test && make llamacpp-parity-full
Definition at line 243 of file gelu_kernels.c.
Referenced by geglu_forward_fp32().
|
extern |
Definition at line 741 of file gelu_kernels.c.
Referenced by geglu_forward_ggml_native().