dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.64k stars 4.57k forks source link

JIT: Relax throughput impacting JIT parameters for crossgen #13621

Open 4creators opened 4 years ago

4creators commented 4 years ago

JIT has several fixed parameters that were chosen to balance the quality of code produced and compilation time. Crossgen used for preparing deployments of R2R assemblies does not have the same limitations as compilation time is decoupled from execution time. This creates an opportunity to tune some JIT parameters in order to create better code quality with Crossgen.

One of the parameters which jump to mind is the number of allowed local variables during compilation. Increasing it from currently set 512 to 1024 or even 2048 will have a significant impact on Crossgen throughput but would increase the performance of the generated code for functions which are large or with multiple inlined functions. See issue dotnet/runtime#13423 for discussion of the impact of this parameter preset.

category:cq theme:ngen skill-level:beginner cost:medium

4creators commented 4 years ago

cc @jkotas @MichalStrehovsky @AndyAyersMS @mikedn @CarolEidt

jashook commented 4 years ago

/cc @BruceForstall @dotnet/jit-contrib

jashook commented 4 years ago

I think I will assign this to myself for now. I do not know exactly when I can get to it; however, I believe this is worth investing in as customers more heavily use crossgen solutions.

@4creators thank you for the issue.

mikedn commented 4 years ago

FWIW I have some experimental code from back when I improved lclvar sorting that makes the number of tracked lclvars configurable: https://github.com/mikedn/coreclr/commit/f962c0fbf8307f376637d5f4f5a898964b0b3427

Trivial stuff in case someone wants to try it on some code and see what the throughput and CQ impact might be.

Last time I looked there weren't many methods in FX that needed more than 500-600 variables so I have no idea what the impact may be if the limit is raised to, say, 2048.