bf16.h file
bfloat16 storage and vm_.
Not a vm_ width.
Compiled into the library only when VECMAT_ENABLE_BF16=ON. Not part of vecmat.h. Symbols are not in abi.h.
Classes
- struct vm_vec4_bf16
- struct vm_mat4_bf16
Typedefs
- using vm_bf16_t = uint16_t
- bfloat16 bits.
- using vm_vec4_bf16 = struct vm_vec4_bf16
- using vm_mat4_bf16 = struct vm_mat4_bf16
- using vm_bf16_gemm_fn = void(*)(float*c, int ldc, const vm_bf16_t*a, int lda, const vm_bf16_t*b, int ldb, int m, int n, int k, float alpha, float beta)
- Row-major
C = alpha * A * B + beta * Cwith bf16 inputs and an f32 accumulator.
Functions
-
auto vm_bf16_from_f32(float x) -> vm_
bf16_ t - Round a binary32 value to bfloat16, ties to even.
-
auto vm_f32_from_bf16(vm_
bf16_ t h) -> float - Expand bfloat16 bits to binary32.
- void vm_bf16_init(void)
- Install the scalar GEMM, then run
vm_.bf16_ modules_ register() -
void vm_bf16_set_gemm(vm_
bf16_ gemm_ fn fn, const char* note) - Replace the GEMM slot.
- auto vm_bf16_note(void) -> const char*
bf16=scalaruntil a module overrides the slot.-
void vm_gemm_bf16f32(float* c,
int ldc,
const vm_
bf16_ t* a, int lda, const vm_ bf16_ t* b, int ldb, int m, int n, int k, float alpha, float beta) - See
vm_.bf16_ gemm_ fn
Typedef documentation
typedef void(*vm_bf16_gemm_fn)(float*c, int ldc, const vm_bf16_t*a, int lda, const vm_bf16_t*b, int ldb, int m, int n, int k, float alpha, float beta)
Row-major C = alpha * A * B + beta * C with bf16 inputs and an f32 accumulator.
No transpose and no layout flag. This is not vm_. lda / ldb are in vm_ elements; ldc is in float elements.
Function documentation
vm_ bf16_ t vm_bf16_from_f32(float x)
Round a binary32 value to bfloat16, ties to even.
Inf maps to inf. Every NaN maps to the canonical quiet NaN 0x7fc0.
void vm_bf16_init(void)
Install the scalar GEMM, then run vm_.
Call before the first vm_ if a module must override the slot. A second call does not replace an already installed slot.
void vm_bf16_set_gemm(vm_ bf16_ gemm_ fn fn,
const char* note)
Replace the GEMM slot.
fn == NULL is ignored.
note is printed by the caller via vm_. It is not vm_.
void vm_gemm_bf16f32(float* c,
int ldc,
const vm_ bf16_ t* a,
int lda,
const vm_ bf16_ t* b,
int ldb,
int m,
int n,
int k,
float alpha,
float beta)
See vm_.
Dispatches the installed slot.