I have done some performance tests of SIMD under windows. Results tests in ms: In MS C 235 (Visual Studio Release Mode With SIMD) In MS C 360 (Visual Studio Release Mode With 4D Float) In Mono C# 453 (With Mono SIMD) In Mono C# 562 (With Mono 4D Float) In MS C# 609 (Visual Studio With 4D Float) In MS C 672 (Visual Studio Debug Mode)
I'm just surprise by difference between C SIMD and mono SIMD version. Is Mono.SIMD under linux speeder than under windows ? Johann. My mono code for test: using Mono.Simd; using System; using Mono; public struct Color { public float r,g,b,a; }; public class TestMonoSIMD { public Color m_pixels; const int w = 4096; const int h = 4096; public static void Main () { //Debug Console.WriteLine("AccelMode: {0}", Mono.Simd.SimdRuntime.AccelMode ); //Without SIMD DateTime start1 = DateTime.Now; Color ret1 = Gradient(); TimeSpan ts1 = DateTime.Now - start1; Console.WriteLine("-FLOAT {0} {1}", ts1, ret1); //With SIMD DateTime start2 = DateTime.Now; Vector4f ret2 = GradientSIMD(); TimeSpan ts2 = DateTime.Now - start2; Console.WriteLine("-SIMD {0} {1}", ts2, ret2); } public static Color Gradient() { float finv_WH = 1.0f / (float)(w*h); Color ret = new Color(); ret.r=ret.g=ret.b=ret.a=0.0f; Color a = new Color(); Color b = new Color(); Color c = new Color(); Color d = new Color(); a.r=0.0f; a.g=0.0f; a.b=1.0f; a.a=1.0f; b.r=0.0f; b.g=1.0f; b.b=0.0f; b.a=1.0f; c.r=1.0f; c.g=0.0f; c.b=0.0f; c.a=1.0f; d.r=0.5f; d.g=0.5f; d.b=1.0f; d.a=1.0f; //Process operator for (int y=0; y<h; y++) { for (int x=0; x<w; x++) { //Calc percent A,B,C,D float pa = (float)((w-x) * (h-y)) * finv_WH; float pb = (float)((x) * (h-y)) * finv_WH; float pc = (float)((w-x) * (y)) * finv_WH; float pd = (float)((x) * (y)) * finv_WH; float cr= ((a.r*pa) + (b.r*pb) + (c.r*pc) + (d.r*pd)); float cg= ((a.g*pa) + (b.g*pb) + (c.g*pc) + (d.g*pd)); float cb= ((a.b*pa) + (b.b*pb) + (c.b*pc) + (d.b*pd)); float ca= ((a.a*pa) + (b.a*pb) + (c.a*pc) + (d.a*pd)); ret.r+=cr; ret.g+=cg; ret.b+=cb; ret.a+=ca; } } return ret; } public static Vector4f GradientSIMD() { float finv_WH = 1.0f / (float)(w*h); Vector4f ret = new Vector4f(0.0f, 0.0f, 0.0f, 0.0f); Vector4f a = new Vector4f(0.0f, 0.0f, 1.0f, 1.0f); Vector4f b = new Vector4f(0.0f, 1.0f, 0.0f, 1.0f); Vector4f c = new Vector4f(1.0f, 0.0f, 0.0f, 1.0f); Vector4f d = new Vector4f(0.5f, 0.5f, 1.0f, 1.0f); //Process operator Vector4f p = new Vector4f(); Vector4f r = new Vector4f(); for (int y=0; y<h; y++) { for (int x=0; x<w; x++) { //Calc percent A,B,C,D p.X = (float)((w-x) * (h-y)) * finv_WH; p.Y = (float)((x) * (h-y)) * finv_WH; p.Z = (float)((w-x) * (y)) * finv_WH; p.W = (float)((x) * (y)) * finv_WH; ret+=a*p + b*p + c*p + d*p; } } return ret; } } -- View this message in context: http://www.nabble.com/Mono.SIMD-tp22116483p22116483.html Sent from the Mono - Dev mailing list archive at Nabble.com. _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list