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: Fix some cases using BasicBlock::bbFallsThrough #97699

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

jakobbotsch
Copy link
Member

bbFallsThrough still returns true for BBJ_COND; we have a couple of places using it as a "control flows from prev block" check, which is wrong after #97488.
Should fix the test failures I'm seeing over in #97182.

`bbFallsThrough` still returns true for `BBJ_COND`; we have a couple of
places using it as a "control flows from prev block" check, which is
wrong after dotnet#97488.
@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 Jan 30, 2024
@ghost ghost assigned jakobbotsch Jan 30, 2024
@ghost
Copy link

ghost commented Jan 30, 2024

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

Issue Details

bbFallsThrough still returns true for BBJ_COND; we have a couple of places using it as a "control flows from prev block" check, which is wrong after #97488.
Should fix the test failures I'm seeing over in #97182.

Author: jakobbotsch
Assignees: jakobbotsch
Labels:

area-CodeGen-coreclr

Milestone: -

Comment on lines +13889 to +13892
else
{
assertionsOut = pred->bbAssertionOut;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Small drive-by fix for some UB here (in the useCondAssertions case we were accessing an inactive union member).

@ryujit-bot
Copy link

Diff results for #97699

Assembly diffs

Assembly diffs for osx/arm64 ran on linux/x64

Diffs are based on 2,270,861 contexts (932,669 MinOpts, 1,338,192 FullOpts).

MISSED contexts: base: 1 (0.00%), diff: 9 (0.00%)

Overall (+684 bytes)
Collection Base size (bytes) Diff size (bytes)
benchmarks.run_pgo.osx.arm64.checked.mch 34,437,860 +60
benchmarks.run_tiered.osx.arm64.checked.mch 15,516,128 +208
coreclr_tests.run.osx.arm64.checked.mch 486,460,784 +172
libraries.crossgen2.osx.arm64.checked.mch 55,725,496 +84
libraries.pmi.osx.arm64.checked.mch 80,219,060 +72
libraries_tests.run.osx.arm64.Release.mch 324,580,556 +88
FullOpts (+684 bytes)
Collection Base size (bytes) Diff size (bytes)
benchmarks.run_pgo.osx.arm64.checked.mch 18,136,188 +60
benchmarks.run_tiered.osx.arm64.checked.mch 4,011,424 +208
coreclr_tests.run.osx.arm64.checked.mch 153,807,100 +172
libraries.crossgen2.osx.arm64.checked.mch 55,723,868 +84
libraries.pmi.osx.arm64.checked.mch 80,097,932 +72
libraries_tests.run.osx.arm64.Release.mch 120,864,708 +88

Assembly diffs for windows/arm64 ran on linux/x64

Diffs are based on 2,341,109 contexts (938,449 MinOpts, 1,402,660 FullOpts).

MISSED contexts: base: 0 (0.00%), diff: 8 (0.00%)

Overall (+668 bytes)
Collection Base size (bytes) Diff size (bytes)
benchmarks.run_pgo.windows.arm64.checked.mch 45,573,924 +60
benchmarks.run_tiered.windows.arm64.checked.mch 15,587,008 +208
coreclr_tests.run.windows.arm64.checked.mch 495,312,136 +172
libraries.crossgen2.windows.arm64.checked.mch 59,070,264 +84
libraries_tests.run.windows.arm64.Release.mch 330,792,704 +144
FullOpts (+668 bytes)
Collection Base size (bytes) Diff size (bytes)
benchmarks.run_pgo.windows.arm64.checked.mch 29,562,156 +60
benchmarks.run_tiered.windows.arm64.checked.mch 4,409,600 +208
coreclr_tests.run.windows.arm64.checked.mch 156,582,272 +172
libraries.crossgen2.windows.arm64.checked.mch 59,068,628 +84
libraries_tests.run.windows.arm64.Release.mch 127,359,108 +144

Assembly diffs for windows/x64 ran on linux/x64

Diffs are based on 2,512,204 contexts (997,391 MinOpts, 1,514,813 FullOpts).

MISSED contexts: base: 0 (0.00%), diff: 8 (0.00%)

Overall (+630 bytes)
Collection Base size (bytes) Diff size (bytes)
benchmarks.run_pgo.windows.x64.checked.mch 36,236,339 +68
benchmarks.run_tiered.windows.x64.checked.mch 12,415,933 +178
coreclr_tests.run.windows.x64.checked.mch 393,193,287 +152
libraries.crossgen2.windows.x64.checked.mch 39,486,146 +56
libraries_tests.run.windows.x64.Release.mch 282,112,885 +176
FullOpts (+630 bytes)
Collection Base size (bytes) Diff size (bytes)
benchmarks.run_pgo.windows.x64.checked.mch 22,065,683 +68
benchmarks.run_tiered.windows.x64.checked.mch 3,316,694 +178
coreclr_tests.run.windows.x64.checked.mch 120,404,433 +152
libraries.crossgen2.windows.x64.checked.mch 39,484,959 +56
libraries_tests.run.windows.x64.Release.mch 106,254,567 +176

Details here


Throughput diffs

Throughput diffs for osx/arm64 ran on windows/x64

Overall (-0.01% to +0.00%)
Collection PDIFF
benchmarks.run.osx.arm64.checked.mch -0.01%
FullOpts (-0.01% to +0.00%)
Collection PDIFF
benchmarks.run.osx.arm64.checked.mch -0.01%

Throughput diffs for windows/arm64 ran on windows/x64

Overall (-0.01% to +0.00%)
Collection PDIFF
benchmarks.run.windows.arm64.checked.mch -0.01%
FullOpts (-0.01% to +0.00%)
Collection PDIFF
benchmarks.run.windows.arm64.checked.mch -0.01%

Throughput diffs for windows/x64 ran on windows/x64

Overall (-0.01% to +0.00%)
Collection PDIFF
benchmarks.run.windows.x64.checked.mch -0.01%
FullOpts (-0.01% to +0.00%)
Collection PDIFF
benchmarks.run.windows.x64.checked.mch -0.01%

Details here


@ryujit-bot
Copy link

Diff results for #97699

Assembly diffs

Assembly diffs for linux/arm ran on windows/x86

Diffs are based on 2,239,391 contexts (829,328 MinOpts, 1,410,063 FullOpts).

MISSED contexts: 71,273 (3.08%)

Overall (+52 bytes)
Collection Base size (bytes) Diff size (bytes)
libraries.crossgen2.linux.arm.checked.mch 34,522,542 +52
FullOpts (+52 bytes)
Collection Base size (bytes) Diff size (bytes)
libraries.crossgen2.linux.arm.checked.mch 34,521,312 +52

Assembly diffs for windows/x86 ran on windows/x86

Diffs are based on 2,293,495 contexts (839,658 MinOpts, 1,453,837 FullOpts).

MISSED contexts: 1 (0.00%)

Overall (+46 bytes)
Collection Base size (bytes) Diff size (bytes)
libraries.crossgen2.windows.x86.checked.mch 31,716,932 +46
FullOpts (+46 bytes)
Collection Base size (bytes) Diff size (bytes)
libraries.crossgen2.windows.x86.checked.mch 31,715,872 +46

Details here


Assembly diffs for linux/arm64 ran on windows/x64

Diffs are based on 2,507,310 contexts (1,007,092 MinOpts, 1,500,218 FullOpts).

MISSED contexts: base: 0 (0.00%), diff: 8 (0.00%)

Overall (+584 bytes)
Collection Base size (bytes) Diff size (bytes)
benchmarks.run_pgo.linux.arm64.checked.mch 80,094,172 +60
benchmarks.run_tiered.linux.arm64.checked.mch 24,600,952 +208
coreclr_tests.run.linux.arm64.checked.mch 508,772,940 +172
libraries.crossgen2.linux.arm64.checked.mch 55,844,024 +84
libraries_tests.run.linux.arm64.Release.mch 395,688,768 +60
FullOpts (+584 bytes)
Collection Base size (bytes) Diff size (bytes)
benchmarks.run_pgo.linux.arm64.checked.mch 54,159,016 +60
benchmarks.run_tiered.linux.arm64.checked.mch 4,862,296 +208
coreclr_tests.run.linux.arm64.checked.mch 160,584,028 +172
libraries.crossgen2.linux.arm64.checked.mch 55,842,388 +84
libraries_tests.run.linux.arm64.Release.mch 180,556,816 +60

Assembly diffs for linux/x64 ran on windows/x64

Diffs are based on 2,517,901 contexts (991,070 MinOpts, 1,526,831 FullOpts).

MISSED contexts: base: 0 (0.00%), diff: 8 (0.00%)

Overall (+567 bytes)
Collection Base size (bytes) Diff size (bytes)
benchmarks.run_pgo.linux.x64.checked.mch 71,590,553 +51
benchmarks.run_tiered.linux.x64.checked.mch 21,435,525 +218
coreclr_tests.run.linux.x64.checked.mch 403,710,934 +133
libraries.crossgen2.linux.x64.checked.mch 38,727,133 +59
libraries_tests.run.linux.x64.Release.mch 337,107,837 +106
FullOpts (+567 bytes)
Collection Base size (bytes) Diff size (bytes)
benchmarks.run_pgo.linux.x64.checked.mch 47,790,564 +51
benchmarks.run_tiered.linux.x64.checked.mch 3,694,745 +218
coreclr_tests.run.linux.x64.checked.mch 123,956,232 +133
libraries.crossgen2.linux.x64.checked.mch 38,725,935 +59
libraries_tests.run.linux.x64.Release.mch 153,348,144 +106

Details here


Throughput diffs

Throughput diffs for linux/arm64 ran on linux/x64

Overall (-0.01% to -0.00%)
Collection PDIFF
realworld.run.linux.arm64.checked.mch -0.01%
smoke_tests.nativeaot.linux.arm64.checked.mch -0.01%
libraries.pmi.linux.arm64.checked.mch -0.01%
benchmarks.run_pgo.linux.arm64.checked.mch -0.01%
benchmarks.run.linux.arm64.checked.mch -0.01%
libraries_tests.run.linux.arm64.Release.mch -0.01%
FullOpts (-0.01% to -0.00%)
Collection PDIFF
realworld.run.linux.arm64.checked.mch -0.01%
smoke_tests.nativeaot.linux.arm64.checked.mch -0.01%
libraries.pmi.linux.arm64.checked.mch -0.01%
benchmarks.run_pgo.linux.arm64.checked.mch -0.01%
benchmarks.run.linux.arm64.checked.mch -0.01%
libraries_tests.run.linux.arm64.Release.mch -0.01%

Throughput diffs for linux/x64 ran on linux/x64

Overall (-0.01% to -0.00%)
Collection PDIFF
benchmarks.run.linux.x64.checked.mch -0.01%
realworld.run.linux.x64.checked.mch -0.01%
benchmarks.run_pgo.linux.x64.checked.mch -0.01%
libraries_tests.run.linux.x64.Release.mch -0.01%
libraries_tests_no_tiered_compilation.run.linux.x64.Release.mch -0.01%
smoke_tests.nativeaot.linux.x64.checked.mch -0.01%
libraries.pmi.linux.x64.checked.mch -0.01%
libraries.crossgen2.linux.x64.checked.mch -0.01%
FullOpts (-0.01% to -0.00%)
Collection PDIFF
benchmarks.run.linux.x64.checked.mch -0.01%
realworld.run.linux.x64.checked.mch -0.01%
coreclr_tests.run.linux.x64.checked.mch -0.01%
benchmarks.run_pgo.linux.x64.checked.mch -0.01%
libraries_tests.run.linux.x64.Release.mch -0.01%
libraries_tests_no_tiered_compilation.run.linux.x64.Release.mch -0.01%
smoke_tests.nativeaot.linux.x64.checked.mch -0.01%
libraries.pmi.linux.x64.checked.mch -0.01%
libraries.crossgen2.linux.x64.checked.mch -0.01%

Details here


@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib PTAL @amanasifkhalid

Diffs. A few cases where we now recognize an induction due to optExtractInitTestIncr being more general, and then start loop cloning.
I left bbFallsThrough alone since I wasn't sure if we want to change its behavior yet (noticed a few cases that explicitly check it and then filter out BBJ_COND cases).

@amanasifkhalid
Copy link
Member

Thanks for the fix!

I left bbFallsThrough alone since I wasn't sure if we want to change its behavior yet (noticed a few cases that explicitly check it and then filter out BBJ_COND cases).

My hope is that we can get rid of bbFallsThrough altogether soon, and replace it with a pattern like the unique predecessor check you're using here. Those explicit BBJ_COND checks were probably introduced as quirks to reduce diffs for now.

@jakobbotsch jakobbotsch merged commit a3485bd into dotnet:main Jan 30, 2024
125 of 129 checks passed
@jakobbotsch jakobbotsch deleted the no-fallthrough-iv-fix branch January 30, 2024 18:46
@github-actions github-actions bot locked and limited conversation to collaborators Mar 12, 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.

3 participants