[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: enabling/disabling AltiVec in Firefox and derived browsers (ArcticFox)



On Sun, Feb 28, 2021 at 11:52:12PM +0000, Luke Kenneth Casson Leighton wrote:
> On Monday, March 1, 2021, Riccardo Mottola <riccardo.mottola@libero.it>
> wrote:
> 
> > A quick solution would to have this configure as a convenience, but have
> a way to pass an --enable-altivec and -disable-altivec (or with/without?)
> parameter to configure.
> 
> EABI v2.0 rather unfortunately, despite it being optional in the OpenPOWER
> Compliancy Suite, made SIMD mandatory.
> 
> EABI v1.5 does not require SIMD.
> 
> the problem is that the assumption "#ifdef POWER9" is bleeding through to
> many code repositories.
> 
> Tulio Magno Quites Machado Filho is currently working on glibc6 patches
> which reverse these erroneous assumptions, replacing them with "#ifdef VSX"
> thus allowing people to compile code that does not rely on SIMD.

Beware that VSX is not Altivec. Altivec was called VMX by IBM and
VSX is a superset of Altivec (IIRC).

G4 and G5 do not have VSX. 

> 
> unfortunately it is somewhat a lost cause because of the mistake made in
> EABI v2.  modifying EABI v2 to make SIMD optional is no longer possible
> because it would break backwards compatibility, the only option being to
> create a new triplet, then an entire new distro port, and that is a 3 to 5
> year process.
> 
> an alternative solution is to have a kernel-level emulator of SIMD
> instructions.
> https://bugs.libre-soc.org/show_bug.cgi?id=602

This is going to be hopelessly slow. The point of SIMD is to process
quickly vast amounts of data, the overhead of every single emulated
instructions is counted in hundreds of cycles.

IMHO, the only solution is to:
a) only use SIMD in library code
b) compile 2 or 3 versions of libraries: no SIMD, VMX and/or VSX
c) put each library in a different directory
d) at run time, select the path to load the libraries from CPU
   capabilities

There is a precedent for this in the x86 world, where there were i386
and i686 directories to support the PPro. It is still the case on the
machines where I have to install 32 bit libraries:

$ locate libx264.so
/usr/lib/i386-linux-gnu/i686/sse2/libx264.so.155
/usr/lib/i386-linux-gnu/libx264.so.155
/usr/lib/x86_64-linux-gnu/libx264.so.155

There are two 32 bit versions of the libx264, one for old processors and
one for processors with sse2.

	Regards,
	Gabriel


> 
> fascinatingly there is precedent for this in the form of sstep.c which
> triggers from illegal instruction trap and emulates some parts of the
> OpenPOWER ISA.
> 
> l.
> 
> 
> -- 
> ---
> crowd-funded eco-conscious hardware: https://www.crowdsupply.com/eoma68
 


Reply to: