Using SSE in c# is it possible?

后端 未结 10 1949
借酒劲吻你
借酒劲吻你 2020-11-29 11:02

I was reading a question about c# code optimization and one solution was to use c++ with SSE. Is it possible to do SSE directly from a c# program?

10条回答
  •  借酒劲吻你
    2020-11-29 11:45

    If you have a 'chunk' of work you want to do, the best bet is to write it in C++ using the MMX/SSE intrinsics and then make a very simple /clr managed C++ class that wraps your functionality and exposes it out as a .net class. Then your code can just use that assembly as if it were a normal class.

    For more about the VC intrinsics you can look at this little ditty I wrote many years ago.

    http://msdn.microsoft.com/en-us/library/0aws1s9k.aspx

    Oh - I'm assuming you are actually wanting to use the parallel functions to speed something up. As others have pointed out - if you just want to move data in larger chunks and the like, the JIT already knows how to use SSE for those basics.

提交回复
热议问题