[Development] Updating x86 SIMD support in Qt

Lorn Potter lorn.potter at gmail.com
Thu Jan 20 22:10:08 CET 2022



On 21/1/2022 6:10 AM, Thiago Macieira wrote:
> On Thursday, 20 January 2022 11:22:19 PST Lorn Potter wrote:
>> It's like Jean-Michael says, 32 bit, but it's complicated.
> 
> Yeah, I can get that :)
> 
>  From what I've understood so far, WASM is not __x86_64__ but it might be
> __i386__. So far, that's not a problem. I don't think we use any assembly or
> non-vector intrinsic in general code (qnumeric.h would come to mind but those
> functions need to be constexpr).
> 
> That means we could support WASM as i386 ABI version 0: no vector operation
> support. We currently default to turning that on, so keeping an option to turn
> it back off is in the plans.

well, from https://emscripten.org/docs/porting/simd.html
"also turn on LLVM’s autovectorization passes, so no source 
modifications are necessary to benefit from SIMD."
so emscripten's simd support is more than just sse2, sse3, etc.

> 
> Additionally, looks like Emscripten has an option to transform the SSE 128-bit
> intrinsics into WASM 128-bit vector content. I don't personally have a problem
> with that, but WASM users might if the translation / emulation isn't very
> good. From a link that Morten provided, there are several operations we do use
> in our code today that are emulated slowly.

 From the few benchmarks I ran, there was minimal slowdowns and more 
often a performance enhancement. But I am no expert in simd.

> 
> I do have a problem if you prevent me from using the 256-bit intrinsics. This
> this the whole point of this thread. I need the 256-bit intrinsics from AVX,
> AVX2 and AVX512 to be available and compile.
> 
> So my request is that the CI not prevent me from using those intrinsics in
> native x86. If they work with Emscripten, great; if they don't, then the
> support gets disabled in the CI.
> 
well, CI doesn't build wasm simd, so in this respect, it doesn't concern me.

256-bit intrinsics won't work in wasm/emscripten so don't enable them 
for those platforms that don't support them like wasm.

Just don't stop platforms from using 128bit intrinsics such as sse2.


-- 
Lorn Potter
Freelance Qt Developer. Platform Maintainer Qt WebAssembly, Maintainer 
QtSensors
Author, Hands-on Mobile and Embedded Development with Qt 5



More information about the Development mailing list