Does .NET Framework 4.5 provide SSE4/AVX support?

…衆ロ難τιáo~ 提交于 2019-12-07 06:30:35

问题


I think, I heard about that, but don't know where.

upd: I told about JiT


回答1:


it seem that it is coming. (I just found out an hour ago)

here a few links

The JIT finally proposed. JIT and SIMD are getting married.

Update to SIMD Support

you need the latest version of RyuJIT

and Microsoft SIMD-enabled Vector Types (Nuget)




回答2:


No, there's no scenario in .NET where you can write machine code yourself. Code generation is entirely up to the just-in-time compiler. It is certainly capable of customizing its code generation based on the capabilities of the machine's processor. One of the big reasons why ngen.exe must always be run on the target machine. Whether the jitters in .NET 4.5 were tweaked to take advantage of sse4 or avx is an open question, I haven't heard anything about it. I rather doubt it, Microsoft doesn't tinker with the jitters a great deal, other than to fix bugs. Very destabilizing and 4.5 is not a side-by-side version.

VS-11 does however have an updated code generator for C++. It is capable of automatically vectorizing loops and does use SIMD/AVX instructions to do so. This blog post mentions it, a brief video is available here.


Update: the new x64 jitter, currently in CTP and codenamed RyuJIT, includes some rudimentary support for SIMD instructions. The SSE2 kind, providing auto-vectorization. It is however locked up pretty tight into the Microsoft.Bcl.Simd package and the Vector<> classes, there is no universal solution for the 16-byte memory alignment requirement that SIMD needs to run fast.

The more likely to be fruitful path forward is .NET Native, announced at the last Build conference. It uses the C++ compiler's back-end to generate code ahead-of-time, automatically benefiting from its built-in support for auto-vectorization and auto-parallelization. Otherwise without a clear explanation yet how the memory alignment issue was addressed. It has its own problems, Reflection is difficult, and is currently only supported for packaged apps, the kind whose runtime dependencies can be determined ahead of time. Windows Store and Phone apps.


Update: this shipped in .NET 4.6, System.Numerics.Vectors.dll assembly. Beware that the one included with the framework is the "safe" one and does not match the MSDN documentation, Vector<T> is missing. The Nuget package (version 4.1.0) does match.




回答3:


Yes, you can use some vector types to ensure hardware acceleration is used when available.

https://docs.microsoft.com/en-us/dotnet/standard/numerics#simd-enabled-vector-types



来源:https://stackoverflow.com/questions/10774869/does-net-framework-4-5-provide-sse4-avx-support

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!