View Single Post
Old 1st March 2017, 02:00   #43  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,901
Mono? What for? Let's start from the very begging, 'cause maybe I didn't get this right. (I mean, maybe I didn't understand what you are trying to do/achieve). If you write and compile filters using C and C++ you have access to SIMD, but the problem is that you need to know at compile time which instructions are available on your target machine. You need to be certain that the instructions in your binary are available on the target processor, but this is where a managed language’s JIT compiler is well placed. C# (thanks to the .NET Framework) code is compiled to an intermediate language called "Common Intermediate Language" (CIL, aka Microsoft Intermediate Language, MSIL), which is deployed to the target machine. When a program written in C# is loaded, the local .NET JIT compiler compiles the CIL to native code. The advantage is that the JIT compiler knows exactly what type of CPU the target machine has and so it can make full use of all instruction sets available to it. Besides, the application’s performance will improve in the future without ever being rebuilt and re-deployed. When future processors with larger SIMD registers become available JIT will be able to make full use them. The simplest and recommended way to use SIMD is via the classes and static methods in the System.Numerics namespace and you need at least version 4.1.0.0 of the System.Numerics and System.Numerics.Vectors assemblies. Anyway, let's stop talking about programs now. In this topic we are talking about avisynth filters that are going to run via a sort of "compatibility layer" which will make C# codes available in C++, like a "wrapper" - as you said before - which is the AVS filternet, so performance-wise it will be slower than native C++ filters, no matter what. So, the question is: what are you trying to do/achieve with SIMD? (I mean, this is not a critic at all, I'm just trying to understand, 'cause I love C#).

Last edited by FranceBB; 1st March 2017 at 02:08.
FranceBB is offline   Reply With Quote