This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt][BF16] Do not compile truncdfbf2.c and truncsfbf2.c if `__bf16` is not supported
ClosedPublic

Authored by pengfei on Aug 4 2022, 2:10 AM.

Diff Detail

Event Timeline

pengfei created this revision.Aug 4 2022, 2:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2022, 2:10 AM
pengfei requested review of this revision.Aug 4 2022, 2:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 4 2022, 2:10 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
bkramer accepted this revision.Aug 4 2022, 4:10 AM

Works for me. This will still have the 32 bit x86 problem we're seeing on FreeBSD though.

This revision is now accepted and ready to land.Aug 4 2022, 4:10 AM

Thanks @bkramer. I considered the method in D130718, but we don't a macro like __FLT16_MAX__ for BF16. OTOH, I still believe using 64-bits configuration directly for i386 is somehow misuse. And simply adding a -msse2 can solve the problem.

This revision was landed with ongoing or failed builds.Aug 9 2022, 6:41 PM
This revision was automatically updated to reflect the committed changes.

Thanks @mib for the information. It's odd. The reland patch should have solved the problem. I'll keep watching on the following build results. Thanks!

mib added a comment.Aug 9 2022, 9:52 PM

Thanks @mib for the information. It's odd. The reland patch should have solved the problem. I'll keep watching on the following build results. Thanks!

The failure seems also to be happening with the reland patch (ab4e5ed441d475ead43bc4ce1cdef842688292f4), so I reverted it. Let me know if you need help reproducing the issue :)

Thanks @mib for the information. It's odd. The reland patch should have solved the problem. I'll keep watching on the following build results. Thanks!

The failure seems also to be happening with the reland patch (ab4e5ed441d475ead43bc4ce1cdef842688292f4), so I reverted it. Let me know if you need help reproducing the issue :)

Thank! I have found some clues in the log:

[1104/4435] Building C object CMakeFiles/clang_rt.builtins_x86_64_iossim.dir/truncdfbf2.c.o
... ...
[1168/4435] Building C object CMakeFiles/clang_rt.builtins_armv7_ios.dir/truncdfbf2.c.o

FAILED: CMakeFiles/clang_rt.builtins_armv7_ios.dir/truncdfbf2.c.o 
/Users/buildslave/jenkins/workspace/lldb-cmake/lldb-build/./bin/clang --target=x86_64-apple-darwin19.5.0   -O3 -DNDEBUG -arch armv7 -isysroot ...

So the X86 runtimes are built successfully as expected. The problem is we are building armv7 target using the same cmake configure generated for X86 which enabled -DCOMPILER_RT_HAS_BFLOAT16. Let me think about how to solve the problem. But I wonder if it is also a problem for the buildbot?

pengfei reopened this revision.Aug 10 2022, 2:31 AM
This revision is now accepted and ready to land.Aug 10 2022, 2:31 AM
pengfei updated this revision to Diff 451395.Aug 10 2022, 2:35 AM

Do not compile truncdfbf2.c and truncsfbf2.c if __bf16 is not supported.

This solves buildbot error "error: ISO C requires a translation unit to contain at least one declaration [-Werror,-Wempty-translation-unit]"

pengfei retitled this revision from [compiler-rt][BF16] Provide __truncsfbf2 only when __bf16 is available to [compiler-rt][BF16] Do not compile truncdfbf2.c and truncsfbf2.c if `__bf16` is not supported.Aug 10 2022, 2:36 AM
pengfei updated this revision to Diff 451398.Aug 10 2022, 2:42 AM

Exclude APPLE targets.