-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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: Improve BBJ_COND to BBJ_ALWAYS conversion in fgUpdateFlowGraph #97681
Conversation
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsFollow-up to #97488. In
|
Diff results for #97681Throughput diffsThroughput diffs for linux/arm64 ran on windows/x64Overall (+0.02% to +0.06%)
FullOpts (+0.03% to +0.07%)
Throughput diffs for linux/x64 ran on windows/x64Overall (+0.02% to +0.07%)
FullOpts (+0.04% to +0.08%)
Throughput diffs for osx/arm64 ran on windows/x64Overall (+0.02% to +0.06%)
FullOpts (+0.03% to +0.06%)
Throughput diffs for windows/arm64 ran on windows/x64Overall (+0.02% to +0.06%)
MinOpts (-0.00% to +0.01%)
FullOpts (+0.03% to +0.06%)
Throughput diffs for windows/x64 ran on windows/x64Overall (+0.02% to +0.06%)
FullOpts (+0.04% to +0.06%)
Details here |
Diff results for #97681Assembly diffsAssembly diffs for linux/arm64 ran on windows/x64Diffs are based on 2,259,470 contexts (1,008,044 MinOpts, 1,251,426 FullOpts). MISSED contexts: 159 (0.01%) Overall (-42,568 bytes)
FullOpts (-42,568 bytes)
Assembly diffs for linux/x64 ran on windows/x64Diffs are based on 2,249,703 contexts (981,298 MinOpts, 1,268,405 FullOpts). MISSED contexts: 134 (0.01%) Overall (-47,589 bytes)
FullOpts (-47,589 bytes)
Assembly diffs for windows/x64 ran on windows/x64Diffs are based on 2,098,526 contexts (926,221 MinOpts, 1,172,305 FullOpts). MISSED contexts: 138 (0.01%) Overall (-41,586 bytes)
FullOpts (-41,586 bytes)
Details here Assembly diffs for windows/x86 ran on windows/x86Diffs are based on 2,290,721 contexts (838,165 MinOpts, 1,452,556 FullOpts). MISSED contexts: base: 808 (0.04%), diff: 842 (0.04%) Overall (-20,881 bytes)
FullOpts (-20,881 bytes)
Details here Throughput diffsThroughput diffs for linux/arm ran on windows/x86Overall (+0.01% to +0.03%)
FullOpts (+0.01% to +0.04%)
Throughput diffs for windows/x86 ran on windows/x86Overall (+0.02% to +0.06%)
FullOpts (+0.03% to +0.06%)
Details here Throughput diffs for linux/arm64 ran on linux/x64Overall (+0.02% to +0.07%)
FullOpts (+0.03% to +0.08%)
Throughput diffs for linux/x64 ran on linux/x64Overall (+0.02% to +0.08%)
FullOpts (+0.04% to +0.09%)
Details here |
Diff results for #97681Assembly diffsAssembly diffs for windows/x64 ran on linux/x64Diffs are based on 2,512,204 contexts (997,391 MinOpts, 1,514,813 FullOpts). MISSED contexts: 8 (0.00%) Overall (-52,115 bytes)
FullOpts (-52,115 bytes)
Details here Throughput diffsThroughput diffs for linux/arm64 ran on windows/x64Overall (+0.02% to +0.06%)
FullOpts (+0.03% to +0.07%)
Throughput diffs for linux/x64 ran on windows/x64Overall (+0.02% to +0.07%)
FullOpts (+0.04% to +0.08%)
Throughput diffs for osx/arm64 ran on windows/x64Overall (+0.02% to +0.06%)
FullOpts (+0.03% to +0.06%)
Throughput diffs for windows/arm64 ran on windows/x64Overall (+0.02% to +0.06%)
MinOpts (-0.01% to +0.00%)
FullOpts (+0.03% to +0.06%)
Throughput diffs for windows/x64 ran on windows/x64Overall (+0.02% to +0.07%)
FullOpts (+0.03% to +0.07%)
Details here Throughput diffs for windows/x86 ran on linux/x86Overall (+0.02% to +0.06%)
FullOpts (+0.03% to +0.06%)
Details here |
Diff results for #97681Assembly diffsAssembly diffs for linux/x64 ran on windows/x64Diffs are based on 2,517,901 contexts (991,070 MinOpts, 1,526,831 FullOpts). MISSED contexts: 8 (0.00%) Overall (-50,401 bytes)
FullOpts (-50,401 bytes)
Assembly diffs for windows/x64 ran on windows/x64Diffs are based on 2,512,204 contexts (997,391 MinOpts, 1,514,813 FullOpts). MISSED contexts: 8 (0.00%) Overall (-52,115 bytes)
FullOpts (-52,115 bytes)
Details here Assembly diffs for windows/x86 ran on windows/x86Diffs are based on 2,293,423 contexts (839,658 MinOpts, 1,453,765 FullOpts). MISSED contexts: base: 38 (0.00%), diff: 73 (0.00%) Overall (-22,900 bytes)
FullOpts (-22,900 bytes)
Details here Throughput diffsThroughput diffs for linux/arm64 ran on windows/x64Overall (+0.02% to +0.06%)
FullOpts (+0.03% to +0.07%)
Throughput diffs for linux/x64 ran on windows/x64Overall (+0.02% to +0.07%)
FullOpts (+0.04% to +0.08%)
Throughput diffs for osx/arm64 ran on windows/x64Overall (+0.02% to +0.06%)
FullOpts (+0.03% to +0.06%)
Throughput diffs for windows/arm64 ran on windows/x64Overall (+0.02% to +0.06%)
MinOpts (-0.01% to +0.00%)
FullOpts (+0.03% to +0.06%)
Throughput diffs for windows/x64 ran on windows/x64Overall (+0.02% to +0.07%)
FullOpts (+0.03% to +0.07%)
Details here Throughput diffs for linux/arm ran on windows/x86Overall (+0.01% to +0.04%)
FullOpts (+0.01% to +0.04%)
Throughput diffs for windows/x86 ran on windows/x86Overall (+0.02% to +0.06%)
FullOpts (+0.03% to +0.06%)
Details here Throughput diffs for linux/arm64 ran on linux/x64Overall (-0.14% to +0.00%)
FullOpts (-0.16% to +0.00%)
Throughput diffs for linux/x64 ran on linux/x64Overall (-0.12% to +0.00%)
FullOpts (-0.13% to +0.00%)
Details here |
cc @dotnet/jit-contrib, @AndyAyersMS PTAL. |
Diff results for #97681Assembly diffsAssembly diffs for linux/x64 ran on windows/x64Diffs are based on 2,517,901 contexts (991,070 MinOpts, 1,526,831 FullOpts). MISSED contexts: 8 (0.00%) Overall (-50,401 bytes)
FullOpts (-50,401 bytes)
Assembly diffs for windows/x64 ran on windows/x64Diffs are based on 2,512,204 contexts (997,391 MinOpts, 1,514,813 FullOpts). MISSED contexts: 8 (0.00%) Overall (-52,115 bytes)
FullOpts (-52,115 bytes)
Details here Assembly diffs for windows/x86 ran on windows/x86Diffs are based on 2,293,423 contexts (839,658 MinOpts, 1,453,765 FullOpts). MISSED contexts: base: 38 (0.00%), diff: 73 (0.00%) Overall (-22,900 bytes)
FullOpts (-22,900 bytes)
Details here Throughput diffsThroughput diffs for linux/arm ran on windows/x86Overall (+0.01% to +0.04%)
FullOpts (+0.01% to +0.04%)
Throughput diffs for windows/x86 ran on windows/x86Overall (+0.02% to +0.06%)
FullOpts (+0.03% to +0.06%)
Details here Throughput diffs for linux/arm64 ran on linux/x64Overall (-0.14% to +0.00%)
FullOpts (-0.16% to +0.00%)
Throughput diffs for linux/x64 ran on linux/x64Overall (-0.12% to +0.00%)
FullOpts (-0.13% to +0.00%)
Details here |
I've put this work on hold in favor of the successor edge items in #93020. I'll come back to this. |
Follow-up to #97488. In
fgUpdateFlowGraph
, we already have a check for convertingBBJ_COND
blocks toBBJ_ALWAYS
blocks when the true and false targets are the same. This PR marginally improves the number of cases we can optimize by checking if the true/false target is aBBJ_ALWAYS
to the false/true target. This pattern can occur inadvertently if a block's false target is an emptyBBJ_ALWAYS
to the "real" false target (in other words, theBBJ_ALWAYS
was inserted to maintain the implicit fallthrough invariant during block reordering), and other flowgraph optimizations (like compacting) cause theBBJ_ALWAYS
block to point to the true target. In such cases, we can convert theBBJ_COND
block to aBBJ_ALWAYS
block, and potentially delete the emptyBBJ_ALWAYS
.