Uh oh!
There was an error while loading. Please reload this page.
Rely on PGO for isinst/castclass - #65922
Conversation
ghost
commented
Feb 26, 2022
Tagging subscribers to this area: @JulieLeeMSFT Issue DetailsFollow up to #65460 Example (with usingSystem.Runtime.CompilerServices;usingSystem.Threading;publicinterfaceIClass{}publicclassClassA:IClass{}publicclassClassB:ClassA{}publicclassProgram{[MethodImpl(MethodImplOptions.NoInlining)]staticClassACastToClassA(objecto)=>(ClassA)o;[MethodImpl(MethodImplOptions.NoInlining)]staticboolIsClassA(objecto)=>oisClassA;[MethodImpl(MethodImplOptions.NoInlining)]staticIClassCastToIClass(objecto)=>(IClass)o;[MethodImpl(MethodImplOptions.NoInlining)]staticboolIsIClass(objecto)=>oisIClass;publicstaticvoidMain(){// promote methods to tier1varb=newClassB();for(inti=0;i<100;i++){CastToClassA(b);IsClassA(b);CastToIClass(b);IsIClass(b);Thread.Sleep(16);}}}Codegen diff: https://www.diffchecker.com/RFblv9RB
|
Uh oh!
There was an error while loading. Please reload this page.
This PR consumes profile data from mibc for casts/isinst. I guarded it with Also, I added "random class" stress mode support for it |
EgorBo
commented
Mar 28, 2022
| CORINFO_CLASS_HANDLE likelyCls = likelyClass.clsHandle; | ||
| if ((likelyCls != NO_CLASS_HANDLE) && | ||
| (likelyClass.likelihood > (UINT32)JitConfig.JitGuardedDevirtualizationChainLikelihood())) |
There was a problem hiding this comment.
Should this rather get its own config variable?
There was a problem hiding this comment.
Just didn't want to produce even more variables 😄 and the default value for this one was OK to me.
in my other PR to add "multiple guesses" I slightly changed the whole logic so I'll leave it as is for now
Follow up to #65460 (and d-o)
Example (with
DOTNET_JitCastProfiling=1):Codegen diff: https://www.diffchecker.com/RFblv9RB