Sign in to follow this  
ShawMishrak

[.net] .NET CLR 2.0 Optimizations

Recommended Posts

Does version 2.0 of the .net clr, specifically with c#, support vector-based optimizations in the produced jit'ed code? For instance, can it use SSE support in Intel/AMD processors to optimize floating point vector/matrix operations? Or do you need to drop into c++ and use SSE intrinsics to get this? I'm really curious about this and I haven't been able to find much information on it. Thanks

Share this post


Link to post
Share on other sites
As far as I know, JIT compiler doesn't make any use of the SSE extensions. I can't find any info searching either.

It would be cool if this did happen though - maybe through some attribute to hint to the compiler around certain vector operations, then if the program was running on a CLR under e.g. PowerPC/Altivec or Intel/SSE then it would make use of the extra processor oomph, and it would automatically run faster on the future SSE versions.

I've no idea whether this is planned for the future - anyone got any info?

Share this post


Link to post
Share on other sites
Apparantly it does....

Performance Considerations for Run-Time Technologies in the .NET Framework
"Processor-Specific Optimizations— At run time, the JIT knows whether or not it can make use of SSE or 3DNow instructions. Your executable will be compiled specially for P4, Athlon or any future processor families. You deploy once, and the same code will improve along with the JIT and the user's machine. "

And that article dates from .Net 1.0.

Share this post


Link to post
Share on other sites
I'm guessing that it would be able to optimise certain operations in the CLR to make use of SSE, but it doesn't really give much info - does it optimise non-internal CLR code?

There's a good article on gamedev about how to write code for parallelising:
http://www.gamedev.net/reference/programming/features/vectorc/

If you do this, would the CLR then be able to optimise the code to run on SSE? It would be good to get some Microsoft feedback on this.

Share this post


Link to post
Share on other sites
I'm really interested in what it can currently do, and what the future plans are for this, especially with a version of the CLR coming to the XBox 360.

It seems like there is information explaining how its "possible" to do it, but nothing really saying it does or does not.

With .NET 2.0, I have yet to see it use SSE instructions on obviously vectorizable floating-point code (at least according to Visual Studio 2005's disassembly window in Release build mode with optimizations enabled).

Share this post


Link to post
Share on other sites
If you want a response from Microsoft you should probably go and ask in the MSDN forums. There's not many (any?) MS folk in here AFAIK.

Share this post


Link to post
Share on other sites
I can imagine it using "scalar" sse instructions. I find it hard to believe that it can currently vectorize very well (if at all)

Share this post


Link to post
Share on other sites
[edit - my post was dupe, looks like one of you beast me to it! Relinked to original question]

I posted in the MSDN forums. Maybe we will get an official answer.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=425041

At the end of the day the only real limiting factor in the JIT compiler vs a regular compiler is the amount of time it can take to do optimisations since it has to operate in near realtime.

[Edited by - thezbuffer on May 30, 2006 1:19:34 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this