* [Buildroot] Question about float-abi
@ 2012-02-28 10:55 Ludovic Desroches
2012-02-29 11:08 ` Ludovic Desroches
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Desroches @ 2012-02-28 10:55 UTC (permalink / raw)
To: buildroot
Hi,
I am trying to play with the -mfloat-abi option to see performance improvement
between soft, softfp and hard values.
I was not sure that the toolchain generated by Buildroot (even if BR2_VFP_FLOAT
is selected) will fit my needs (since I had low performances on nbench floating
point index).
Then I decided to use Crosstool-ng to generate my toolchain (moreover I'll be
able to compare glibc/eglibc/uclibc performances). I set the -mtune, -mfpu
options and changed -mfloat-abi value to generate three toolchains: one with
-mfloat-abi=soft, one with -mfloat-abi=softfp and one with -mfloat-abi=hard.
Then I compiled nbench as a static binary. The results of the benchmark are
consistent. Floating point index is low for mfloat-abi=soft, much better for
softfp and hard.
So I would like to remove the static option. I expected to have an issue with
at least one of the three binaries. The rootfs I used was generated with
Buildroot and the code sourcery toolchain (I also tried with the toolchains I
have generated with crosstool-ng).
I could run the binary with mfloat-abi=hard but floating point performances
were low so it seems that the libm/libc are not using the vfp unit. Why not!
I was surprised when I could also run the binary with mfloat-abi=soft because
I thought that soft and hard float-abi were not compatible.
If I try to compile nbench with mfloat-abi=hard with the toolchain generated
with mfloat-abi=soft I have some erros telling me that I am using VFP register
arguments. In this case, the behavior is ok.
I don't understand what happens when I generate my rootfs with Buildroot.
Why both soft and hard float-abi can be used? Why my libc is not using the vfp
unit? BR2_VFP_FLOAT options seems not sufficient. I tried to add my mtune,
mfpu and mfloat-abi flag to BR2_TARGET_OPTIMIZATION but I am not sure that it
is the good place since the behavior and performances are still the same.
Thanks for your help.
Regards.
Ludovic
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] Question about float-abi
2012-02-28 10:55 [Buildroot] Question about float-abi Ludovic Desroches
@ 2012-02-29 11:08 ` Ludovic Desroches
2012-02-29 13:49 ` Ludovic Desroches
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Desroches @ 2012-02-29 11:08 UTC (permalink / raw)
To: buildroot
Hi,
On Tue, Feb 28, 2012 at 11:55:50AM +0100, Ludovic Desroches wrote:
> Hi,
>
> I am trying to play with the -mfloat-abi option to see performance improvement
> between soft, softfp and hard values.
>
> I was not sure that the toolchain generated by Buildroot (even if BR2_VFP_FLOAT
> is selected) will fit my needs (since I had low performances on nbench floating
> point index).
>
> Then I decided to use Crosstool-ng to generate my toolchain (moreover I'll be
> able to compare glibc/eglibc/uclibc performances). I set the -mtune, -mfpu
> options and changed -mfloat-abi value to generate three toolchains: one with
> -mfloat-abi=soft, one with -mfloat-abi=softfp and one with -mfloat-abi=hard.
>
> Then I compiled nbench as a static binary. The results of the benchmark are
> consistent. Floating point index is low for mfloat-abi=soft, much better for
> softfp and hard.
>
> So I would like to remove the static option. I expected to have an issue with
> at least one of the three binaries. The rootfs I used was generated with
> Buildroot and the code sourcery toolchain (I also tried with the toolchains I
> have generated with crosstool-ng).
> I could run the binary with mfloat-abi=hard but floating point performances
> were low so it seems that the libm/libc are not using the vfp unit. Why not!
> I was surprised when I could also run the binary with mfloat-abi=soft because
> I thought that soft and hard float-abi were not compatible.
>
> If I try to compile nbench with mfloat-abi=hard with the toolchain generated
> with mfloat-abi=soft I have some erros telling me that I am using VFP register
> arguments. In this case, the behavior is ok.
The strange behavior about float-abi compability between the libc and the binary
is probably coming from an error on my side. I have not checked all combination
but it seems more logical even if I still have some strange behavior.
For instance, I have on my target a libc compiled with float-abi=hard. I can run
my benchmark compiled with float-abi=hard option and with a libc compiled also
with float-abi=hard.
I also tried on the same target, a benchmark which should be compiled with
float-abi=soft option with a libc compiled also with float-abi=soft. I can run
this binary too that is quite surprising. In fact, the binary was compiled with
float-abi=softfp option with a libc compiled with float-abi=soft. To my mind,
it is still strange to have something working here. Running several times the
benchmark, I noticed that sometimes it was stuck.
To finish with, the benchmark really compiled with float-abi=soft option with a
libc compiled also with float-abi=soft is stuck when it starts floating point
benches so the behavior is correct.
Now, it seems more logical but not totally. This part doesn't concern Buildroot
but it was to keep you inform.
When I use a glibc/eglibc toolchain (I have somes issues to build the uclibc
one) built with crosstool-ng I have the results I expect with the benchmark.
If Buildroot builds the toolchain using the uclibc (with VFP_FLOAT set and
SOFT_FLOAT not set) I have unexpected results.
I compiled my benchmark outside buildroot environment. I could compile it with
float-abi set to soft and softfp but not to hard. Ok it's not too strange for
the moment.
Then I tried to run my two binaries on the target. The first one compiled
with float-abi set to soft gave me poor results with a floating point score
about 0.15. The second binary gave me better results with a floating point
score about 0.55. It seems better but in fact it is far from the score I had
with my toolchains based on glibc/eglibc.
Deassaembling the libm which is on my target, I didn't see any vfp
instructions. So why floating point performances are increased with float-abi
set to softfp?
How can I have a hardware floating point support with Buildroot and uclibc?
Looking at the BR2_VFP_FLOAT setting, it seems to be only used for external
toolchains providing multi-lib support.
I added mcpu, mfpu and mfloat-abi flags to BR2_TARGET_OPTIMIZATION and to
UCLIBC_EXTRA_FLAGS. I think it really force hardware floating point support
since I have this error during the build:
[snip]/arm-unknown-linux-uclibcgnueabi/bin/ld: error: lib/libuClibc-0.9.32.1.so
uses VFP register arguments, [snip]/arm-unknown-linux-uclibcgnueabi/4.5.3/libgcc.a(bpabi.o)
does not
Do I play with the good settings? Do I miss some settings?
Thanks.
Regards.
Ludovic
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] Question about float-abi
2012-02-29 11:08 ` Ludovic Desroches
@ 2012-02-29 13:49 ` Ludovic Desroches
2012-02-29 14:47 ` Thomas Petazzoni
0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Desroches @ 2012-02-29 13:49 UTC (permalink / raw)
To: buildroot
On Wed, Feb 29, 2012 at 12:08:51PM +0100, Ludovic Desroches wrote:
[snip]
> How can I have a hardware floating point support with Buildroot and uclibc?
> Looking at the BR2_VFP_FLOAT setting, it seems to be only used for external
> toolchains providing multi-lib support.
> I added mcpu, mfpu and mfloat-abi flags to BR2_TARGET_OPTIMIZATION and to
> UCLIBC_EXTRA_FLAGS. I think it really force hardware floating point support
> since I have this error during the build:
>
> [snip]/arm-unknown-linux-uclibcgnueabi/bin/ld: error: lib/libuClibc-0.9.32.1.so
> uses VFP register arguments, [snip]/arm-unknown-linux-uclibcgnueabi/4.5.3/libgcc.a(bpabi.o)
> does not
>
> Do I play with the good settings? Do I miss some settings?
Yes there were missing options for gcc: --with-float=hard and --with-fpu=...
Now floating score is correct. I am surprised by the good results of the uclibc.
I don't know if nbench is an accurate benchmark to test several libc but
scores obtained by glibc, eglibc and uclibc are very closed.
Regards
Ludovic
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] Question about float-abi
2012-02-29 13:49 ` Ludovic Desroches
@ 2012-02-29 14:47 ` Thomas Petazzoni
2012-03-01 8:09 ` Ludovic Desroches
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2012-02-29 14:47 UTC (permalink / raw)
To: buildroot
Hello Ludovic,
Le Wed, 29 Feb 2012 14:49:09 +0100,
Ludovic Desroches <ludovic.desroches@atmel.com> a ?crit :
> Yes there were missing options for gcc: --with-float=hard and
> --with-fpu=...
>
> Now floating score is correct. I am surprised by the good results of
> the uclibc. I don't know if nbench is an accurate benchmark to test
> several libc but scores obtained by glibc, eglibc and uclibc are very
> closed.
As I told you on IRC, those investigations are really interesting. We
know that the Buildroot support for floating-point is far from perfect,
this has been briefly discussed during the last Buildroot Developer
meeting. If you want to improve this part of Buildroot, do not hesitate
to send patches, we are definitely interested.
I guess with internal toolchains, it's quite easy to improve things.
The case of external toolchains is probably a bit more complicated,
since we do not control how the C library of the external toolchain has
been built in terms of floating point support.
Best regards,
Thomas
--
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] Question about float-abi
2012-02-29 14:47 ` Thomas Petazzoni
@ 2012-03-01 8:09 ` Ludovic Desroches
0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Desroches @ 2012-03-01 8:09 UTC (permalink / raw)
To: buildroot
Hello Thomas,
On 02/29/2012 03:47 PM, Thomas Petazzoni wrote:
> Hello Ludovic,
>
> Le Wed, 29 Feb 2012 14:49:09 +0100,
> Ludovic Desroches <ludovic.desroches@atmel.com> a ?crit :
>
>> Yes there were missing options for gcc: --with-float=hard and
>> --with-fpu=...
>>
>> Now floating score is correct. I am surprised by the good results of
>> the uclibc. I don't know if nbench is an accurate benchmark to test
>> several libc but scores obtained by glibc, eglibc and uclibc are very
>> closed.
> As I told you on IRC, those investigations are really interesting. We
> know that the Buildroot support for floating-point is far from perfect,
> this has been briefly discussed during the last Buildroot Developer
> meeting. If you want to improve this part of Buildroot, do not hesitate
> to send patches, we are definitely interested.
>
> I guess with internal toolchains, it's quite easy to improve things.
> The case of external toolchains is probably a bit more complicated,
> since we do not control how the C library of the external toolchain has
> been built in terms of floating point support.
>
I agree using external toolchain even those generated by crosstool-ng
can be a little more complicated. I was mostly worried about reproducibility
since I had some troubles to generate my toolchain with crosstool-ng:
the version of some packages were not compatible, I need specific package
version on host side, etc.
Crosstool-ng is a great tool to tune your toolchain and show me missing
options into Buildroot to support hard floating point.
Buildroot allows me to do what I want so it's good for me. The only thing
I can 'criticize' is that some options like BR2_VFP_FLOAT seem to enable
the hardware floating point support but in fact no, we need to set extra
settings.
I will try to give you extra feedbacks and to send some patches.
Regards
Ludovic
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-01 8:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-28 10:55 [Buildroot] Question about float-abi Ludovic Desroches
2012-02-29 11:08 ` Ludovic Desroches
2012-02-29 13:49 ` Ludovic Desroches
2012-02-29 14:47 ` Thomas Petazzoni
2012-03-01 8:09 ` Ludovic Desroches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox