From baaa221787cee294262d2458c32cac5a1e3ec70f Mon Sep 17 00:00:00 2001 From: Jan Wassenberg Date: Wed, 30 Oct 2024 08:08:28 -0700 Subject: [PATCH] Move BF16 to basics.h for easier access, and use that typedef. PiperOrigin-RevId: 691422334 --- compression/BUILD.bazel | 3 +++ compression/shared.h | 5 +++-- util/basics.h | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/compression/BUILD.bazel b/compression/BUILD.bazel index 832f635..d5c90c3 100644 --- a/compression/BUILD.bazel +++ b/compression/BUILD.bazel @@ -88,6 +88,7 @@ cc_library( "shared.h", ], deps = [ + "//:basics", "@highway//:hwy", "@highway//:stats", "@highway//hwy/contrib/sort:vqsort", @@ -112,6 +113,7 @@ cc_library( hdrs = ["shared.h"], textual_hdrs = ["sfp-inl.h"], deps = [ + "//:basics", "@highway//:hwy", ], ) @@ -198,6 +200,7 @@ cc_library( ":nuq", ":sfp", "//:allocator", + "//:basics", "@highway//:hwy", "@highway//:nanobenchmark", "@highway//:profiler", diff --git a/compression/shared.h b/compression/shared.h index 74b7454..7d90959 100644 --- a/compression/shared.h +++ b/compression/shared.h @@ -25,13 +25,14 @@ #include #include +// IWYU pragma: begin_exports +#include "util/basics.h" // BF16 #include "hwy/aligned_allocator.h" #include "hwy/base.h" // HWY_INLINE +// IWYU pragma: end_exports namespace gcpp { -using BF16 = hwy::bfloat16_t; - // 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. // It supports seeking at a granularity of 1 and decoding to bf16/f32. diff --git a/util/basics.h b/util/basics.h index 7f433e2..3aee649 100644 --- a/util/basics.h +++ b/util/basics.h @@ -20,7 +20,7 @@ #include #include -#include "hwy/base.h" // HWY_IS_MSAN +#include "hwy/base.h" // IWYU pragma: end_exports #if HWY_IS_MSAN @@ -29,6 +29,8 @@ namespace gcpp { +using BF16 = hwy::bfloat16_t; + static inline void MaybeCheckInitialized(const void* ptr, size_t size) { #if HWY_IS_MSAN __msan_check_mem_is_initialized(ptr, size);