问题描述
我目前的编码在C#中的应用程序可能使用SSE受益匪浅,作为一个相对较小的一段代码导致的执行时间90-95%。代码本身也是完美的SSE(因为它是矩阵和vectorbased),所以我继续开始使用Mono.Simd即使这取得了执行时间显著差异,这仍然是不够的。与Mono.Simd的问题是,它只有很老的SSE指令(主要来自SSE1烯SSE2,我相信),这会导致例如数量积(或标量/内积),以占用3的说明,而也可以是与SSE4仅在1个指令实现(因为SSE4可自2006年以来人们可以安全地假定每一个现代的电脑现在有它)。此外,其他功能一堆不包括所有(让每个号为例,这还需要一个笨拙的解决办法的绝对值)。
I'm currently coding an application in C# which could benefit a great deal from using SSE, as a relative small piece of code causes 90-95% of the execution time. The code itself is also perfect for SSE (as it's matrix and vectorbased), so I went ahead and started to use Mono.Simd and even though this made a significant difference in execution time, this still isn't enough. The problem with Mono.Simd is that it only has very old SSE-instruction (mainly from SSE1 en SSE2, I believe), which causes the dotproduct (or scalar/inner product) for example to take up 3 instructions, while it can be implemented with SSE4 in only 1 instruction (and since SSE4 is available since 2006 one can safely assume that every modern computer has it by now). Also, a bunch of other functions aren't included at all (get the absolute value of every number for example, which will also need a clumsy workaround).
我的问题是,是否有任何其他库,我可以从我的C#代码中调用尽量使用SSE / SIMD的?它也可以用在C#中的内联汇编,所以显然我也可以用C ++ - 代码,即使这会导致一个小的性能损失,但如果有人将不得不与所述功能相对容易使用的C ++库,这将是可以接受的我猜。
My question is, are there any other libraries I can call from within my C# code to make use of SSE/SIMD? It's also possible to use inline assembly in C#, so apparently I can also use C++-code, even though this causes a small performance hit, but if anyone would have a relatively easy-to-use C++ library with said functions this would be acceptable I guess.
在事先的任何帮助感谢。
Thanks in advance for any help.
推荐答案
开源(其中我的作者)提供了SIMD优化的数据处理功能,并经由官方绑定网络语言使用。它不仅支持SSE,而且后来SIMD扩展到来自英特尔即将推出的Haswell处理器AVX2。该库会自动选择其上运行的处理器的最佳版本。
Open-source Yeppp! library (of which I am the author) provides SIMD-optimized data processing functions, and is usable from .Net languages via official bindings. It supports not only SSE, but also later SIMD extensions up to AVX2 from the upcoming Intel Haswell processors. The library automatically chooses the optimal version for the processor it runs on.
这篇关于在C#中使用SSE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!