Skip to content

Conversation

@amanasifkhalid
Copy link
Contributor

@amanasifkhalid amanasifkhalid commented May 21, 2024

Follow-up to #102461, and part of #9304. Compacting blocks after establishing an RPO-based layout, but before moving backward jumps to fall into their successors, can enable more opportunities for branch removal (example). Here are the diffs on Windows x64: gist. TP impact is minimal, ranging from -0.05% to +0.01%.

cc @dotnet/jit-contrib, @jakobbotsch PTAL. I'm ok with us deciding to merge this now, or some time after merging #102343. Thanks!

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 21, 2024
@dotnet-policy-service
Copy link
Contributor

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

@amanasifkhalid
Copy link
Contributor Author

I noticed some x86 failures locally; I'll fix these and then run CI to verify

@amanasifkhalid
Copy link
Contributor Author

amanasifkhalid commented May 21, 2024

In fgDoReversePostOrderLayout, we build an array of call-finally pairs before reordering any blocks, so we can easily fix these pairs up later. After setting up the RPO layout, but before fixing the call-finally pairs, we call fgMoveBackwardJumpsToSuccessors, which can compact BBJ_ALWAYS predecessors into BBJ_CALLFINALLY successors, thus invalidating the block pointers in the array. Doing the call-finally fixups before calling fgMoveBackwardJumpsToSuccessors easily fixes this.

@amanasifkhalid
Copy link
Contributor Author

/azp run runtime-coreclr libraries-pgo

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@amanasifkhalid
Copy link
Contributor Author

@EgorBo I think Jakob is offline, could you PTAL? Thank you!

Copy link
Member

@EgorBo EgorBo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@amanasifkhalid
Copy link
Contributor Author

amanasifkhalid commented May 22, 2024

Thanks! No diffs in CI. libraries-pgo failure is #100246. SPMI tpdiff timed out on Linux x64.

@amanasifkhalid
Copy link
Contributor Author

/ba-g timeouts on Linux blocking clean CI

@amanasifkhalid amanasifkhalid merged commit 6ecede0 into dotnet:main May 22, 2024
@amanasifkhalid amanasifkhalid deleted the compact-blocks-rpo branch May 22, 2024 13:55
steveharter pushed a commit to steveharter/runtime that referenced this pull request May 28, 2024
Follow-up to dotnet#102461, and part of dotnet#9304. Compacting blocks after establishing an RPO-based layout, but before moving backward jumps to fall into their successors, can enable more opportunities for branch removal; see dotnet#9304 for one such example.
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
Follow-up to dotnet#102461, and part of dotnet#9304. Compacting blocks after establishing an RPO-based layout, but before moving backward jumps to fall into their successors, can enable more opportunities for branch removal; see dotnet#9304 for one such example.
@github-actions github-actions bot locked and limited conversation to collaborators Jun 22, 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.

2 participants