I suggest you ...

C# and SIMD

It would be great if C# compiler and .Net JIT compiler could utilize SIMD instructions of current and future processors. The projects that require heavy calculations (MathDotNet.Numerics for example) would greatly benefit from this feature.

2,114 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Georgii Kalnytskyi shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    49 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • War commented  ·   ·  Flag as inappropriate

        The CLR team has a problem. They consider assembly load time above all else. This means they are averse to adding complex optimization to the JITer. They need to realize that most .Net code today runs on servers where assembly load time is not a factor.

        I'm hoping that since the C/C++ compiler in VS11 is adding native optimization for
        SIMD (see http://community.csevn.com/showthread.php?tid=39&pid=43) I'm hoping that the new JITer will inherit some of that work.

      • Anonymous commented  ·   ·  Flag as inappropriate

        JIT compiler really needs to step up and generate optimal code and give developers choice of target modern optimizations. It is way behind VC++.

      • codekaizen commented  ·   ·  Flag as inappropriate

        I agree - it doesn't require IL changes at all... in fact, that is kind of the point of IL. It just requires a better JITter. I remember doing some tests with the JVM and the CLR side by side on some tight computation tests, and was surprised that the JVM won hands down. After decompiling the resulting jitted code for each, it was clear why: the JVM was vectorizing the computation quite well, where as the CLR didn't even do any. This was back in 2007, on the v2.0 CLR. I'm surprised that the v4.0 _still_ doesn't have this capability.

      • peter gideon commented  ·   ·  Flag as inappropriate

        This does NOT require IL changes.JVMs support excellent FP optimizations. .net is lagging far behind in numeric perf and its getting worse and worse with each new processor generation. Vectorizing compilation is known tech, what's wrong with Microsoft that they can't implement it?

      • peter gideon commented  ·   ·  Flag as inappropriate

        This does NOT require IL changes.JVMs support excellent FP optimizations. .net is lagging far behind in numeric perf and its getting worse and worse with each new processor generation. Vectorizing compilation is known tech, what's wrong with Microsoft that they can't implement it?

      • Sirisian commented  ·   ·  Flag as inappropriate

        What you're suggesting really requires heavy changes in the IL. Ideally including all native instructions found in processors. Then you need to open that up as language features via intrinsics or writing IL inline. This opens up the huge development challenge of "so we've allowed a compiler to output IL for any known processor. Now when we JIT it to native code any of those native processor features require an alternative compilation where they aren't supported. This could mean using lesser SSE features or just converting to a platform independent IL for simplicity.

        I've contemplated such a scheme and it's a lot of work to allow that level of optimization. It would be amazing if MS went that route, but it would probably take a lot of development cost to stay up to date.

        If all you want to support is the most basic SIMD operations then this could work, but ideally that would be selling the idea short when it could allow full optimization on par with any native code.

      • Don Syme commented  ·   ·  Flag as inappropriate

        Note, this is really a suggestion for the .NET CLR team. Personally I consider it very important, so please move it there to make sure it gets the correct visibility

      • Chris commented  ·   ·  Flag as inappropriate

        Yes - it would be great if the .net JIT compiler would optimize in-depth optimized for CPUs. IMHO: As a first step, we would be off to a good start if SSE4 and AVX would be detected and utilized for optimizations.

      1 3 Next →

      Feedback and Knowledge Base