-
Notifications
You must be signed in to change notification settings - Fork 5k
JIT: Cache start of cold section for reuse in 3-opt layout #111365
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
Merged
amanasifkhalid
merged 4 commits into
dotnet:main
from
amanasifkhalid:3-opt-bounds-checking
Jan 15, 2025
Merged
JIT: Cache start of cold section for reuse in 3-opt layout #111365
amanasifkhalid
merged 4 commits into
dotnet:main
from
amanasifkhalid:3-opt-bounds-checking
Jan 15, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/azp run runtime-coreclr libraries-pgo |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-coreclr libraries-pgo |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run runtime-coreclr libraries-pgo, runtime-coreclr libraries-jitstress |
Azure Pipelines successfully started running 2 pipeline(s). |
cc @dotnet/jit-contrib, @AndyAyersMS PTAL. Diffs are from |
AndyAyersMS
approved these changes
Jan 15, 2025
amanasifkhalid
added a commit
that referenced
this pull request
Jan 16, 2025
Follow-up to #111365. Instead of allocating a separate ordinal array, track each block's ordinal by overwriting its bbPostorderNum. We can check if a given block is in the candidate set of blocks being reordered if its ordinal is less than the number of hot blocks, and if the block at the given ordinal in blockOrder matches the block in question (i.e. the same implementation as FlowGraphDfsTree::Contains).
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
During cold code motion, if
fgMoveColdBlocks
finds a call-finally pair that begins with a cold block, it will try to move the entire pair, regardless of whether the tail is cold or not. If the tail isn't cold, 3-opt layout's detection of the last hot block may terminate early, causing the cold part of an EH region to also be considered for reordering. Because 3-opt expects each EH subregion being reordered to be contiguous, this split causes asserts. Caching the cold region start point infgMoveColdBlocks
means we don't need to find the first cold block in 3-opt, thus removing the potential of getting it wrong.While I was here, I decided to enhance
fgMoveColdBlocks
so that it can move cold call-finally pairs at the end of the hot main method body, and clean up 3-opt's initialization logic to reduce its allocation sizes. Fixes #111207.