Uh oh!
There was an error while loading. Please reload this page.
JIT: Handle some "field offset computation" patterns - #81998
Conversation
Both during import and during VN. Just want to see TP impact, not sure if this is worth it.
ghost
commented
Feb 11, 2023
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch, @kunalspathak Issue DetailsBoth during import and during VN. Just want to see TP impact, not sure if this is worth it.
|
MichalStrehovsky
commented
Feb 13, 2023
Would this help in situation like #9791? NativeAOT generates similar code in support of ValueType.Equals/GetHashCode. The code RyuJIT currently generates for it is not particularly compact: |
jakobbotsch
commented
Feb 13, 2023
Yes, this should handle those kinds of patterns. |
ghost
commented
Mar 15, 2023
Draft Pull Request was automatically closed for 30 days of inactivity. Please let us know if you'd like to reopen it. |
jakobbotsch
commented
Mar 29, 2023
Reopening this given the additional motivation of #84095 |
| // TODO-Correctness: Due to inlining we may end up with incorrectly typed SUB trees here. | ||
| assert(node->TypeIs(TYP_I_IMPL, TYP_BYREF)); |
Diffs. This is primarily for NAOT so doesn't really reflect in the diffs. BasicMinimalApi has 1111 injected TP cost is really from the local morph changes: Base:99417650982, Diff:99454354685, +0.0369%?PostOrderVisit@LocalAddressVisitor@@QEAA?AW4fgWalkResult@Compiler@@PEAPEAUGenTree@@PEAU4@@Z:31130610:+6.61%:73.44%:+0.0313%?EvalUsingMathIdentity@ValueNumStore@@AEAAIW4var_types@@W4VNFunc@@II@Z:6168480:+6.05%:14.55%:+0.0062%
`ValueNumStore::EvalUsingMathIdentity'::`2'::<lambda_2>::operator() :860150:NA:2.03%:+0.0009%?fgPerBlockLocalVarLiveness@Compiler@@QEAAXXZ:174224:+0.04%:0.41%:+0.0002%?fgMorphSmpOp@Compiler@@AEAAPEAUGenTree@@PEAU2@PEAUMorphAddrContext@1@PEA_N@Z:141174:+0.01%:0.33%:+0.0001%?gtSetEvalOrder@Compiler@@QEAAIPEAUGenTree@@@Z:115047:+0.01%:0.27%:+0.0001%GenTreeVisitor<`Compiler::optCSE_GetMaskData'::`2'::MaskDataWalker>::WalkTree:59296:+0.14%:0.14%:+0.0001%GenTreeVisitor<`Compiler::fgSetTreeSeq'::`2'::SetTreeSeqVisitor>::WalkTree:57562:+0.01%:0.14%:+0.0001%?fgMorphTree@Compiler@@QEAAPEAUGenTree@@PEAU2@PEAUMorphAddrContext@1@@Z:51860:+0.01%:0.12%:+0.0001%
memset :-2570677:-0.34%:6.06%:-0.0026%Haven't really checked more in detail. cc @dotnet/jit-contrib PTAL @EgorBo |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
Both during local morph and during VN.
Fix#40021
Saves 3 KB on BasicMinimalApi after #84095 (there's 1111
__GetFieldHelperfunctions). About 0.04%. There's still a null check kept for each offset computation, which we cannot really get rid of, but NAOT could maybe emit the IL such that there is a dominating null check so that only one is emitted.Example:
Base:
Diff:
Local morph changes handle the pattern for local structs -- VN changes handle the pattern for classes (and more complicated struct cases, like storing them in locals, which there are a few examples of in #40021).