Hi Everyone,
What are your thoughts on optionally using NASM for Windows ARM builds?
The first part of the problem is ASM for Microsoft platofrms. We can inline for Win32/X86. For X64, we have to provide a separate source file and use masm64. X64 is the reason for x64dll.asm and friends. For ARM, there's nothing because Microsoft tools don't support ARM ASM. For ARM, we rely on intrinsics at the moment.
The second part of the problem is intrinsics may not be meeting performance expectations. We got a private report over the weekend that ARM64 was performing orders of magnitude slower than C/C++. The code was intrinsics-based, and it was running on Linux. Part of the reason we used intrinsics was it was available to Windows clients.
My testing did not reveal the ARM64 gap, but I think the situation is fairly
typical - a user simply builds the sources under their favorite
toolchain and something pops out. The toolchain may (or may not) set appropriate flags and the user may (or may not) set appropriate flags. I can live with "instrinsics usually run faster than C/C++" or
"instrinsics do not run slower". But I don't like "instrinsics sometimes
run slower". Some of these devices are too hard for me to test (like
Windows Phone and tablet), so i don't want to risk it for Windows users.
I think we can address the gap, but we need to expand our repertoire with a cross-platform assembler. As far as I know, the cross-platform assembler is NASM. Does anyone know of any others?
NASM has another hidden benefit for distros and app suppliers. Using NASM, we could provide, say, NASM_SSE2_SomeFunc and NASM_AVX_SomeFunc from a single source file. We can't currently do that because when we enable AVX for NASM_AVX_SomeFunc, then SSE4 and AVX could cross-pollinate into NASM_SSE2_SomeFunc. That will result in an "Illegal Instruction" exception.
If things work well, then we could extend NASM to all platforms, like X86 and X64 on Windows and Linux. But that's just wishful thinking at the moment.
There is no free lunch. Development and maintencane costs increase for us. I pinged Wei about it, and he left it up to us.
Jeff