Bug 55577 - SIMD instructions with System.Numerics.Vectors do not work
Summary: SIMD instructions with System.Numerics.Vectors do not work
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: 15.3
Assignee: Zoltan Varga
Depends on:
Reported: 2017-04-25 17:35 UTC by jvsbl
Modified: 2018-01-24 15:43 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Console App which prints Information about SIMD acceleration (632.68 KB, application/zip)
2017-04-25 17:35 UTC, jvsbl

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description jvsbl 2017-04-25 17:35:05 UTC
Created attachment 21772 [details]
Console App which prints Information about SIMD acceleration

Version: Mono JIT compiler version 5.3.0 (Nightly Mon Apr 10 09:48:18 UTC 2017)


simple LOC:

delivers false on my Machine Linux Mint 17.3 64 Bit(delivers true on Windows though)
It does not matter if its compiled with Mono or .Net(on Windows) - Mono/.Net works on Windows, but both do not work on Linux - so it should be the JIT imho.

Tried using the Library further as well it was way slower on Linux with the Library than without, but considerably faster on Windows(so SIMD itself is definitely working)

TargetFramework: v4.6.2(tried older Versions as well)
PlatformTarget: x64(tried AnyCPU as well)

Of course I used the Release build and tried to run it with "mono ConsoleApp.exe" as well.

I hope I've done nothing wrong on the way, but Nightly should be the master Branch(right?)

Attached below the simple Console App I used to test it.

Thanks for any help you can provide
Comment 1 Alexander Köplinger [MSFT] 2017-04-25 18:52:17 UTC
Zoltan: it seems the SIMD intrinsic for IsHardwareAccelerated was only added to System.Numerics.dll, but we need it in System.Numerics.Vectors.dll as well.

The following patch fixes it for me: https://gist.github.com/akoeplinger/f59dbcd1388a7a7e76c29379e02509bf.

Note: the check for Vector`1 in System.Numerics.dll is not needed, the type doesn't exist there so I removed it.
Comment 2 Zoltan Varga 2017-04-25 19:13:35 UTC
Looks ok.
Comment 3 jvsbl 2017-04-25 22:00:28 UTC
wouldn't "Vector`1" be for a Generic class without the generic parameters given?

Comment 4 Alexander Köplinger [MSFT] 2017-04-25 23:22:40 UTC
Yes, the point is this type lives in System.Numerics.Vectors.dll not System.Numerics.dll.
Comment 5 Zoltan Varga 2017-04-27 08:49:05 UTC
Comment 6 Alexander Köplinger [MSFT] 2017-04-27 12:26:27 UTC
Merged to master and 2017-04, thanks.

Zoltan: do you think we should put it in 2017-02 as well given that we mention the .NET SIMD classes in http://www.mono-project.com/docs/about-mono/releases/5.0.0/#simd-acceleration-support
Comment 7 Zoltan Varga 2017-04-27 19:21:29 UTC
No, simd is disabled in 2017-02, since there were too many bugs.