From 743d0731a94fa6fbd13aed5651771baf3e25d46d Mon Sep 17 00:00:00 2001 From: John Platts Date: Fri, 24 Oct 2025 10:12:55 -0500 Subject: [PATCH 1/2] Re-enabled BF16 on x86 in debug builds with Clang 22 or later --- hwy/base.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hwy/base.h b/hwy/base.h index a02fe7096f..a908b52e0d 100644 --- a/hwy/base.h +++ b/hwy/base.h @@ -1744,9 +1744,9 @@ HWY_F16_CONSTEXPR inline std::partial_ordering operator<=>( // bf16 <-> f32 in convert_test results in 0x2525 for 1.0 instead of 0x3f80. // Reported at https://github.com/llvm/llvm-project/issues/151692. #ifndef HWY_SSE2_HAVE_SCALAR_BF16_TYPE -#if HWY_ARCH_X86 && defined(__SSE2__) && \ - ((HWY_COMPILER_CLANG >= 1700 && !HWY_COMPILER_CLANGCL && \ - !HWY_IS_DEBUG_BUILD) || \ +#if HWY_ARCH_X86 && defined(__SSE2__) && \ + ((HWY_COMPILER_CLANG >= 1700 && !HWY_COMPILER_CLANGCL && \ + (!HWY_IS_DEBUG_BUILD || HWY_COMPILER_CLANG >= 2200)) || \ HWY_COMPILER_GCC_ACTUAL >= 1300) #define HWY_SSE2_HAVE_SCALAR_BF16_TYPE 1 #else From b853b761c2eaf58df3e68c6648ebb50aa34134a0 Mon Sep 17 00:00:00 2001 From: John Platts Date: Fri, 24 Oct 2025 11:09:02 -0500 Subject: [PATCH 2/2] Adjusted hwy/base.h to enable BF16 on x86 with Clang 22.1.1 or later --- hwy/base.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hwy/base.h b/hwy/base.h index a908b52e0d..3339e21e92 100644 --- a/hwy/base.h +++ b/hwy/base.h @@ -1744,9 +1744,9 @@ HWY_F16_CONSTEXPR inline std::partial_ordering operator<=>( // bf16 <-> f32 in convert_test results in 0x2525 for 1.0 instead of 0x3f80. // Reported at https://github.com/llvm/llvm-project/issues/151692. #ifndef HWY_SSE2_HAVE_SCALAR_BF16_TYPE -#if HWY_ARCH_X86 && defined(__SSE2__) && \ - ((HWY_COMPILER_CLANG >= 1700 && !HWY_COMPILER_CLANGCL && \ - (!HWY_IS_DEBUG_BUILD || HWY_COMPILER_CLANG >= 2200)) || \ +#if HWY_ARCH_X86 && defined(__SSE2__) && \ + ((HWY_COMPILER_CLANG >= 1700 && !HWY_COMPILER_CLANGCL && \ + (!HWY_IS_DEBUG_BUILD || HWY_COMPILER3_CLANG >= 220101)) || \ HWY_COMPILER_GCC_ACTUAL >= 1300) #define HWY_SSE2_HAVE_SCALAR_BF16_TYPE 1 #else