Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What do i need to use SIMD with visual studio 2013 update 2?

All i'm finding on the web is a plethora of posts about how to use it back before update 2 was out, i didn't want to destroy my machine back then so i simply thought i'd wait untill it gets released.

Now it's out, i have VS 2013 Professional update 2 installed, i see a new Framework (4.5.2) exists but i still only have 4.5.1

What do i need to be able to use simd vectors? Do i need to install 4.5.2? Do i need to download the blc package that was used in the beta or is that supposed to be integrated in the Framework?

like image 881
Ronan Thibaudau Avatar asked Feb 12 '23 21:02

Ronan Thibaudau


1 Answers

This stuff is changing quickly, but a fairly definitive source is the .NET CodeGen blog. First off, SIMD support requires RyuJIT, the next generation JIT compiler, which is in CTP so it has some limitations. To get SIMD support working with .NET 4.5.1, you must

  1. Use Windows 8.1 or Server 2012 R2.
  2. Install the RyuJIT CTP. They are currently on CTP 4.
  3. Enable RyuJIT. Note point 6:

    Add a reference to Microsoft.Numerics.Vectors.Vector<T> to a class constructor that will be invoked BEFORE your methods that use the new Vector types.

  4. Run your program as 64-bit (i.e. not targeting x86 or Any CPU prefer 32-bit).
  5. Use the Vector types in the Microsoft.Bcl.Simd Nuget package. These are JIT intrinsics, i.e. the JIT knows to emit special machine code when you use them.
  6. Have hardware that supports SIMD. The RyuJIT CTP only supports SSE2. AVX SIMD, where available, is planned only for the full release since it requires other changes to the .NET runtime.
If you have 4.5.2 AND RyuJIT CTP4, you can use RyuJIT (and thus SIMD as well) on Vista, Windows 7, and 8 (and the analogous server OS's) as well.
like image 175
Mike Zboray Avatar answered Apr 28 '23 01:04

Mike Zboray