[Mono-dev] Mono.Simd: Accelerated methods analysis

Rodrigo Kumpera kumpera at gmail.com
Wed Dec 10 07:40:39 EST 2008


Oh,

BTW, there are 2 issues with your program.

The following code is wrong "mi.GetParameters() [i].GetType()", it should be
"mi.GetParameters() [i].ParameterType" otherwise you'll be querying for
ParameterInfo class instead of what you want.

The other one is minor, in that some functions might not report as
accelerated because you're running it on an old machine without support.

Cheers,
Rodrigo


On Wed, Dec 10, 2008 at 10:21 AM, Rodrigo Kumpera <kumpera at gmail.com> wrote:

> Hi Bart,
>
> Right now the only methods that are not accelerated are indexers, if any
> method is missing from this list, it's a bug.
>
> Cheers,
> Rodrigo
>
>
>
>
> On Sat, Dec 6, 2008 at 11:53 PM, Bart Masschelein <masschel at gmail.com>wrote:
>
>> Hi all,
>>
>> I've written aprogram that uses reflection to give a list of relevant
>> methods in the Mono.Simd, and reports whether they are accelerated or
>> not (see below). This small program might be of interest to others, to
>> see how well their processor behave.
>>
>> There are methods that have overloaded, for which I should give the
>> signature, but I'm a bit lost in how this signature should look like.
>> I tried to convert the ParameterInfo[] of the methods to Type[], as
>> required by the IsMethodAccelerated method, but this gives erroneous
>> results. Is it only the parameters list, or is there more to it?
>>
>> I thought of removing the overloaded methods (see list), but I guess I
>> might risk to remove relevant methods as well. The overloaded methods
>> are mainly op_Explicit, LoadAligned, StoreAligned, and the PrefetchXxx
>> methods. Are these relevant to show up in such a list?
>>
>> Anyway, I'm quite thrilled to see that almost all of the methods are
>> accelerated :-).
>>
>> Bart
>>
>> using System;
>> using Mono.Simd;
>> using System.Reflection;
>>
>> namespace AcceleratedMethods
>> {
>>     class MainClass
>>     {
>>         public static void Main(string[] args)
>>         {
>>             // Change to your location of Mono.Simd
>>             string monoSimdLocation = @"/Users/masschel/local/mono/
>> lib/mono/2.0/Mono.Simd.dll";
>>             Assembly assembly = Assembly.LoadFile(monoSimdLocation);
>>             foreach(Type type in assembly.GetTypes())
>>             {
>>                 string typeName = type.Name;
>>                 if (typeName.Length>=6 && typeName.Substring(0,6) ==
>> "Vector")
>>                 {
>>                     Console.WriteLine("Type {0}", type.Name);
>>                     foreach(MethodInfo mi in type.GetMethods())
>>                     {
>>                         string methodName = mi.Name;
>>                         bool ctu = methodName != "Equals"
>>                                 && methodName != "GetHashCode"
>>                                 && methodName != "ToString"
>>                                 && methodName != "GetType"
>>                                 && (methodName.Length>=4
>>                                     && methodName.Substring(0, 4) !=
>> "get_"
>>                                     && methodName.Substring(0, 4) !=
>> "set_");
>>                         if (ctu)
>>                         {
>>                             try
>>                             {
>>                                 Console.WriteLine("   Method {0}
>> {1}", mi.Name, SimdRuntime.IsMethodAccelerated(type, mi.Name));
>>                             }
>>                             // Overloaded methods
>>                             catch
>> (System.Reflection.AmbiguousMatchException amme)
>>                             {
>>                                 Type[] types = new
>> Type[mi.GetParameters().Length];
>>                                 for(int i = 0; i <
>> mi.GetParameters().Length; i++)
>>                                 {
>>                                     types[i] = mi.GetParameters()
>> [i].GetType();
>>                                 }
>>                                 Console.WriteLine("
>> AmbiguousMatchException for method {0} {1}", mi.Name,
>> SimdRuntime.IsMethodAccelerated(type, mi.Name, types));
>>                             }
>>                         }
>>                     }
>>                 }
>>             }
>>         }
>>     }
>> }
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20081210/35f47cd8/attachment.html 


More information about the Mono-devel-list mailing list