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
Keep structs in registers #43867
Comments
some additional test casts that I am planning to improve in this issue for 6.0:
currently generates:
with a small struct enreg we are going to get:
it is a wider case of #8016.
|
Link #48377 |
April update: Also, I got estimates of the expected perf results using a local branch with fixed morph (improvements are in addition to what already have been merged):
Also, I have checked that the next changes will close at least #7200, #4323, #51472 A few general improvements required for the struct enreg work were merged: and fixes: and cleanups: |
With #55558 and #55727 we finished struct optimizations in 6.0 scope and soon I will open new work items for 7.0. There were also many fixes for struct, especially with passing float in int regs or in SIMD types.Some examples: The additional checks and cleanups should help us against silent bad codegen cases that we saw in the past releases.It is hard to gather performance wins for 7.0 changes because there were many of them, but if we just some asm diffs from the main PR we will get something like: PRshttps://github.com//pull/55558 https://github.com//pull/55045 https://github.com//pull/55727 https://github.com//pull/52292 https://github.com//pull/49879 https://github.com//pull/48377 https://github.com//pull/45824x64 windows pmi libraries: arm64 linux pmi libraries: |
Nice work @sandreenko ! |
To you both 😄 |
Epic for improving the ability of the JIT to keep structs in registers.
Overview
The JIT currently supports keeping structs in registers when the individual fields are promoted to local variables (also known as scalar replacement). However, there are a number of cases where it forces them to the stack. Some of these cases are more fundamental, e.g. when they are address exposed. Others, however, are due to JIT limitations in handling argument passing and returns.
The Jit does not support keeping small structs in registers when the fields are not promoted and not accessed, for example, when the struct is only used as an argument or block.
.NET 6 scope:
Work items for multi-reg
Work items for single-reg
LCL_FLD
instead ofIND(ADDR(LCL_VAR))
to avoid marking LCL_VAR as address-taken (struct improvement, part1: create more LCL_FLD #48377);STRESS_PROMOTE_LESS_STRUCTS
#49189);Stretch goals for 6.0:
Stretch goal for multi-reg:
Stretch goal for single-reg:
OBJ(ADDR(LCL_VAR))
when pass as args etc..NET 6 Result:
We have a set of repro-tests that show incorrect/inefficient code generation in 5.0 that is expected to be fixed. It is covered by issues in the previous section.
The perf results are shown in the bottom messages.
category:planning
theme:planning
skill-level:expert
cost:large
impact:medium
The text was updated successfully, but these errors were encountered: