Bug 55577

Summary: SIMD instructions with System.Numerics.Vectors do not work
Product: [Mono] Runtime Reporter: jvsbl
Component: JITAssignee: Zoltan Varga <vargaz>
Severity: normal CC: alkpli, mono-bugs+mono, mono-bugs+runtime
Priority: ---    
Version: unspecified   
Target Milestone: 15.3   
Hardware: PC   
OS: Linux   
Tags: Is this bug a regression?: ---
Last known good build:
Attachments: Console App which prints Information about SIMD acceleration

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.