Skip to contentSkip to conversation

alsa-lib: Add option to allow calculations in float for soft float targets

PATCH New Jörg Krause 4 participants 6 messages May 7, 2016 – Jul 4, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alsa-lib: Add option to allow calculations in float for soft float targets

The --with-softfloat config option is a little bit misleading as it actually
means: "avoid calculations in float" [1].

Add a menu config option to allow floating point emulation for soft float targets. This option is enabled by default for soft float targets.

[1]
http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=configure.ac;h=c265ec9e159bdf76a6829ab8f7d625ac72b25501;#l226

---
 package/alsa-lib/Config.in   | 6 ++++++
 package/alsa-lib/alsa-lib.mk | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
package/alsa-lib/Config.in +6 -0
index 97e8489..8c50e4f 100644
@@ -33,6 +33,12 @@ config BR2_PACKAGE_ALSA_LIB_DEVDIR
 	string "directory with ALSA device files"
 	default "/dev/snd"
 
+config BR2_PACKAGE_ALSA_LIB_NO_FLOAT
+	bool "Avoid calculation in float"
+	default y if BR2_SOFT_FLOAT
+	help
+	  Disables all calculations requiring floating point routines.
+
 config BR2_PACKAGE_ALSA_LIB_PCM_PLUGINS
 	string "built PCM plugins"
 	default "all" if BR2_USE_MMU
package/alsa-lib/alsa-lib.mk +1 -1
index ae0377d..b065a54 100644
@@ -62,7 +62,7 @@ else
 ALSA_LIB_CONF_OPTS += --disable-python
 endif
 
-ifeq ($(BR2_SOFT_FLOAT),y)
+ifeq ($(BR2_PACKAGE_ALSA_LIB_NO_FLOAT),y)
 ALSA_LIB_CONF_OPTS += --with-softfloat
 endif
 
Signature · 1 line
2.8.2
#1 lore raw

PATCH 1/1 alsa-lib: Add option to allow calculations in float for soft float targets

Hello,

package/alsa-lib/alsa-lib.mk else · line 67

Quoted 4 lines · J?rg Krause
package/alsa-lib/alsa-lib.mk +1 -1
-ifeq ($(BR2_SOFT_FLOAT),y)
+ifeq ($(BR2_PACKAGE_ALSA_LIB_NO_FLOAT),y)
 ALSA_LIB_CONF_OPTS += --with-softfloat
 endif

So we were already passing --with-softfloat when BR2_SOFT_FLOAT=y. So what your option brings is:

- Ability to use floating point operations when BR2_SOFT_FLOAT=y.

- Ability to not use floating point operations when BR2_SOFT_FLOAT is disabled.

Do you have any actual use for such possibilities ?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 alsa-lib: Add option to allow calculations in float for soft float targets

Quoted 12 lines · Thomas Petazzoni

Hello,

Quoted 4 lines · J?rg Krause
package/alsa-lib/alsa-lib.mk +1 -1
-ifeq ($(BR2_SOFT_FLOAT),y)
+ifeq ($(BR2_PACKAGE_ALSA_LIB_NO_FLOAT),y)

?ALSA_LIB_CONF_OPTS += --with-softfloat
?endif

So we were already passing --with-softfloat when BR2_SOFT_FLOAT=y. So what your option brings is:

Quoted 7 lines

?- Ability to use floating point operations when BR2_SOFT_FLOAT=y.

?- Ability to not use floating point operations when BR2_SOFT_FLOAT is
???disabled.

Do you have any actual use for such possibilities ?

Yes, for the first case.

I want to use a feature from the alsa-lib which is opted-out at compile time for softfloat targets by #ifndef HAVE_SOFT_FLOAT [1]. This functionality requires floating point data types and libmath operations.

I do not see any point in disabling this unconditionally for softfloat targets, as a?software floating point library can emulate this.

[1]
http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/pcm/pcm_softvo
l.c;h=802aa4b7cb68e444b8b47e7140870141aad65ffc;hb=HEAD#l785

Best regards
J?rg Krause

#3 lore raw

PATCH 1/1 alsa-lib: Add option to allow calculations in float for soft float targets

Quoted 23 lines · J?rg Krause
Quoted 12 lines · Thomas Petazzoni

Hello,

package/alsa-lib/alsa-lib.mk else · line 67

Quoted 4 lines · J?rg Krause
package/alsa-lib/alsa-lib.mk +1 -1
-ifeq ($(BR2_SOFT_FLOAT),y)
+ifeq ($(BR2_PACKAGE_ALSA_LIB_NO_FLOAT),y)
 ALSA_LIB_CONF_OPTS += --with-softfloat
 endif

So we were already passing --with-softfloat when BR2_SOFT_FLOAT=y. So what your option brings is:

Quoted 7 lines

- Ability to use floating point operations when BR2_SOFT_FLOAT=y.

- Ability to not use floating point operations when BR2_SOFT_FLOAT
is
disabled.

Do you have any actual use for such possibilities ?

Yes, for the first case.

Quoted 7 lines

I want to use a feature from the alsa-lib which is opted-out at compile time for softfloat targets by #ifndef HAVE_SOFT_FLOAT [1]. This functionality requires floating point data types and libmath operations.

I do not see any point in disabling this unconditionally for softfloat targets, as a software floating point library can emulate this.

The question is: is there a point in disabling it at all, ever? Does it have a
big impact on size, or does it require functionality which may not be available for a particular target arch?

If not, I'd vote for unconditionally disabling the softfloat option.

That said, I remember that there was some option (not sure if it was alsalib
or another lib) to choose between floating point (accurate but slower) and fixed point (less accurate but faster) for some filtering operations. *That* would be a relevant user-settable option.

Regards,
Arnout

Quoted 12 lines

[1]
http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/pcm/pcm_softvo
l.c;h=802aa4b7cb68e444b8b47e7140870141aad65ffc;hb=HEAD#l785

Best regards
J?rg Krause
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#4 lore raw

PATCH 1/1 alsa-lib: Add option to allow calculations in float for soft float targets

Quoted 37 lines · Arnout Vandecappelle
Quoted 32 lines · J?rg Krause
Quoted 16 lines · Thomas Petazzoni

Hello,

Quoted 4 lines · J?rg Krause
package/alsa-lib/alsa-lib.mk +1 -1
-ifeq ($(BR2_SOFT_FLOAT),y)
+ifeq ($(BR2_PACKAGE_ALSA_LIB_NO_FLOAT),y)

?ALSA_LIB_CONF_OPTS += --with-softfloat
?endif

So we were already passing --with-softfloat when
BR2_SOFT_FLOAT=y. So
what your option brings is:

?- Ability to use floating point operations when
BR2_SOFT_FLOAT=y.

Quoted 6 lines

?- Ability to not use floating point operations when BR2_SOFT_FLOAT
is
???disabled.

Do you have any actual use for such possibilities ?

Yes, for the first case.

I want to use a feature from the alsa-lib which is opted-out at compile
time for softfloat targets by #ifndef HAVE_SOFT_FLOAT [1]. This functionality requires floating point data types and libmath operations.

Quoted 3 lines

I do not see any point in disabling this unconditionally for softfloat
targets, as a software floating point library can emulate this.

Quoted 5 lines

? The question is: is there a point in disabling it at all, ever? Does it have a?
big impact on size, or does it require functionality which may not be available?
for a particular target arch?

No, it does not. Setting softfloat only disables functionality using floating point types and routines.

Quoted 2 lines

? If not, I'd vote for unconditionally disabling the softfloat option.

I agree. However, this changes the current behaviour how alsa-lib is build for soft-float targets. That's why I added an option which preserves the current configuration.

Quoted 7 lines

? That said, I remember that there was some option (not sure if it was alsalib?
or another lib) to choose between floating point (accurate but slower) and fixed?
point (less accurate but faster) for some filtering operations. *That* would be?
a relevant user-settable option.

Yes, but it does not apply to alsa-lib.

Best regards
J?rg Krause

#5 lore raw

PATCH 1/1 alsa-lib: Add option to allow calculations in float for soft float targets

In reply to Jörg Krause
Quoted 5 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"J?rg" == J?rg Krause <[email protected]> writes:

The --with-softfloat config option is a little bit misleading as it actually
means: "avoid calculations in float" [1].

Quoted 7 lines

Add a menu config option to allow floating point emulation for soft float targets. This option is enabled by default for soft float targets.

[1]
http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=configure.ac;h=c265ec9e159bdf76a6829ab8f7d625ac72b25501;#l226

I had a look and the size difference is really quite small (65K):

-rwxr-xr-x 1 peko peko 774K Jul 4 18:50 target-orig/usr/lib/libasound.so.2.0.0 -rwxr-xr-x 1 peko peko 709K Jul 4 19:08 target-softfloat/usr/lib/libasound.so.2.0.0

So having an option for it imho doesn't make any sense.

The size difference basically all comes from the fact that the lfloat and ladspa get disabled when --with-softfloat is passed. If these are manually disabled (instead of passing all) the extra bloat is gone:

-rwxr-xr-x 1 peko peko 709K Jul 4 19:08 target-softfloat/usr/lib/libasound.so.2.0.0 -rwxr-xr-x 1 peko peko 709K Jul 4 21:34 target/usr/lib/libasound.so.2.0.0

So I've simply dropped --with-softfloat and marked this patch as rejected.

Signature · 1 line
Bye, Peter Korsgaard