[Mono-dev] Incoming changes to Mono.Simd

Rodrigo Kumpera kumpera at gmail.com
Thu Dec 4 06:17:12 EST 2008


2008/12/4 StApostol <stapostol at gmail.com>

> On Thu, Dec 4, 2008 at 3:37 AM, Jonathan Pryor <jonpryor at vt.edu> wrote:
>
>> On Thu, 2008-12-04 at 02:26 +0200, StApostol wrote:
>> > Extension methods are great for simplifying the API, but Mono.Simd
>> > should still be usable by C# 2.0 programs.
>>
>> Silly question, but why?  Since Mono.Simd will only be accelerated under
>> Mono, and Mono supports C# 3, I don't see much use for the restriction.
>>
>> Furthermore, even if you did want to use Mono.Simd under .NET, and you
>> wanted to use VS.NET 2005 (.NET 2.0), that's still no reason to avoid
>> using extension methods -- you just need to bundle Mono's
>> System.Core.dll with your app (which will allow .NET to resolve the
>> ExtensionAttribute type), and invoke the extension method as a static
>> method (extension methods can still be called as static methods, they
>> don't need to be called as instance methods).
>>
>> So I really don't see the point in avoiding extension methods.
>>
>>  - Jon
>>
>>
>> Our library is designed to support VS2005+ and Mono 1.2.6+ with a single
> dll. While the System.Core.dll approach works, it's unsupported and not
> really suitable for production.
>
> That said, I can certainly see your point and I agree that Mono.Simd should
> use the capabilities of the current Mono release (C# 3 in this case).
>
> One last question: if one builds a custom version of Mono.Simd (or even
> integrates it in another assembly), will the runtime still be able to
> resolve and accelerate the operations?
>


The runtime identifies simd intrinsics by their name and assembly and so
does for their methods. This means if you want, for example, to use the mono
linker to put everything in a single assembly you'll need to customize the
runtime itself, a trivial change, but still.

if we move to use extension methods the solution to use Mono.Simd under C#
2.0 is to directly call the class with those methods.
For example:

Vector4ui a,b,c;
c = a.AddWithSaturation (b); //with extension methods.
c = VectorOperations.AddWithSaturation (a, b);//will work just fine under C#
2.0

AFAIK, the only real issue with extension methods is that Mono.Simd will
require C# 3.0 to be compiled, but one can still fully consume it under C#
2.0 as a missing System.Core won't be an issue.

Cheers,
Rodrigo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20081204/a49e7502/attachment.html 


More information about the Mono-devel-list mailing list