Optimizing for SIMD: best practices?(i.e. what features are allowed?)

Guillaume Piolat first.name at spam.org
Fri Feb 26 14:50:58 UTC 2021


On Thursday, 25 February 2021 at 14:28:40 UTC, Guillaume Piolat 
wrote:
> On Thursday, 25 February 2021 at 11:28:14 UTC, z wrote:
>> How does one optimize code to make full use of the CPU's SIMD 
>> capabilities?
>> Is there any way to guarantee that "packed" versions of SIMD 
>> instructions will be used?(e.g. vmulps, vsqrtps, etc...)
>
> https://code.dlang.org/packages/intel-intrinsics

A bit of elaboration on why you might want to prefer 
intel-intrinsics:
- it supports all D compilers, including DMD 32-bit target
- targets arm32 and arm64 with same code (LDC only)
- core.simd just give you the basic operators, but not say, 
pmaddwd or any of the complex instructions. Some instructions 
need very specific work to get them.
- at least with LLVM, optimizers works reliably over subsequent 
versions of the compiler.



More information about the Digitalmars-d-learn mailing list