File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -346,7 +346,6 @@ extern "C" {
346
346
347
347
// google brain half-precision bfloat16
348
348
typedef struct { uint16_t bits ; } ggml_bf16_t ;
349
- GGML_API ggml_bf16_t ggml_make_bf16 (uint16_t val );
350
349
GGML_API ggml_bf16_t ggml_fp32_to_bf16 (float );
351
350
GGML_API float ggml_bf16_to_fp32 (ggml_bf16_t ); // consider just doing << 16
352
351
GGML_API void ggml_bf16_to_fp32_row (const ggml_bf16_t * , float * , int64_t );
Original file line number Diff line number Diff line change @@ -102,6 +102,15 @@ static inline ggml_bf16_t ggml_compute_fp32_to_bf16(float s) {
102
102
return h ;
103
103
}
104
104
105
+ static inline ggml_bf16_t ggml_make_bf16 (uint16_t h ) {
106
+ union {
107
+ ggml_bf16_t f ;
108
+ uint16_t i ;
109
+ } u ;
110
+ u .i = h ;
111
+ return u .f ;
112
+ }
113
+
105
114
#define GGML_FP32_TO_BF16 (x ) ggml_compute_fp32_to_bf16(x)
106
115
#define GGML_BF16_TO_FP32 (x ) ggml_compute_bf16_to_fp32(x)
107
116
Original file line number Diff line number Diff line change @@ -428,12 +428,6 @@ float ggml_bf16_to_fp32(ggml_bf16_t x) {
428
428
return GGML_BF16_TO_FP32(x); // it just left shifts
429
429
}
430
430
431
- ggml_bf16_t ggml_make_bf16(uint16_t x) {
432
- ggml_bf16_t bf16_value;
433
- bf16_value.bits = x;
434
- return bf16_value;
435
- }
436
-
437
431
ggml_bf16_t ggml_fp32_to_bf16(float x) {
438
432
#define ggml_fp32_to_bf16 do_not_use__ggml_fp32_to_bf16__in_ggml
439
433
return GGML_FP32_TO_BF16(x);
You can’t perform that action at this time.
0 commit comments