Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 3 Sep 2024 15:41:12 -0700
From:      Mark Millard <marklmi@yahoo.com>
To:        Brooks Davis <brooks@freebsd.org>
Cc:        FreeBSD Mailing List <freebsd-ports@freebsd.org>, FreeBSD ARM List <freebsd-arm@freebsd.org>, FreeBSD Toolchain <freebsd-toolchain@freebsd.org>, Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
Subject:   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]
Message-ID:  <67D7CB10-48E1-4E4F-A632-087CF7B2ADD0@yahoo.com>
In-Reply-To: <ZteD2hq2Dsm2AqhB@spindle.one-eyed-alien.net>
References:  <75609A57-7B50-40F5-88A8-0278CCCC018B@yahoo.com> <E029410D-1964-4C55-8B2D-0427C43B4ABA@yahoo.com> <D74514BA-9071-4F29-96F5-42AD6EC2B6E4@yahoo.com> <DF65D496-D1E7-44B6-A04F-EADA1DE29817@yahoo.com> <ZtdRqxBPukxcOkaz@spindle.one-eyed-alien.net> <5BEBBFCB-A877-4124-B07F-D4C6D25B7026@yahoo.com> <ZtdyWSJ_Vva4tFdn@spindle.one-eyed-alien.net> <02BE22BE-7E86-43D1-86D8-85A527625AD6@yahoo.com> <ZteD2hq2Dsm2AqhB@spindle.one-eyed-alien.net>

next in thread | previous in thread | raw e-mail | index | archive | help

>> . .  .
>=20
> 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.)
>=20
> 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.


=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?67D7CB10-48E1-4E4F-A632-087CF7B2ADD0>