Download src/ga_math.h from eschmidbauer/GigaAM-v4-c: direct link, hf CLI and curl.
- Browser
- Download file 2.18 kB
-
https://huggingface.co/eschmidbauer/GigaAM-v4-c/resolve/main/src/ga_math.h
- Command line
-
hf download hf://eschmidbauer/GigaAM-v4-c/src/ga_math.h
-
curl -L -o ga_math.h https://huggingface.co/eschmidbauer/GigaAM-v4-c/resolve/main/src/ga_math.h
2.18 kB
| /* Dense kernels; BLAS backend chosen at build time. */ | |
| /* "accelerate", "cblas", or the hand-rolled kernel name. */ | |
| const char *ga_math_backend(void); | |
| /* C[m,n] = alpha * A[m,k] * B[n,k]^T + beta * C. With a pool the work is split across its | |
| * threads (columns, or rows when n is small); results are identical either way. */ | |
| void ga_gemm_nt(int m, int n, int k, float alpha, const float *a, int lda, const float *b, | |
| int ldb, float beta, float *c, int ldc, ga_pool *pool); | |
| /* C[m,n] = alpha * A[m,k] * B[k,n] + beta * C */ | |
| void ga_gemm_nn(int m, int n, int k, float alpha, const float *a, int lda, const float *b, | |
| int ldb, float beta, float *c, int ldc); | |
| /* y[rows,out] = x[rows,in] * w[out,in]^T + b (b may be NULL) */ | |
| void ga_linear(const float *x, int rows, int in, const float *w, const float *b, int out, | |
| float *y, ga_pool *pool); | |
| /* 1 when the backend multiplies f16 weights in place (hand-rolled kernels); BLAS needs f32. */ | |
| int ga_math_reads_f16(void); | |
| /* ga_linear with w[out,in] stored as IEEE half. */ | |
| void ga_linear_f16(const float *x, int rows, int in, const uint16_t *w, const float *b, | |
| int out, float *y, ga_pool *pool); | |
| /* In place; a pool splits large arrays. */ | |
| /* 1 when the backend multiplies int8 weights directly (hand-rolled kernels). */ | |
| int ga_math_reads_i8(void); | |
| /* ga_linear with w[out,in] int8, one scale per `group` weights along a row (w_scale in | |
| * ga_kernel_i8_interleave_scales layout). x is quantized the same way into xq[rows, in] / | |
| * xq_scale[rows, in / group] (caller's scratch) first. Lossy. */ | |
| void ga_linear_i8(const float *x, int rows, int in, const int8_t *w, const float *w_scale, | |
| int group, const float *b, int out, float *y, int8_t *xq, float *xq_scale, | |
| ga_pool *pool); | |
| void ga_silu(float *x, size_t n, ga_pool *pool); | |
| void ga_sigmoid(float *x, size_t n, ga_pool *pool); | |
| /* y = x * rsqrt(mean(x^2) + eps) * weight, per row */ | |
| void ga_rms_norm(const float *x, int rows, int dim, const float *weight, float eps, float *y); | |