Am Tue, Nov 16, 2021 at 11:27:44AM +0100 schrieb Landry Breuil:
> Le Wed, Nov 10, 2021 at 03:32:21PM +0100, Patrick Wildt a écrit :
> > Hi,
> > 
> > on my ARM64 workstation firefox has recently begun crashing all the
> > time.  Turns out it's because QCMS (whatever that is), uses some HW
> > acceleration (SIMD using NEON/VFP) on ARM64, and the LLVM-backed Rust-
> > compiler seems to not produce a pseudo-op that instead of emitting
> > a proper ASM instruction creates a call to it:
> > 
> >          U llvm.fptosi.sat.v4i32.v4f32
> > 
> > This change is a workaround which simply makes QCMS not use NEON on
> > AArch64.  In the end the right fix would be in Rust/LLVM to create
> > proper ASM, but I don't know where to look.  Maybe a future update
> > of Rust/LLVM will fix it automatically.
> > 
> > This patch will continue to compile the NEON extensions, so nm(1)
> > will still show the reference, but the extensions won't be used.
> > 
> > Not sure this is worth committing.  For now I'll use this locally.
> 
> Sorry for not replying earlier, was offline.
> 
> I didnt even know firefox actually worked on arm64, which i never used
> :) as for the patch itself, i doubt it is upstreamable as is, but i'd
> like at least this to be reported upstream so that rust/qcms/aarch64
> experts can chime in on the subject. Can you take care of that, or
> should i proxy it ?
> 
> As you say, the right fix would be in rust, but my understanding is that
> rust on OpenBSD/arm64 doesnt produce the same working asm as
> Linux/aarch64 uses ?
> 
> Landry

The patch definitely isn't upstreamable, and I don't think I'd want to
upstream that. :D

The problem is somewhere in Rust/LLVM.  Basically QCMS is doing some
regular floating point to integer conversions.  And by regular I mean
that it's not doing fancy weird stuff, it's basically just doing
floating point calculations, it's all correct.

Now something in the compiler produces a pseudo-operation internally.
Typically, as soon as the compiler starts emitting ASM, this pseudo-op
is converted to an actual instruction.  It seems like this doesn't
happen in the compiler.

I would assume that a version update of the LLVM-backend in Rust will
at some point fix the issue.

Of course one problem could still be that for Linux some other codepath
is hit in the compiler, and it doesn't show that problem.  But, I don't
know how to fix that.  I don't even understand which codebase to look
into, and even then, LLVM is just so big, I don't know where to look...

That said, I guess this could be tested easily by extracting that single
rust file from QCMS and trying to compile it standalone, then looking at
what it links to.

Reply via email to