-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Don't instrument methods with [Intrinsic] #81983
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this should be a jit policy, not a runtime policy?
That will require new JIT-VM interface to notify VM it doesn't need to introduce instrumentation tier, so +200 LOC changes |
Additionally we can introduce a sort of hack: PTR_MethodTable pMT = pMethodDesc->GetMethodTable();
if (pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__SPAN)) ||
pMT->HasSameTypeDefAs(CoreLibBinder::GetClass(CLASS__READONLY_SPAN)))
{
return NativeCodeVersion::OptimizationTier0;
} to disable instrumentation for all span members (they indeed don't need that). That gives up to 5% more RPS. Mostly because of |
I don't follow. The jit can decide whether or not to instrument, no matter what the runtime says. |
2eb477a
to
4089eaa
Compare
The problem that currently our workflow looks like this:
If the instrumented tier decides it doesn't need an instrumentation it means we basically compiling Tier0 we already had. I've addressed your feedback as I generally agree with it. And will think about the ^ problem separately. Maybe it's actually for good because currently we end up with a lot of redundant Tier1 compilations for small methods (problem described here) so at least in this case we end up with non-optimized code and didn't waste time on optimizations |
@AndyAyersMS anything else on your mind to do here? 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
I realize we may do a redundant tier0 compile right now, but once we get around to handling some of these as intrinsics in Tier0 we actually should rarely be jitting these methods.
Let's assume all methods with
[Intrinsic]
don't need any instrumentation because they're imported as JIT intrinsics in Tier1 and their actual profile is never taken. There are few cases where we might not expand an intrinsic in Tier1 but so far they don't look like profile is a big deal for them.The main problem this PR fixes are block counters inside those intrinsics and the cache contention they cause. As a bonus - we create less compilations now (slight decrease in working set).
Plaintex benchmark on aspnet-citrine-lin machine
with Tier0-instrumented (forced to stay in that tier forever):
NOTE: such methods are still call-counted, it's just that they will jump directly to Tier1 after R2R (or Tier0) after 30 calls.
cc @AndyAyersMS