Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NativeAOT benchmark started from .Net Framework host doesn't have all intrinsics enabled #2060

Closed
MichalPetryka opened this issue Aug 1, 2022 · 6 comments · Fixed by #2464
Assignees
Milestone

Comments

@MichalPetryka
Copy link
Contributor

BDN 0.13.1.1835 from nightlies is supposed to run NativeAOT with current machines CPU features, yet with a .Net Framework host on an AVX2 machine I got:

// Runtime=.NET 7.0.0-rc.1.22401.2, X64 NativeAOT SSE4.2
// GC=Concurrent Workstation
// HardwareIntrinsics=SSE4.2,AES,LZCNT,PCLMUL,POPCNT VectorSize=128

which was due to the fact the host can't check for their support on Net Framework (I don't understand why it's SSE4.2, not SSE2 though, does NativeAOT default to that? if yes then that's a bit weird).
A possible solution would be to generate a separate .Net app that'd perform the CPU checks and return the data to the Net Framework host.

@adamsitnik
Copy link
Member

A possible solution would be to generate a separate .Net app that'd perform the CPU checks and return the data to the Net Framework host.

To be honest I am not sure if we want to invest in such edge case scenario if there is an easy workaround (running host as .NET Core app). But I understand that it can lead to confusion (not apples to apples comparison depending on host process runtime).

@jkotas is there a way to tell ILC to use all available instructions? Sth like <IlcInstructionSet>current</IlcInstructionSet>?

@jkotas
Copy link
Member

jkotas commented Aug 2, 2022

We do not have that today. It would require duplicating the runtime hardware capabilities detection in the AOT compiler, or somehow getting access to the runtime detection logic,

The AOT compiler cannot use the trick with calling IsSupported properties like what Benchmark.NET does. We want to be able to compile the AOT compiler using itself. It means that the IsSupported properties return what the compiler was AOT compiled with, not the current capabilities of the machine.

@jkotas
Copy link
Member

jkotas commented Aug 2, 2022

I have opened dotnet/runtime#73246 to have this tracked. It is not the first time that this option is being discussed.

@MichalPetryka
Copy link
Contributor Author

running host as .NET Core app

AFAIK you have to use a Net Framework host in order to use it in a benchmark, so doing benchmarks with 2 hosts is at least annoying.

@adamsitnik
Copy link
Member

AFAIK you have to use a Net Framework host in order to use it in a benchmark, so doing benchmarks with 2 hosts is at least annoying

You don't: https://benchmarkdotnet.org/articles/configs/toolchains.html#multiple-frameworks-support

@adamsitnik adamsitnik added this to the v0.13.x milestone Oct 5, 2022
@MichalStrehovsky
Copy link
Member

Support for instructionset:native merged in dotnet/runtime#87865 and unless it gets reverted, will be available in .NET 8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants