0

I currently working on a project which switched from MathNet.Numerics library to the System.Numerics.Vectors library. I want to make use of the SIMD hardware support.

The target framework of the application is .NET 4.6.1 so RyuJIT should be the default JIT compiler. UseRyuJIT is set to 1 in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework.

But the System.Numerics.Vector.IsHardwareAccelerated property still returns false.

The application runs in Release mode, Prefer 32-Bit is unchecked, Platform target is AnyCPU (though I also tried x64), enable native code debugging is checked and when i run it from Visual Studio and watch the Debug -> Windows -> Modules window I can see the clrjit.dll in the list. No protojit.dll (I think this was the CTP versions name) or compatjit.dll is active.

Furthermore there is no useLegacyJit enabled="1" set in the app config, no COMPLUS_useLegacyJit environment variable or a useLegacyJit flag in the regedit.

System information:

Windows 7 Professional

Visual Studio Professional 2013

System.Numerics.Vectors v4.1.2.0

Intel Core i7 3740QM

boFFeL
  • 31
  • 5
  • The NuGet Manager also states 4.3.0 as version. But the property sheet says 4.1.2.0 when i click on the reference in the Solution Explorer. SP1 is installed. – boFFeL Feb 22 '17 at 10:47
  • http://stackoverflow.com/a/34898181/17034 – Hans Passant Feb 22 '17 at 11:14
  • I also own Visual Studio 2015. When I set up the same demo application there, IsHardwareAccelerated is true. So the AVX2 support does not seem to relate to the problem. Unfortunately it is not possible to move the whole application to 2015. – boFFeL Feb 22 '17 at 12:12
  • Ok. Because I don't have AVX2 support the Register size for SIMD instructions is still 128 bit. But if I start the exe from outside of Visual Studio the IsHardwareAccelerated becomes true and test application performance improves. Thanks for your ideas anyway – boFFeL Feb 22 '17 at 13:10

1 Answers1

1

When you launch applications from Visual Studio the default setting, even for release builds, will disable jit optimizations, and that also disables SIMD code generation.

You can change this within VS, by navigating to Tools | Options | Debugging | General and unchecking "Suppress JIT optimization on module load (Managed Only)".

VS Debugger Options Dialog

Andy Ayers
  • 892
  • 6
  • 13