JIT: Enable tail await optimization in async versions in tier 0#130181
Merged
jakobbotsch merged 1 commit intoJul 3, 2026
Conversation
Otherwise we will allocate continuations for paths that are going to be allocation free in tier 1. This shows up in traces when running TechEmpower benchmarks as a large amount of allocation happening before everything is tiered.
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR broadens the conditions under which async tail-await handling is enabled during import by switching from OptimizationEnabled() to Tier0OptimizationEnabled(), allowing the JIT to apply the same tail-await eligibility logic in Tier 0 (when Tier 0 opts are allowed) rather than waiting until Tier 1.
Changes:
- Enable tail-await setup logic for async-version calls under Tier 0 optimization settings by using
opts.Tier0OptimizationEnabled()inimpSetupAsyncCall.
Comments suppressed due to low confidence (1)
src/coreclr/jit/importercalls.cpp:7301
- This change enables additional tail-await handling in Tier0 by consulting
canTailCall(...)during import. Since the PR is motivated by allocation/perf impact (TechEmpower startup / pre-tiering), it would be helpful to include concrete before/after data (e.g., allocation count/size and/or throughput) so reviewers can validate the net win and any potential Tier0 import-time overhead.
if (opts.Tier0OptimizationEnabled() && ((prefixFlags & PREFIX_IS_ASYNC_VERSION_TAIL_AWAIT) != 0) &&
(call->gtReturnType == info.compRetType))
{
CORINFO_METHOD_HANDLE exactCalleeHnd =
((call->AsCall()->gtCallType != CT_USER_FUNC) || call->AsCall()->IsVirtual()) ? nullptr : methHnd;
asyncInfo.IsTailAwait =
info.compCompHnd->canTailCall(info.compMethodHnd, methHnd, exactCalleeHnd, /* fIsTailPrefix */ false);
}
Member
Author
|
cc @dotnet/jit-contrib PTAL @EgorBo |
EgorBo
approved these changes
Jul 3, 2026
This was referenced Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Otherwise we will allocate continuations for paths that are going to be allocation free in tier 1. This shows up in traces when running TechEmpower benchmarks as a large amount of allocation happening until everything gets tiered up.
Diff on alloc metrics on platform-json:
FYI @BrennanConroy