digitalmars.D.learn - XMM Intrinsics
- Marcio Martins (12/12) May 08 2020 Hi,
- Simen =?UTF-8?B?S2rDpnLDpXM=?= (11/19) May 08 2020 You would use core.simd:
- kinke (6/9) May 08 2020 Nope one wouldn't, because that horrible interface isn't
- Simen =?UTF-8?B?S2rDpnLDpXM=?= (4/14) May 08 2020 TIL, thanks! :)
- Mike Parker (3/10) May 08 2020 DConf 2019: Not intrinsically about intrinsics -- Guillaume Piolat
- Guillaume Piolat (6/8) May 08 2020 Hello,
- Marcio Martins (7/15) May 08 2020 I saw the intel-intrinsics package, but unfortunately it stops at
- kinke (10/16) May 08 2020 Nope. But take a look at ldc.gccbuiltins_x86, it offers these 4
- Marcio Martins (6/23) May 08 2020 I know, but I don't have time to implement it and make it pretty,
- Olivier Pisano (3/6) May 09 2020 Here is mine:
Hi, I am building a CRC32C implementation using SSE for D, because I couldn't find any readily available :[ However, I am unable to find any documentation regarding which SSE instructions are available and how I could use them in D. I can see core.simd can't seem to make any use of it. How would I go about calling _mm_* functions in D in a way that is portable between D compilers? I am currently using LDC so if someone could point me a direction I can get this going even if only on LDC it would already be a great help. Cheers!
May 08 2020
On Friday, 8 May 2020 at 12:38:51 UTC, Marcio Martins wrote:Hi, I am building a CRC32C implementation using SSE for D, because I couldn't find any readily available :[ However, I am unable to find any documentation regarding which SSE instructions are available and how I could use them in D. I can see core.simd can't seem to make any use of it. How would I go about calling _mm_* functions in D in a way that is portable between D compilers?You would use core.simd: https://dlang.org/library/core/simd.html Sadly, the supported instructions are not documented on that page, and you'll need to look at the source to get at them: https://github.com/dlang/druntime/blob/master/src/core/simd.d#L85-L384 (I'll file a bug on this) There's a bit more info on D SIMD instructions here: https://dlang.org/spec/simd.html -- Siomen
May 08 2020
On Friday, 8 May 2020 at 12:49:00 UTC, Simen Kjærås wrote:Nope one wouldn't, because that horrible interface isn't supported by LDC, and I guess GDC neither. The intel-intrinsics dub package aims to provide a compiler-independent layer: https://code.dlang.org/packages/intel-intrinsicsHow would I go about calling _mm_* functions in D in a way that is portable between D compilers?You would use core.simd:
May 08 2020
On Friday, 8 May 2020 at 13:09:49 UTC, kinke wrote:On Friday, 8 May 2020 at 12:49:00 UTC, Simen Kjærås wrote:TIL, thanks! :) -- SimenNope one wouldn't, because that horrible interface isn't supported by LDC, and I guess GDC neither. The intel-intrinsics dub package aims to provide a compiler-independent layer: https://code.dlang.org/packages/intel-intrinsicsHow would I go about calling _mm_* functions in D in a way that is portable between D compilers?You would use core.simd:
May 08 2020
On Friday, 8 May 2020 at 20:14:05 UTC, Simen Kjærås wrote:DConf 2019: Not intrinsically about intrinsics -- Guillaume Piolat https://youtu.be/cmswsx1_BUQThe intel-intrinsics dub package aims to provide a compiler-independent layer: https://code.dlang.org/packages/intel-intrinsicsTIL, thanks! :) -- Simen
May 08 2020
On Friday, 8 May 2020 at 12:38:51 UTC, Marcio Martins wrote:How would I go about calling _mm_* functions in D in a way that is portable between D compilers?Hello, I've made this library for that exact purpose: https://github.com/AuburnSounds/intel-intrinsics Supports every intrinsic listed under MMX/SSE/SSE2/SSE3 in https://software.intel.com/sites/landingpage/IntrinsicsGuide/
May 08 2020
On Friday, 8 May 2020 at 13:11:02 UTC, Guillaume Piolat wrote:On Friday, 8 May 2020 at 12:38:51 UTC, Marcio Martins wrote:I saw the intel-intrinsics package, but unfortunately it stops at SEE3 and I need SSE4.2 for this. How is this library working? Will LDC/LLVM detect the name and replace it with the right instructions? If so, could I just provide an empty _mm_crc32_u8 and it'd pick it up correctly? Thanks guys!How would I go about calling _mm_* functions in D in a way that is portable between D compilers?Hello, I've made this library for that exact purpose: https://github.com/AuburnSounds/intel-intrinsics Supports every intrinsic listed under MMX/SSE/SSE2/SSE3 in https://software.intel.com/sites/landingpage/IntrinsicsGuide/
May 08 2020
On Friday, 8 May 2020 at 13:30:42 UTC, Marcio Martins wrote:I saw the intel-intrinsics package, but unfortunately it stops at SEE3 and I need SSE4.2 for this. How is this library working?It's open source. :)Will LDC/LLVM detect the name and replace it with the right instructions? If so, could I just provide an empty _mm_crc32_u8 and it'd pick it up correctly?Nope. But take a look at ldc.gccbuiltins_x86, it offers these 4 builtins: int __builtin_ia32_crc32hi(int, short); int __builtin_ia32_crc32si(int, int); int __builtin_ia32_crc32qi(int, byte); long __builtin_ia32_crc32di(long, long); Make sure to compile with `-mattr=+sse4.2` to enable these instructions.
May 08 2020
On Friday, 8 May 2020 at 13:56:18 UTC, kinke wrote:On Friday, 8 May 2020 at 13:30:42 UTC, Marcio Martins wrote:I know, but I don't have time to implement it and make it pretty, I am prototyping with very little time.I saw the intel-intrinsics package, but unfortunately it stops at SEE3 and I need SSE4.2 for this. How is this library working?It's open source. :)YES! Thank you, this is exactly what I was looking for. I suppose I will have to implement a scalar version for DMD later... I don't even know why I bother with DMD...Will LDC/LLVM detect the name and replace it with the right instructions? If so, could I just provide an empty _mm_crc32_u8 and it'd pick it up correctly?Nope. But take a look at ldc.gccbuiltins_x86, it offers these 4 builtins: int __builtin_ia32_crc32hi(int, short); int __builtin_ia32_crc32si(int, int); int __builtin_ia32_crc32qi(int, byte); long __builtin_ia32_crc32di(long, long); Make sure to compile with `-mattr=+sse4.2` to enable these instructions.
May 08 2020
On Friday, 8 May 2020 at 12:38:51 UTC, Marcio Martins wrote:Hi, I am building a CRC32C implementation using SSE for D, because I couldn't find any readily available :[Here is mine: https://github.com/opisano/crc32c/blob/master/crc32c.d
May 09 2020