Skip to content

JIT: Merge fgRemoveConditionalJump and fgOptimizeBranchToNext - #97456

Merged
amanasifkhalid merged 1 commit into
dotnet:mainfrom
amanasifkhalid:fgRemoveConditionalJump
Jan 26, 2024
Merged

JIT: Merge fgRemoveConditionalJump and fgOptimizeBranchToNext#97456
amanasifkhalid merged 1 commit into
dotnet:mainfrom
amanasifkhalid:fgRemoveConditionalJump

Conversation

@amanasifkhalid

Copy link
Copy Markdown
Contributor

Adding this back in after #97407. fgRemoveConditionalJump and fgOptimizeBranchToNext do the same thing, except that the latter explicitly assumes the false target of the BBJ_COND block being optimized is the next block. It makes sense to remove that assumption, and merge these methods before allowing the false target to diverge from the next block during flowgraph optimization phases.

@ghostghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jan 24, 2024
@ghost

Copy link
Copy Markdown

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

Issue Details

Adding this back in after #97407. fgRemoveConditionalJump and fgOptimizeBranchToNext do the same thing, except that the latter explicitly assumes the false target of the BBJ_COND block being optimized is the next block. It makes sense to remove that assumption, and merge these methods before allowing the false target to diverge from the next block during flowgraph optimization phases.

Author:amanasifkhalid
Assignees:amanasifkhalid
Labels:

area-CodeGen-coreclr

Milestone:-

@amanasifkhalid

Copy link
Copy Markdown
ContributorAuthor

cc @dotnet/jit-contrib, @AndyAyersMS PTAL. Small improvements from slightly more aggressive statement removal.

@ryujit-bot

Copy link
Copy Markdown
Diff results for #97456

Assembly diffs

Assembly diffs for linux/arm64 ran on windows/x64

Diffs are based on 2,501,157 contexts (1,003,806 MinOpts, 1,497,351 FullOpts).

MISSED contexts: 4,060 (0.16%)

Overall (-60 bytes)
CollectionBase size (bytes)Diff size (bytes)
libraries.pmi.linux.arm64.checked.mch76,022,852-36
libraries_tests_no_tiered_compilation.run.linux.arm64.Release.mch162,656,488-24
FullOpts (-60 bytes)
CollectionBase size (bytes)Diff size (bytes)
libraries.pmi.linux.arm64.checked.mch75,902,868-36
libraries_tests_no_tiered_compilation.run.linux.arm64.Release.mch149,175,276-24

Assembly diffs for linux/x64 ran on windows/x64

Diffs are based on 2,595,007 contexts (1,052,329 MinOpts, 1,542,678 FullOpts).

MISSED contexts: 3,628 (0.14%)

Overall (-1,818 bytes)
CollectionBase size (bytes)Diff size (bytes)
benchmarks.run.linux.x64.checked.mch13,735,124-72
benchmarks.run_pgo.linux.x64.checked.mch68,635,056-19
benchmarks.run_tiered.linux.x64.checked.mch17,373,152-3
coreclr_tests.run.linux.x64.checked.mch459,550,097-47
libraries.crossgen2.linux.x64.checked.mch38,670,232-69
libraries.pmi.linux.x64.checked.mch60,144,132-481
libraries_tests.run.linux.x64.Release.mch333,558,929-711
libraries_tests_no_tiered_compilation.run.linux.x64.Release.mch130,468,363-344
realworld.run.linux.x64.checked.mch13,194,603-72
FullOpts (-1,818 bytes)
CollectionBase size (bytes)Diff size (bytes)
benchmarks.run.linux.x64.checked.mch13,468,331-72
benchmarks.run_pgo.linux.x64.checked.mch48,805,299-19
benchmarks.run_tiered.linux.x64.checked.mch3,695,392-3
coreclr_tests.run.linux.x64.checked.mch132,991,962-47
libraries.crossgen2.linux.x64.checked.mch38,669,030-69
libraries.pmi.linux.x64.checked.mch60,031,262-481
libraries_tests.run.linux.x64.Release.mch149,169,408-711
libraries_tests_no_tiered_compilation.run.linux.x64.Release.mch119,809,892-344
realworld.run.linux.x64.checked.mch12,805,497-72

Assembly diffs for osx/arm64 ran on windows/x64

Diffs are based on 2,262,709 contexts (930,876 MinOpts, 1,331,833 FullOpts).

MISSED contexts: 3,256 (0.14%)

Overall (-60 bytes)
CollectionBase size (bytes)Diff size (bytes)
libraries.pmi.osx.arm64.checked.mch79,955,476-36
libraries_tests_no_tiered_compilation.run.osx.arm64.Release.mch160,911,076-24
FullOpts (-60 bytes)
CollectionBase size (bytes)Diff size (bytes)
libraries.pmi.osx.arm64.checked.mch79,834,348-36
libraries_tests_no_tiered_compilation.run.osx.arm64.Release.mch147,773,548-24

Assembly diffs for windows/arm64 ran on windows/x64

Diffs are based on 2,318,207 contexts (931,543 MinOpts, 1,386,664 FullOpts).

MISSED contexts: 2,687 (0.12%)

Overall (-100 bytes)
CollectionBase size (bytes)Diff size (bytes)
coreclr_tests.run.windows.arm64.checked.mch495,372,096-24
libraries.pmi.windows.arm64.checked.mch79,594,724-36
libraries_tests.run.windows.arm64.Release.mch310,511,308-16
libraries_tests_no_tiered_compilation.run.windows.arm64.Release.mch169,134,348-24
FullOpts (-100 bytes)
CollectionBase size (bytes)Diff size (bytes)
coreclr_tests.run.windows.arm64.checked.mch156,280,568-24
libraries.pmi.windows.arm64.checked.mch79,474,740-36
libraries_tests.run.windows.arm64.Release.mch108,929,804-16
libraries_tests_no_tiered_compilation.run.windows.arm64.Release.mch155,996,884-24

Assembly diffs for windows/x64 ran on windows/x64

Diffs are based on 2,492,912 contexts (983,689 MinOpts, 1,509,223 FullOpts).

MISSED contexts: 3,899 (0.16%)

Overall (-1,531 bytes)
CollectionBase size (bytes)Diff size (bytes)
aspnet.run.windows.x64.checked.mch42,178,256-74
benchmarks.run.windows.x64.checked.mch8,747,570-67
coreclr_tests.run.windows.x64.checked.mch393,404,923-120
libraries.crossgen2.windows.x64.checked.mch39,443,922-70
libraries.pmi.windows.x64.checked.mch61,389,190-447
libraries_tests.run.windows.x64.Release.mch281,642,309-383
libraries_tests_no_tiered_compilation.run.windows.x64.Release.mch133,913,806-296
realworld.run.windows.x64.checked.mch14,170,687-74
FullOpts (-1,531 bytes)
CollectionBase size (bytes)Diff size (bytes)
aspnet.run.windows.x64.checked.mch27,519,531-74
benchmarks.run.windows.x64.checked.mch8,747,209-67
coreclr_tests.run.windows.x64.checked.mch119,861,931-120
libraries.crossgen2.windows.x64.checked.mch39,442,733-70
libraries.pmi.windows.x64.checked.mch61,275,671-447
libraries_tests.run.windows.x64.Release.mch103,273,993-383
libraries_tests_no_tiered_compilation.run.windows.x64.Release.mch123,490,436-296
realworld.run.windows.x64.checked.mch13,780,982-74

Details here


Assembly diffs for linux/arm ran on windows/x86

Diffs are based on 2,237,690 contexts (827,812 MinOpts, 1,409,878 FullOpts).

MISSED contexts: 74,588 (3.23%)

Overall (-1,314 bytes)
CollectionBase size (bytes)Diff size (bytes)
benchmarks.run.linux.arm.checked.mch15,303,134-66
benchmarks.run_pgo.linux.arm.checked.mch61,262,128-138
benchmarks.run_tiered.linux.arm.checked.mch22,643,448-56
coreclr_tests.run.linux.arm.checked.mch321,791,116-70
libraries.crossgen2.linux.arm.checked.mch35,175,262-70
libraries.pmi.linux.arm.checked.mch49,615,946-290
libraries_tests.run.linux.arm.Release.mch242,762,120-400
libraries_tests_no_tiered_compilation.run.linux.arm.Release.mch93,201,612-174
realworld.run.linux.arm.checked.mch13,613,446-50
FullOpts (-1,314 bytes)
CollectionBase size (bytes)Diff size (bytes)
benchmarks.run.linux.arm.checked.mch14,913,878-66
benchmarks.run_pgo.linux.arm.checked.mch50,464,526-138
benchmarks.run_tiered.linux.arm.checked.mch13,536,292-56
coreclr_tests.run.linux.arm.checked.mch109,060,982-70
libraries.crossgen2.linux.arm.checked.mch35,174,032-70
libraries.pmi.linux.arm.checked.mch49,509,442-290
libraries_tests.run.linux.arm.Release.mch120,759,176-400
libraries_tests_no_tiered_compilation.run.linux.arm.Release.mch83,117,792-174
realworld.run.linux.arm.checked.mch13,163,500-50

Assembly diffs for windows/x86 ran on windows/x86

Diffs are based on 2,296,277 contexts (841,817 MinOpts, 1,454,460 FullOpts).

MISSED contexts: 5,093 (0.22%)

Overall (-1,067 bytes)
CollectionBase size (bytes)Diff size (bytes)
benchmarks.run.windows.x86.checked.mch7,107,453-50
benchmarks.run_pgo.windows.x86.checked.mch45,222,512-30
benchmarks.run_tiered.windows.x86.checked.mch9,511,426-40
coreclr_tests.run.windows.x86.checked.mch309,180,492-70
libraries.crossgen2.windows.x86.checked.mch31,628,298-84
libraries.pmi.windows.x86.checked.mch48,827,886-314
libraries_tests.run.windows.x86.Release.mch185,843,933-224
libraries_tests_no_tiered_compilation.run.windows.x86.Release.mch102,198,175-200
realworld.run.windows.x86.checked.mch11,363,356-55
FullOpts (-1,067 bytes)
CollectionBase size (bytes)Diff size (bytes)
benchmarks.run.windows.x86.checked.mch7,107,174-50
benchmarks.run_pgo.windows.x86.checked.mch38,593,022-30
benchmarks.run_tiered.windows.x86.checked.mch5,241,617-40
coreclr_tests.run.windows.x86.checked.mch107,508,723-70
libraries.crossgen2.windows.x86.checked.mch31,627,241-84
libraries.pmi.windows.x86.checked.mch48,732,572-314
libraries_tests.run.windows.x86.Release.mch87,512,426-224
libraries_tests_no_tiered_compilation.run.windows.x86.Release.mch93,528,383-200
realworld.run.windows.x86.checked.mch11,067,656-55

Details here


Throughput diffs

Throughput diffs for linux/arm ran on windows/x86

Overall (-0.01% to -0.00%)
CollectionPDIFF
benchmarks.run_pgo.linux.arm.checked.mch-0.01%
libraries_tests.run.linux.arm.Release.mch-0.01%
FullOpts (-0.01% to -0.00%)
CollectionPDIFF
benchmarks.run_pgo.linux.arm.checked.mch-0.01%
libraries_tests.run.linux.arm.Release.mch-0.01%

Details here


@amanasifkhalid

Copy link
Copy Markdown
ContributorAuthor

cc @dotnet/jit-contrib, bumping this since the diffs in #97488 are skewed without it.

@amanasifkhalid

Copy link
Copy Markdown
ContributorAuthor

Thank you!

@amanasifkhalid
amanasifkhalid merged commit 4644486 into dotnet:mainJan 26, 2024
@amanasifkhalid
amanasifkhalid deleted the fgRemoveConditionalJump branch January 26, 2024 20:44
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Feb 26, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclrCLR 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

@amanasifkhalid@ryujit-bot@AndyAyersMS