Kamujin's picture


Miguel has just posted some comments about Mono.SIMD support.


The basic idea is that the mono JIT engine optimizes well known classes to benefit from otherwise un-utilized processor features, such as the SSE's.

Miguel had suggested that OpenTK might consider deriving its Vector classes from the Mono.SIMD versions to gain the benefit of these performance enhancing optimizations and I agreed to advocate the idea to you.

Unfortunately, these optimizations only work with the mono JIT engine, so the code would run at current speeds under a MS.NET runtime.

What do you guys think?

I think its worth looking at as long as it doesn't introduce platform specific dependencies or speed degradation to non-optimized cases.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Thanks for the pointers, your help is appreciated.

The problem with the getters/setters is that they cannot be used as ref parameters. Many OpenGL functions have the following unmanaged form:

void glNormal3f(float *data);

which can be invoked from .Net as:

Vector3 v = new Vector3(...);
GL.Normal3(ref v.X);

This is a trivial example, but it demonstrates the issue.

Edit: We actually based our structures on the suggestions of Rico Mariani about value-based programming. There was an extensive debate regarding the use of setters/getters, but we finally decided to do without, because:

  1. They could not be used in the aforementioned cases.
  2. They would never be expanded to contain actual code (just a simple assignment).
JTalton's picture

I'm really interested in how this is going. Any update or links to external discussions would be appreciated!

the Fiddler's picture

There are several discussions on the Mono forums (check under mono-dev). Which reminds me, I should forward the last post on properties vs fields, lest it gets buried.

jdomnitz's picture

What ever happened with this?

the Fiddler's picture

Not cross-platform.

SlimMath looks promising, however.

jdomnitz's picture

Doesn't it have managed fallbacks so it can be used cross platform?

the Fiddler's picture

Yes, but performance suffers as a result and it doesn't make sense to penalize 90% of the user base.

SlimMath is supposed to have a method that can inject SSE for a similar performance boost. Not released yet but I am keeping an eye on it.

jdomnitz's picture

Oh I didn't realize that part...yea SlimMath looks promising