aboutsummaryrefslogtreecommitdiff
path: root/src/dtype.h
diff options
context:
space:
mode:
authorOnur Gündüz <ogunduz@gmail.com>2026-06-20 20:10:56 +0200
committerOnur Gündüz <ogunduz@gmail.com>2026-06-21 05:57:19 +0200
commit6b969d25ce136eaf695222bd1a10bff1ecac0220 (patch)
treec23afb50c28b9deaddae5c6526a74ee11cf2d865 /src/dtype.h
parentd4bdb8dae753462f621507d5fc3582e0e53da35c (diff)
downloadffwd-6b969d25ce136eaf695222bd1a10bff1ecac0220.tar.gz
ffwd-6b969d25ce136eaf695222bd1a10bff1ecac0220.zip
all: split Makefile and reorg library/tools
Diffstat (limited to '')
-rw-r--r--libffwd/dtype.h (renamed from src/dtype.h)12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dtype.h b/libffwd/dtype.h
index 2a25cae..7a7a2ad 100644
--- a/src/dtype.h
+++ b/libffwd/dtype.h
@@ -1,5 +1,5 @@
-#ifndef EMBED_DTYPE_H
-#define EMBED_DTYPE_H
+#ifndef FFWD_DTYPE_H
+#define FFWD_DTYPE_H
#include <stdint.h>
#include <string.h>
@@ -8,8 +8,8 @@
* left shift reinterpreted as a float. Shared by every host-side caller (the
* CPU loader, the safetensors reader); the CUDA backend keeps its own
* __nv_bfloat16 device kernels, and kernels.c keeps the SIMD buffer variant
- * embed_bf16_to_f32_buf for hot, contiguous conversions. */
-static inline float embed_bf16_to_f32(uint16_t bf16) {
+ * bf16_to_f32_buf for hot, contiguous conversions. */
+static inline float ffwd_bf16_to_f32(uint16_t bf16) {
uint32_t bits = (uint32_t)bf16 << 16;
float f;
memcpy(&f, &bits, sizeof(f));
@@ -22,7 +22,7 @@ static inline float embed_bf16_to_f32(uint16_t bf16) {
* subnormals, and inf/NaN. Used by the loaders to accept F16 safetensors
* snapshots (e.g. the public multilingual-e5 weights); there is no fused F16
* kernel, so weights are widened to F32 once at load. */
-static inline float embed_f16_to_f32(uint16_t f16) {
+static inline float ffwd_f16_to_f32(uint16_t f16) {
uint32_t sign = (uint32_t)(f16 & 0x8000u) << 16;
uint32_t exp = (f16 >> 10) & 0x1fu;
uint32_t mant = f16 & 0x3ffu;
@@ -52,4 +52,4 @@ static inline float embed_f16_to_f32(uint16_t f16) {
return f;
}
-#endif /* EMBED_DTYPE_H */
+#endif /* FFWD_DTYPE_H */