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: Avoid relying on bbNum to find lexical loop boundaries #101714

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

jakobbotsch
Copy link
Member

@jakobbotsch jakobbotsch commented Apr 30, 2024

The previous implementation is based on bbNum and can subtly return the wrong results when the block list isn't sorted. This can happen in loop compaction (the bug existed since #96995 but seems to have been exposed by #99827).
Switch FlowGraphNaturalLoop::GetLexicallyTopMostBlock and FlowGraphNaturalLoop::GetLexicallyBottomMostBlock to more robust implementations that scan the basic block list forwards (and backwards) to find the boundary blocks.

Fix #101695

Switch `FlowGraphNaturalLoop::GetLexicallyTopMostBlock` and
`FlowGraphNaturalLoop::GetLexicallyBottomMostBlock` to more robust
implementations that scan the basic block list forwards (and backwards)
to find the boundary blocks.

Fix dotnet#101695
@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 Apr 30, 2024
Copy link
Contributor

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

@jakobbotsch jakobbotsch marked this pull request as ready for review April 30, 2024 14:34
@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @AndyAyersMS

No diffs. Some minor TP regressions.

@jakobbotsch jakobbotsch requested a review from AndyAyersMS April 30, 2024 15:32
@wtgodbe
Copy link
Member

wtgodbe commented Apr 30, 2024

Can we port this to preview4 as well (assuming it's the fix for #101695)? dotnet/aspnetcore#55372 is still blocked on it

@AndyAyersMS
Copy link
Member

Can we port this to preview4 as well

Yes, we will port it.

@AndyAyersMS
Copy link
Member

Some timeouts, should we bypass build analysis here?

@jakobbotsch
Copy link
Member Author

Yeah, I see similar timeouts in my other PR #100823 that started a run around the same time, so seems unlikely to be related to the change.

@jakobbotsch
Copy link
Member Author

/ba-g Timeouts are also happening in other PRs and limited to linux-x64

@jakobbotsch jakobbotsch merged commit 017593d into dotnet:main Apr 30, 2024
98 of 107 checks passed
@jakobbotsch
Copy link
Member Author

/backport to release/9.0-preview4

Copy link
Contributor

Started backporting to release/9.0-preview4: https://github.com/dotnet/runtime/actions/runs/8898356760

@jakobbotsch jakobbotsch deleted the fix-101695 branch April 30, 2024 17:57
michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this pull request May 9, 2024
…01714)

Switch `FlowGraphNaturalLoop::GetLexicallyTopMostBlock` and
`FlowGraphNaturalLoop::GetLexicallyBottomMostBlock` to more robust
implementations that scan the basic block list forwards (and backwards)
to find the boundary blocks.

Fix dotnet#101695
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
…01714)

Switch `FlowGraphNaturalLoop::GetLexicallyTopMostBlock` and
`FlowGraphNaturalLoop::GetLexicallyBottomMostBlock` to more robust
implementations that scan the basic block list forwards (and backwards)
to find the boundary blocks.

Fix dotnet#101695
@github-actions github-actions bot locked and limited conversation to collaborators May 31, 2024
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.

segv in JIT when ingesting dotnet/runtime into dotnet/aspnetcore
3 participants