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: Don't put cold blocks in RPO during layout #112448

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

amanasifkhalid
Copy link
Member

Split off from #112004. Excluding cold blocks from the loop-aware RPO simplifies how we compute the initial layout to feed into 3-opt, as it eliminates the need to manually move cold blocks out-of-line, instead allowing them to sink to the end of the method. This has the consequence of changing -- most likely worsening -- the layout of cold sections. However, our current threshold for "cold" is low enough that I don't think this churn matters: While BB_COLD_WEIGHT is 0.01, we compare this to normalized weights scaled by BB_UNITY_WEIGHT (100), so normalized weights must be below 0.0001 to be considered cold. In other words, profile data must suggest a block executes less than 0.01% (not 1%) of the time to be excluded from reordering.

@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 Feb 11, 2025
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
Member Author

cc @dotnet/jit-contrib, @AndyAyersMS PTAL. Diffs are missing benchmark collections, but it looks like we're frequently shortening jumps on x64/x86 such that it's a size improvement, whereas the loss of fallthrough in the cold section is increasing code size on arm32/arm64 (though if this code is truly cold, it shouldn't matter). Thanks!

@amanasifkhalid
Copy link
Member Author

ping @dotnet/jit-contrib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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