-
Notifications
You must be signed in to change notification settings - Fork 10.5k
ColdBlockInfo: overhaul analysis pass #76093
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
Conversation
@swift-ci smoke test |
@swift-ci Please test compiler performance |
@swift-ci Please benchmark |
@swift-ci test |
@swift-ci Please benchmark |
@swift-ci Please Test Source Compatibility |
@swift-ci smoke test |
@swift-ci Please benchmark |
@swift-ci test |
@swift-ci Please benchmark |
@swift-ci Please smoke test compiler performance |
@swift-ci smoke test Linux |
@swift-ci Please benchmark |
@swift-ci Please benchmark |
2bee163
to
8fb4e5a
Compare
@swift-ci test |
@swift-ci Please benchmark |
@swift-ci Please smoke test compiler performance |
@swift-ci test |
@swift-ci Please smoke test compiler performance |
@swift-ci Please benchmark |
Performance (x86_64): -O
Code size: -OPerformance (x86_64): -Osize
Code size: -Osize
Performance (x86_64): -Onone
Code size: -swiftlibsHow to read the dataThe tables contain differences in performance which are larger than 8% and differences in code size which are larger than 1%.If you see any unexpected regressions, you should consider fixing the Noise: Sometimes the performance results (not code size!) contain false Hardware Overview
|
In prior runs with minor tweaks to the algorithm, the The only consistent improvements I've seen over multiple benchmark runs are:
They're related as (2) is part of the object file in (1), so my guess is the improvement is from not inlining as much into cold blocks. |
The old analysis pass doesn't take into account profile data, nor does it consider post-dominance. It primarily dealt with _fastPath/_slowPath. A block that is dominated by a cold block is itself cold. That's true whether it's forwards or backwards dominance. We can also consider a call to any `Never` returning function as a cold-exit, though the block(s) leading up to that call may be executed frequently because of concurrency. For now, I'm ignoring the concurrency case and assuming it's cold. To make use of this "no return" prediction, use the `-enable-noreturn-prediction` flag, which is currently off by default.
@swift-ci Please smoke test compiler performance |
@swift-ci Please benchmark |
@swift-ci please test |
@swift-ci Please test compiler performance |
There's no reason to do further stages of analysis to propagate coldness if there wasn't any found in Stage 1.
I thought `reverse(silFn)` would do a post-order walk, but I was wrong. This patch cuts the number of iterations to propagate coldness from 3-4 down to 2 in a few of the simple regression test cases. At least on macOS (as the stdlib can vary per platform).
@swift-ci smoke test |
@swift-ci Please test compiler performance |
@swift-ci Please benchmark |
Latest compiler performance run looks much better. The 10% increase in instructions executed under the release build has been solved with the extra optimizations I've added: Summary for main fullRegressions found (see below) Debug-batchdebug-batch briefNone debug-batch detailedNone Releaserelease briefRegressed (0)
Improved (0)
Unchanged (delta < 1.0% or delta < 100.0ms) (2)
release detailedRegressed (0)
Improved (1)
Unchanged (delta < 1.0% or delta < 100.0ms) (365)
|
// RUN: %target-swift-frontend -module-name main -emit-sil -o %t/output.sil %s -O \ | ||
// RUN: -enable-noreturn-prediction \ | ||
// RUN: -enable-throws-prediction \ | ||
// RUN: -Xllvm --debug-only=cold-block-info 2> %t/debug.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't --debug-only=
means that this test needs a REQUIRES: asserts
line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The old analysis pass doesn't take into account profile data, nor does
it consider post-dominance. It primarily dealt with _fastPath/_slowPath.
A block that is dominated by a cold block is itself cold. That's true
whether it's forwards or backwards dominance.
We can also consider a call to any
Never
returning function as acold-exit, though the block(s) leading up to that call may be executed
frequently because of concurrency. For now, I'm ignoring the concurrency
case and assuming it's cold. To make use of this "no return" prediction,
use the
-enable-noreturn-prediction
flag, which is currently off bydefault.