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

Split out and generalize tailcall IR validation/tailcall profile adjustments #69941

Merged

Conversation

jakobbotsch
Copy link
Member

  • Split the IR validation after tailcalls into a separate function.
    Previously it was intertwined with updating of profile weights for
    follow-up blocks.
  • Generalize the validation to use a tree walk and handle more cases.
    This fixes [libraries-pgo] Assertion failed 'asgNode->OperIs(GT_ASG)' in during 'Morph - Global'  #69939.
  • Generalize the updating of profile weights for follow-up blocks.
    Previously this was only updating profile weights for one follow up
    blocks, but there can be an arbitrary number of successor blocks due
    to inlining.

Fix #69939

I was not able to come up with a simple test case. It requires a quite specific sequence of inlines and GDVs to produce IR that ends up with the NOP we were failing on.

* Split the IR validation after tailcalls into a separate function.
  Previously it was intertwined with updating of profile weights for
  follow-up blocks.
* Generalize the validation to use a tree walk and handle more cases.
  This fixes an assertion failure seen in some PGO runs.
* Generalize the updating of profile weights for follow-up blocks.
  Previously this was only updating profile weights for one follow up
  blocks, but there can be an arbitrary number of successor blocks due
  to inlining.

Fix dotnet#69939
@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 May 28, 2022
@ghost ghost assigned jakobbotsch May 28, 2022
@ghost
Copy link

ghost commented May 28, 2022

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

Issue Details
  • Split the IR validation after tailcalls into a separate function.
    Previously it was intertwined with updating of profile weights for
    follow-up blocks.
  • Generalize the validation to use a tree walk and handle more cases.
    This fixes [libraries-pgo] Assertion failed 'asgNode->OperIs(GT_ASG)' in during 'Morph - Global'  #69939.
  • Generalize the updating of profile weights for follow-up blocks.
    Previously this was only updating profile weights for one follow up
    blocks, but there can be an arbitrary number of successor blocks due
    to inlining.

Fix #69939

I was not able to come up with a simple test case. It requires a quite specific sequence of inlines and GDVs to produce IR that ends up with the NOP we were failing on.

Author: jakobbotsch
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress

@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @AndyAyersMS

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@jakobbotsch jakobbotsch requested a review from AndyAyersMS May 28, 2022 15:52
@EgorBo
Copy link
Member

EgorBo commented May 28, 2022

that piece of validation caused problems many times already, maybe it's time to just delete it 😄

@jakobbotsch
Copy link
Member Author

that piece of validation caused problems many times already, maybe it's time to just delete it 😄

I think the problematic part here is having the complicated IR after tailcalls, ideally we should teach the inliner to avoid all this no-op IR it adds instead so that we can validate this condition much easier. I do think we should have validation that the tailcalls we are doing are legal.

@jakobbotsch
Copy link
Member Author

Gonna rerun jitstress now that we've merged #69946...

@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr jitstress, runtime-coreclr libraries-jitstress

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@jakobbotsch
Copy link
Member Author

Most of the libraries-jitstress runs failed with "A call to an Azure DevOps api returned 401, which may indicate a bad 'System.AccessToken' value.", will give it another retry.

@jakobbotsch
Copy link
Member Author

/azp run runtime-core libraries-jitstress

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr libraries-jitstress

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jakobbotsch
Copy link
Member Author

Sigh, the failure was #69854. Hopefully I've fixed it for libraries-jitstress now.

@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr libraries-jitstress

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jakobbotsch
Copy link
Member Author

Failures are #69835, #13757 and #69993.

@jakobbotsch jakobbotsch merged commit 7890ef1 into dotnet:main May 31, 2022
@jakobbotsch jakobbotsch deleted the split-and-generalize-tailcall-validation branch May 31, 2022 18:57
@ghost ghost locked as resolved and limited conversation to collaborators Jun 30, 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.

[libraries-pgo] Assertion failed 'asgNode->OperIs(GT_ASG)' in during 'Morph - Global'
5 participants