-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Replace HELPER_METHOD_FRAME with DynamicHelperFrame in patchpoints #112025
base: main
Are you sure you want to change the base?
Conversation
… and JIT_PartialCompilationPatchpoint - Consolidate the 2 functions so we only need 1 copy of the C++ code - Add asm helpers in the current officially supported architectures (The community ports will come later)
Tagging subscribers to this area: @mangod9 |
/azp run runtime-jit-experimental |
Azure Pipelines successfully started running 1 pipeline(s). |
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 great, thank you!
A side/post-HMF question, do we have some alternative/deterministic mechanism to replace the two VirtualUnwind
calls in JIT_PatchpointWorkerWorkerWithPolicy
?
NESTED_END JIT_Patchpoint, _TEXT | ||
|
||
; first arg register holds iloffset, which needs to be moved to the second register, and the first register filled with NULL | ||
LEAF_ENTRY JIT_PartialCompilationPatchpoint, _TEXT |
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 like we can remove the need of separateJIT_PartialCompilationPatchpoint
if we update its only usage:
runtime/src/coreclr/jit/patchpoint.cpp
Lines 241 to 242 in d8a6117
GenTreeCall* helperCall = | |
compiler->gtNewHelperCallNode(CORINFO_HELP_PARTIAL_COMPILATION_PATCHPOINT, TYP_VOID, ilOffsetNode); |
to be:
GenTree* nullCounter = compiler->gtNewIconNode(0, TYP_I_IMPL);
GenTreeCall* helperCall =
compiler->gtNewHelperCallNode(CORINFO_HELP_PATCHPOINT, TYP_VOID, nullCounter, ilOffsetNode);
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.
I likely would have done this differently. The head and tail portions are similar, the middle part has the policy, so the middle part could have been handled via two different auxiliary methods.
If we ever productize partial compilation there will likely be further changes in that policy, so keeping it separated would be nice.
jit-experimental has a known OSR failure #111625 which you are hitting, but the partial compilation failures are new to this PR. |
…to two easily distinguished functions.
Following @jkotas and @AndyAyersMS comments I've refactored the policy logic significantly. It looks much better to me now, and I hope it looks good to them too. I'll re-run the jit experimental leg if this looks good in regular PR tests. |
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.
Thanks -- this looks good.
Could you please take at comments that are still open? |
@am11, about the calls to VirtualUnwind ... well, we could replace them by doing something with the TransitionBlock, but it would be a lot of processor specific bespoke code that would be easy to break. Until there is a perf issue, I'd like to just use the VirtualUnwind. |
/azp run runtime-jit-experimental |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
We like to mark methods that are only used within the file as static
Co-authored-by: Andy Ayers <[email protected]>
Merged wrong suggestion earlier
/azp run runtime-jit-experimental |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
LGTM. Thank you!
/azp run runtime-jit-experimental |
Azure Pipelines successfully started running 1 pipeline(s). |
JIT_Patchpoint
andJIT_PartialCompilationPatchpoint
are still separate entrypoints, but the real meat of the logic is now all inJIT_PatchpointWorkerWorkerWithPolicy
)DynamicHelperFrame
which appears to be sufficient.TransitionBlock
and call into the common C++ code