Re: For an armv7 context, /usr/local/llvm1[789]/lib/clang/1[789]/include/arm_bf16.h does not exist: one thing blocking a firefox build via llvm1[78]
Date: Tue, 03 Sep 2024 22:41:12 UTC
>> . . . > > I've gone ahead and added arm_bf16.h back in my latest llvm19 update. (I > just realized I did something more convoluted than necessicary and will > fix it in the next update.) > > I'm still not sure how a file in a list in cmake named > aarch64_only_generated_files ends up on an ARM only build, but so it goes. > I'll merge to 17 and 18 as time permits. Well, I expect that you were depending on an error in clang/lib/Headers/CMakeLists.txt . Details follow . . . clang/lib/Headers/CMakeLists.txt has: # Generate header files and copy them to the build directory if(ARM IN_LIST LLVM_TARGETS_TO_BUILD OR AArch64 IN_LIST LLVM_TARGETS_TO_BUILD) . . . # Generate arm_bf16.h clang_generate_header(-gen-arm-bf16 arm_bf16.td arm_bf16.h) . . . Both ARM and AArch64 generate the file. Later (in the '. . .' text there is filtering via other lists of headers formed: list(APPEND aarch64_only_generated_files "${CMAKE_CURRENT_BINARY_DIR}/arm_sve.h" "${CMAKE_CURRENT_BINARY_DIR}/arm_sme.h" "${CMAKE_CURRENT_BINARY_DIR}/arm_bf16.h" "${CMAKE_CURRENT_BINARY_DIR}/arm_vector_types.h" ) But, DDI0487K_a_a-profile_architecture_reference_manual.pdf indicates that there are two BF16 features, one for AArch32 and one for AArch64: FEAT_AA32BF16 and: FEAT_BF16 That matches up with the clang code: clang/lib/Basic/Targets/ARM.cpp has: if (HasBFloat16) { Builder.defineMacro("__ARM_FEATURE_BF16", "1"); Builder.defineMacro("__ARM_FEATURE_BF16_VECTOR_ARITHMETIC", "1"); Builder.defineMacro("__ARM_BF16_FORMAT_ALTERNATIVE", "1"); } ( so: AArch32 is handled by ARM.cpp ) and clang/lib/Basic/Targets/AArch64.cpp has: if (HasBFloat16) { Builder.defineMacro("__ARM_FEATURE_BF16", "1"); Builder.defineMacro("__ARM_FEATURE_BF16_VECTOR_ARITHMETIC", "1"); Builder.defineMacro("__ARM_BF16_FORMAT_ALTERNATIVE", "1"); } ( so: AArch64 is handled by AArch64.cpp ). That leads aarch64_only_generated_files looking to just be wrong relative to bf16. I'd expect that: "${CMAKE_CURRENT_BINARY_DIR}/arm_bf16.h" should have instead been listed in: list(APPEND arm_common_generated_files "${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h" "${CMAKE_CURRENT_BINARY_DIR}/arm_fp16.h" ) I expect that this comes down to Target ARM being what supports AArch32 (and, so, its FEAT_AA32BF16) even for armv8. Target AArch64 looks to just support FEAT_BF16. === Mark Millard marklmi at yahoo.com