{"id":363,"date":"2014-05-13T14:27:00","date_gmt":"2014-05-13T14:27:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/dotnet\/2014\/05\/13\/update-to-simd-support\/"},"modified":"2021-09-30T16:49:19","modified_gmt":"2021-09-30T23:49:19","slug":"update-to-simd-support","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/dotnet\/update-to-simd-support\/","title":{"rendered":"Update to SIMD Support"},"content":{"rendered":"<p>A month ago <a href=\"http:\/\/blogs.msdn.com\/b\/dotnet\/archive\/2014\/04\/07\/the-jit-finally-proposed-jit-and-simd-are-getting-married.aspx\">we announced support for SIMD<\/a>. Today, we&#8217;re announcing an update to &#8220;RyuJIT&#8221; and <a href=\"http:\/\/nuget.org\/packages\/Microsoft.Bcl.Simd\">our NuGet package<\/a> that exposes the SIMD programming model.<\/p>\n<h2>Updates to the Microsoft.Bcl.Simd NuGet package<\/h2>\n<h2>More types for <code>Vector&lt;T&gt;<\/code><\/h2>\n<p>We&#8217;ve expanded the support of the <code>Vector&lt;T&gt;<\/code> types:<\/p>\n<ul>\n<li>We now support <code>int<\/code>, <code>long<\/code>, <code>float<\/code>, <code>double<\/code> as well as <code>byte<\/code>, <code>sbyte<\/code>, <code>ushort<\/code> and <code>short<\/code>.<\/li>\n<li>Support for <code>uint<\/code>, <code>ulong<\/code> is still coming.<\/li>\n<\/ul>\n<h2>Support for mutable vector types<\/h2>\n<p>We&#8217;ve also changed our stance on immutability. In the <a href=\"http:\/\/blogs.msdn.com\/b\/dotnet\/archive\/2014\/04\/07\/the-jit-finally-proposed-jit-and-simd-are-getting-married.aspx\">previous release<\/a> all types were immutable. The primary reason was that we wanted to discourage element-wise initialization for <code>Vector&lt;T&gt;<\/code>. For consistency we originally decided to apply immutability to the fixed size vector types (<code>Vector2f<\/code>, <code>Vector3f<\/code> and <code>Vector3f<\/code>).<\/p>\n<p>Based on your feedback we decided to change this. Now it looks as follows:<\/p>\n<ul>\n<li><code>Vector&lt;T&gt;<\/code> is still immutable as we believe that&#8217;s the right design due to the way this type works.<\/li>\n<li>Vector2f, Vector3f and Vector4f are now mutable. This is primarily done to match the shape of existing vector types, especially from the graphics domain.<\/li>\n<\/ul>\n<p>This means you can now write code like this:<\/p>\n<pre><code>\/\/ Still possible:<br \/>Vector3f v = new Vector3f(1f, 2f, 3f);<br \/><br \/>\/\/ Now also possible:<br \/>Vector3f w = new Vector3f();<br \/>w.X = 1f;<br \/>w.Y = 2f;<br \/>w.Z = 3f;<\/code><\/pre>\n<h2>Better support for arrays<\/h2>\n<p><code>Vector&lt;T&gt;<\/code> has support for moving data from and to arrays:<\/p>\n<pre><code>\/\/ Array of 2 * Vector&lt;int&gt;.Length values<br \/>int[] values = CreateValues();<br \/><br \/>\/\/ Multiply the first N values with the second<br \/>\/\/ N values (N, being Vector&lt;int&gt;.Length).<br \/>Vector&lt;int&gt; x = new Vector&lt;int&gt;(values, 0);<br \/>Vector&lt;int&gt; y = new Vector&lt;int&gt;(values, Vector&lt;int&gt;.Length);<br \/>Vector&lt;int&gt; z = x * y;<br \/><br \/>\/\/ Store the result in the array where x came from<br \/>z.CopyTo(values, 0);<\/code><\/pre>\n<p>With this update, <code>Vector&lt;T&gt;.CopyTo()<\/code> is now a JIT intrinsic and will result in a store from the SIMD register right into memory.<\/p>\n<h2>Updates to the JIT &#8220;RyuJIT&#8221;<\/h2>\n<p>We&#8217;ve added support for &#8220;RyuJIT&#8221; for non-Windows 8 machines. If you install the <a href=\"http:\/\/blogs.msdn.com\/b\/dotnet\/archive\/2014\/05\/05\/announcing-the-net-framework-4-5-2-release.aspx\">new .NET Framework 4.5.2<\/a>, you can use &#8220;RyuJIT&#8221; on Windows Vista, Windows 7, Windows Server 2008, and Windows Server 2012.<\/p>\n<p>You should also take a look at <a href=\"http:\/\/blogs.msdn.com\/b\/clrcodegeneration\/archive\/2014\/05\/12\/ryujit-ctp4-now-with-more-simd-types-and-better-os-support.aspx\">this post<\/a> 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&#8217;s mouth so to speak.<\/p>\n<p>You can download the updated <a href=\"https:\/\/aka.ms\/RyuJIT\">RyuJIT here<\/a>.<\/p>\n<h2>Summary<\/h2>\n<p>We&#8217;ve just released an update for SIMD support, which includes <a href=\"http:\/\/blogs.msdn.com\/b\/clrcodegeneration\/archive\/2014\/05\/12\/ryujit-ctp4-now-with-more-simd-types-and-better-os-support.aspx\">an update to &#8220;RyuJIT&#8221;<\/a> as well the <a href=\"http:\/\/nuget.org\/packages\/Microsoft.Bcl.Simd\">Microsoft.Bcl.Simd NuGet package<\/a>. In order to be able to install RyuJIT on a non-Windows&nbsp;8 machine, you need to install <a href=\"http:\/\/blogs.msdn.com\/b\/dotnet\/archive\/2014\/05\/05\/announcing-the-net-framework-4-5-2-release.aspx\">.NET Framework 4.5.2<\/a> first.<\/p>\n<p>Please download &amp; play with the bits &#8211; we&#8217;d love to hear your feedback! For bugs, please send us a mail to ryujit(at)microsoft.com.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A month ago we announced support for SIMD. Today, we&#8217;re announcing an update to &#8220;RyuJIT&#8221; and our NuGet package that exposes the SIMD programming model. Updates to the Microsoft.Bcl.Simd NuGet package More types for Vector&lt;T&gt; We&#8217;ve expanded the support of the Vector&lt;T&gt; types: We now support int, long, float, double as well as byte, sbyte, [&hellip;]<\/p>\n","protected":false},"author":335,"featured_media":58792,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[685],"tags":[11,30,43,47,77,88,104,117,128],"class_list":["post-363","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dotnet","tag-net-framework","tag-announcement","tag-bcl","tag-clr","tag-fundamentals","tag-jit","tag-nuget","tag-releases","tag-simd"],"acf":[],"blog_post_summary":"<p>A month ago we announced support for SIMD. Today, we&#8217;re announcing an update to &#8220;RyuJIT&#8221; and our NuGet package that exposes the SIMD programming model. Updates to the Microsoft.Bcl.Simd NuGet package More types for Vector&lt;T&gt; We&#8217;ve expanded the support of the Vector&lt;T&gt; types: We now support int, long, float, double as well as byte, sbyte, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/users\/335"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/comments?post=363"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/posts\/363\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media\/58792"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/media?parent=363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/categories?post=363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/dotnet\/wp-json\/wp\/v2\/tags?post=363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}