Support inlining runtime async callable thunks#127642
Draft
jakobbotsch wants to merge 2 commits intodotnet:mainfrom
Draft
Support inlining runtime async callable thunks#127642jakobbotsch wants to merge 2 commits intodotnet:mainfrom
jakobbotsch wants to merge 2 commits intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates CoreCLR async infrastructure and the JIT importer to enable inlining of runtime async callable thunks (commonly seen after guarded devirtualization of virtual async calls), including propagating/handling continuation-context behavior so the inlined code can still resume on the appropriate context.
Changes:
- JIT: allow inlining inlinees that contain async calls in a constrained scenario, and propagate caller async context arguments into inlined async calls when needed.
- CoreLib: centralize “continue” flag masking via
AllContinueFlagsand adjust continuation dispatch to handle head continuations that require follow-up scheduling.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/AsyncHelpers.CoreCLR.cs | Adds AllContinueFlags and updates runtime-async continuation dispatch to detect/queue follow-up execution when continuation-context flags are present. |
| src/coreclr/jit/importercalls.cpp | Enables inlining of certain async inlinees (runtime async callable thunks) and adds logic to flow async context args from the inlining call into async calls inside the inlinee. |
| src/coreclr/jit/compiler.h | Declares new importer helpers/state used for async-in-inlinee handling. |
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.
This adds supports to the JIT for inlining runtime async callable thunks. We typically see these after GDV kicks in for a virtual async call, and the implementer is not runtime async.
Example:
Before:
After:
Not totally sure this is how I wanna do this, this might look different once we get full general async inlining...