Skip to content

NativeAOT build support and doc improvements #68038

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

Merged
merged 1 commit into from
Apr 15, 2022
Merged

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Apr 14, 2022

  • Add IlcInstructionSet property that can be used to set the target instruction set from the command line.
  • Moved link to the documentation of reflection-free mode to be in less prime location, so that people trying NativeAOT for the first time are not steared towards it.
  • Copied help text improvements from crossgen2

- Add IlcInstructionSet property that can be used to set the target instruction set from the command line.
- Moved link to the documentation of reflection-free mode to be in less prime location, so that people trying NativeAOT for the first time are not steared towards it.
- Copied help text improvements from crossgen2
@ghost ghost assigned jkotas Apr 14, 2022
@jkotas jkotas requested review from adamsitnik and agocke April 14, 2022 18:27
@EgorBo
Copy link
Member

EgorBo commented Apr 14, 2022

It'd be nice to be able to do --instruction-set:host or --instruction-set:native similar to -mcpu=native in C++
I noticed several times cases where developers specified e.g. --instruction-set:avx2 but forgot about various useful BMI1-2, LZCNT instructions which aren't implied by avx2 (without BMI/LZCNT all BitOperations APIs use slow fallbacks)

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't exposed the instruction set argument because I think we might need to preserve some extra registers in transitions for AVX that we currently don't. I don't have much experience in that area so I'll leave that up to you. Thanks!

@jkotas
Copy link
Member Author

jkotas commented Apr 15, 2022

I think we might need to preserve some extra registers in transitions for AVX that we currently don't.

We will need to deal with AVX registers for #67805. We are fine as of today.

@jkotas
Copy link
Member Author

jkotas commented Apr 15, 2022

It'd be nice to be able to do --instruction-set:host or --instruction-set:native

I will take a look at doing that in follow-up PR.

@jkotas jkotas merged commit 0b1a80d into dotnet:main Apr 15, 2022
@@ -6,7 +6,7 @@ Reflection-free mode is a mode of the NativeAOT compiler and runtime that greatl
* Reduced working set and better code locality - parts of the program are more tightly packed together.
* Less metadata for people to reverese engineer - apps compiled in reflection-free mode are as hard to reverse engineer as apps written in e.g. C++.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo..reverse


## Experimental Reflection Free Mode

Reflection-free mode is a an experimental mode of the NativeAOT compiler and runtime that greatly reduces the functionality of the reflection APIs and demonstrates how far can reflection trimming can get. See [Reflection Free Mode](reflection-free-mode.md) for mode details.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"How far reflection can"

@jkotas jkotas deleted the nativeaot-docs branch April 15, 2022 23:18

## Options related to code generation
* `<IlcOptimizationPreference>Speed</IlcOptimizationPreference>`: when generating optimized code, favor code execution speed.
* `<IlcOptimizationPreference>Size</IlcOptimizationPreference>`: when generating optimized code, favor smaller code size.
* `<IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>`: folds method bodies with identical bytes (method body deduplication). This makes your app smaller, but the stack traces might sometimes look nonsensical (unexpected methods might show up in the stack trace because the expected method had the same bytes as the unexpected method). Note: the current implementation of deduplication doesn't attempt to make the folding unobservable to managed code: delegates pointing to two logically different methods that ended up being folded together will compare equal.
* `<IlcInstructionSet>`: By default, the compiler targets the minimum instruction set supported by the target OS and architecture. This option allows targeting newer instruction sets for better performance. The native binary will require the instruction sets to be supported by the hardware in order to run. For example, `<IlcInstructionSet>avx2,bmi2,fma,pclmul,popcnt,aes</IlcInstructionSet>` will produce binary that takes advantage of instruction sets that are typically present on current Intel and AMD processors. Run `ilc.exe --help` for the full list of available instruction sets.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please excuse me if this is a dumb question, but where can I find ilc.exe?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this help? #68117

@ghost ghost locked as resolved and limited conversation to collaborators May 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants