Skip to content
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

JIT: arm64 osr funclet frame probing #70916

Merged
merged 2 commits into from
Jun 23, 2022
Merged

Conversation

AndyAyersMS
Copy link
Member

@AndyAyersMS AndyAyersMS commented Jun 17, 2022

We currently need to pad OSR funclet frames with the full size of the
Tier0 frame, and this padding sits above the register save area. For
large Tier0 frames we thus need to probe the stack in the OSR prolog
for type1 and type3 frames, before doing the initial SP adjustment and
save.

Longer term the plan is to revise arm64 OSR so we will not need to
do this padding; at that point we can remove this extra probing.

Fixes #70263.

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jun 17, 2022
@ghost ghost assigned AndyAyersMS Jun 17, 2022
@ghost
Copy link

ghost commented Jun 17, 2022

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Issue Details

We currently need to pad OSR funclet frames with the full size of the
Tier0 frame, and this paddign sits above the register save area. For
large Tier0 frames we thus need to probe the stack in the OSR prolog
for type1 and type3 frames, before doing the initial SP adjustment and
save.

Longer term the plan is to revise arm64 OSR so we will not need to
do this padding; at that point we can remove this extra probing.

Fixes #70263.

Author: AndyAyersMS
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@AndyAyersMS
Copy link
Member Author

@BruceForstall PTAL
cc @dotnet/jit-contrib

@BruceForstall BruceForstall self-requested a review June 17, 2022 22:21
@BruceForstall
Copy link
Member

Can you show what the funclet prolog from #70263 (comment) looks like with this change?

@BruceForstall
Copy link
Member

What about the genStackPointerAdjustment(genFuncletInfo.fiSpDelta1, REG_SCRATCH, nullptr, /* reportUnwindData */ true); done for frame type 5? What range is genFuncletInfo.fiSpDelta1 in that case? (can there be asserts added that indicate the maximum range?)

@jakobbotsch
Copy link
Member

"Frame type 5" is already quite broken, see #66089.

@AndyAyersMS
Copy link
Member Author

Can you show what the funclet prolog from #70263 (comment) looks like with this change?

Old/new prologs

mov     x9, #0x9ce0
sub     sp, sp, x9
stp     fp, lr, [sp]
stp     x19, x20, [sp,#32]
mov     x2, #0x9ce0
add     x3, fp, x2
str     x3, [sp,#24]
movn    x9, #0xfff
movn    x1, #0x9cdf
ldr     wzr, [sp, x9]
sub     x9, x9, #1, LSL #12
cmp     x1, x9
bls     pc-16 (-4 instructions)
mov     x9, #0x9ce0
sub     sp, sp, x9
stp     fp, lr, [sp]
stp     x19, x20, [sp,#32]
mov     x2, #0x9ce0
add     x3, fp, x2
str     x3, [sp,#24]

@AndyAyersMS
Copy link
Member Author

/azp run runtime-coreclr superpmi-diffs

@AndyAyersMS
Copy link
Member Author

/azp run runtime-coreclr superpmi-replay

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@AndyAyersMS
Copy link
Member Author

caught up in the guid change

@AndyAyersMS
Copy link
Member Author

AndyAyersMS commented Jun 18, 2022

Libraries failure looks like a gc hole perhaps:

Assert failure(PID 5564 [0x000015bc], Thread: 708 [0x02c4]): m_alignpad == 0

This is on x64 -- this PR only changes arm64 codegen, so expect this is unrelated.

@jkotas
Copy link
Member

jkotas commented Jun 18, 2022

Assert failure(PID 5564 [0x000015bc], Thread: 708 [0x02c4]): m_alignpad == 0

#70231

@jakobbotsch
Copy link
Member

/azp run runtime-coreclr superpmi-diffs, runtime-coreclr superpmi-replay

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@BruceForstall
Copy link
Member

You should rebase after #70922, and I think you need the same change for fiFrameType=5.

@AndyAyersMS
Copy link
Member Author

You should rebase after #70922, and I think you need the same change for fiFrameType=5.

Ok. You don't mind that I am repurposing genAllocLclFrame like this? It is (more or less) allocating the "tier0" frame equivalent in the funclet.

I really need to revise arm64 to not need this crazy funclet padding, but it feels a bit risky to try doing that now.

@BruceForstall
Copy link
Member

You don't mind that I am repurposing genAllocLclFrame like this? It is (more or less) allocating the "tier0" frame equivalent in the funclet.

It seems ok, since genAllocLclFrame on arm64 only does frame probing (the name is a misnomer for arm64). So as long as it's probing the right amount, for OSR, it makes sense.

We currently need to pad OSR funclet frames with the full size of the
Tier0 frame, and this paddign sits above the register save area. For
large Tier0 frames we thus need to probe the stack in the OSR prolog
for type1 and type3 frames, before doing the initial SP adjustment and
save.

Longer term the plan is to revise arm64 OSR so we will not need to
do this padding; at that point we can remove this extra probing.

Fixes dotnet#70263.
@AndyAyersMS
Copy link
Member Author

/azp run runtime-jit-experimental

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@AndyAyersMS
Copy link
Member Author

Failure looks like #69474

@AndyAyersMS
Copy link
Member Author

Jit-experimental was clean other than an OSX timeout.

Other parts of this pipeline run the Github_21990 test case under OSR stress, and it's been consistently failing there on arm64 for a long time.

@AndyAyersMS AndyAyersMS merged commit 95d64e8 into dotnet:main Jun 23, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test failure: JIT\Regression\JitBlue\GitHub_21990\GitHub_21990\GitHub_21990.cmd
4 participants