mirror of https://github.com/google/gemma.cpp.git
Move BF16 to basics.h for easier access, and use that typedef.
PiperOrigin-RevId: 691422334
This commit is contained in:
parent
ed4091921f
commit
baaa221787
|
|
@ -88,6 +88,7 @@ cc_library(
|
||||||
"shared.h",
|
"shared.h",
|
||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
|
"//:basics",
|
||||||
"@highway//:hwy",
|
"@highway//:hwy",
|
||||||
"@highway//:stats",
|
"@highway//:stats",
|
||||||
"@highway//hwy/contrib/sort:vqsort",
|
"@highway//hwy/contrib/sort:vqsort",
|
||||||
|
|
@ -112,6 +113,7 @@ cc_library(
|
||||||
hdrs = ["shared.h"],
|
hdrs = ["shared.h"],
|
||||||
textual_hdrs = ["sfp-inl.h"],
|
textual_hdrs = ["sfp-inl.h"],
|
||||||
deps = [
|
deps = [
|
||||||
|
"//:basics",
|
||||||
"@highway//:hwy",
|
"@highway//:hwy",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
@ -198,6 +200,7 @@ cc_library(
|
||||||
":nuq",
|
":nuq",
|
||||||
":sfp",
|
":sfp",
|
||||||
"//:allocator",
|
"//:allocator",
|
||||||
|
"//:basics",
|
||||||
"@highway//:hwy",
|
"@highway//:hwy",
|
||||||
"@highway//:nanobenchmark",
|
"@highway//:nanobenchmark",
|
||||||
"@highway//:profiler",
|
"@highway//:profiler",
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,14 @@
|
||||||
#include <complex>
|
#include <complex>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
// IWYU pragma: begin_exports
|
||||||
|
#include "util/basics.h" // BF16
|
||||||
#include "hwy/aligned_allocator.h"
|
#include "hwy/aligned_allocator.h"
|
||||||
#include "hwy/base.h" // HWY_INLINE
|
#include "hwy/base.h" // HWY_INLINE
|
||||||
|
// IWYU pragma: end_exports
|
||||||
|
|
||||||
namespace gcpp {
|
namespace gcpp {
|
||||||
|
|
||||||
using BF16 = hwy::bfloat16_t;
|
|
||||||
|
|
||||||
// Switching Floating Point: a hybrid 8-bit float representation of bf16/f32
|
// Switching Floating Point: a hybrid 8-bit float representation of bf16/f32
|
||||||
// inputs that combines the advantages of e4m3 and e5m2 into a single format.
|
// inputs that combines the advantages of e4m3 and e5m2 into a single format.
|
||||||
// It supports seeking at a granularity of 1 and decoding to bf16/f32.
|
// It supports seeking at a granularity of 1 and decoding to bf16/f32.
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "hwy/base.h" // HWY_IS_MSAN
|
#include "hwy/base.h"
|
||||||
// IWYU pragma: end_exports
|
// IWYU pragma: end_exports
|
||||||
|
|
||||||
#if HWY_IS_MSAN
|
#if HWY_IS_MSAN
|
||||||
|
|
@ -29,6 +29,8 @@
|
||||||
|
|
||||||
namespace gcpp {
|
namespace gcpp {
|
||||||
|
|
||||||
|
using BF16 = hwy::bfloat16_t;
|
||||||
|
|
||||||
static inline void MaybeCheckInitialized(const void* ptr, size_t size) {
|
static inline void MaybeCheckInitialized(const void* ptr, size_t size) {
|
||||||
#if HWY_IS_MSAN
|
#if HWY_IS_MSAN
|
||||||
__msan_check_mem_is_initialized(ptr, size);
|
__msan_check_mem_is_initialized(ptr, size);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue