Update to SIMD Support

Immo L

A month ago we announced support for SIMD. Today, we’re announcing an update to “RyuJIT” and our NuGet package that exposes the SIMD programming model.

Updates to the Microsoft.Bcl.Simd NuGet package

More types for Vector<T>

We’ve expanded the support of the Vector<T> types:

  • We now support int, long, float, double as well as byte, sbyte, ushort and short.
  • Support for uint, ulong is still coming.

Support for mutable vector types

We’ve also changed our stance on immutability. In the previous release all types were immutable. The primary reason was that we wanted to discourage element-wise initialization for Vector<T>. For consistency we originally decided to apply immutability to the fixed size vector types (Vector2f, Vector3f and Vector3f).

Based on your feedback we decided to change this. Now it looks as follows:

  • Vector<T> is still immutable as we believe that’s the right design due to the way this type works.
  • Vector2f, Vector3f and Vector4f are now mutable. This is primarily done to match the shape of existing vector types, especially from the graphics domain.

This means you can now write code like this:

// Still possible:
Vector3f v = new Vector3f(1f, 2f, 3f);

// Now also possible:
Vector3f w = new Vector3f();
w.X = 1f;
w.Y = 2f;
w.Z = 3f;

Better support for arrays

Vector<T> has support for moving data from and to arrays:

// Array of 2 * Vector<int>.Length values
int[] values = CreateValues();

// Multiply the first N values with the second
// N values (N, being Vector<int>.Length).
Vector<int> x = new Vector<int>(values, 0);
Vector<int> y = new Vector<int>(values, Vector<int>.Length);
Vector<int> z = x * y;

// Store the result in the array where x came from
z.CopyTo(values, 0);

With this update, Vector<T>.CopyTo() is now a JIT intrinsic and will result in a store from the SIMD register right into memory.

Updates to the JIT “RyuJIT”

We’ve added support for “RyuJIT” for non-Windows 8 machines. If you install the new .NET Framework 4.5.2, you can use “RyuJIT” on Windows Vista, Windows 7, Windows Server 2008, and Windows Server 2012.

You should also take a look at this post on the CLR code gen blog. Kevin Frei is our JIT dev lead and quite an active blogger. This way, you can get the information right from the horse’s mouth so to speak.

You can download the updated RyuJIT here.


We’ve just released an update for SIMD support, which includes an update to “RyuJIT” as well the Microsoft.Bcl.Simd NuGet package. In order to be able to install RyuJIT on a non-Windows 8 machine, you need to install .NET Framework 4.5.2 first.

Please download & play with the bits – we’d love to hear your feedback! For bugs, please send us a mail to ryujit(at)microsoft.com.


Comments are closed. Login to edit/delete your existing comments