std1.0.0-beta-7 SafeC docs

std :: ml::float16

Function std::f32_to_fp16_bulk

#include <std/ml/float16.h> source ยท definition

void f32_to_fp16_bulk([]const float src, []unsigned short dst)

Bit-identical to the scalar functions above for every input except NaN payloads (the hardware keeps more of a NaN's payload; a NaN stays a NaN). x86-64 uses F16C for fp16 and, where present, AVX512-BF16 for float32 -> bf16 (16 values per instruction; a block holding a float32 subnormal, which that instruction flushes to zero, is converted in software instead). AArch64 uses FCVTL / FCVTN for fp16. bf16 -> float32 is a shift and float32 -> bf16 an integer rounding everywhere else, both in loops the compiler vectorizes. Arrays of 256K values or more are split across std/sync/parallel.h's thread pool.