Skip to content

JIT: Factor loop duplication code - #97506

Merged
jakobbotsch merged 1 commit into
dotnet:mainfrom
jakobbotsch:factor-loop-duplication
Jan 26, 2024
Merged

JIT: Factor loop duplication code#97506
jakobbotsch merged 1 commit into
dotnet:mainfrom
jakobbotsch:factor-loop-duplication

Conversation

@jakobbotsch

Copy link
Copy Markdown
Member

Factor the loop duplication code out of loop cloning and loop unrolling in anticipation of also using it in loop peeling.

No diffs expected.

Factor the loop duplication code out of loop cloning and loop unrolling
in anticipation of also using it in loop peeling.
@ghostghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jan 25, 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

Factor the loop duplication code out of loop cloning and loop unrolling in anticipation of also using it in loop peeling.

No diffs expected.

Author:jakobbotsch
Assignees:jakobbotsch
Labels:

area-CodeGen-coreclr

Milestone:-

@ryujit-bot

Copy link
Copy Markdown
Diff results for #97506

Throughput diffs

Throughput diffs for windows/x86 ran on linux/x86

FullOpts (-0.00% to +0.01%)
CollectionPDIFF
coreclr_tests.run.windows.x86.checked.mch+0.01%

Details here


void FlowGraphNaturalLoop::Duplicate(BasicBlock** insertAfter,
BlockToBlockMap* map,
weight_t weightScale,
bool bottomNeedsRedirection)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

FWIW, we will be able to get rid of this bottomNeedsRedirection parameter once we don't have fallthrough anymore. We could've probably gotten rid of it here with some complications, but I think it is going to be much easier once we don't have fallthrough, so I didn't want to bother.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for pointing this out. This PR will probably get merged before #97488, so I'll plan on removing this over there.

@ryujit-bot

Copy link
Copy Markdown
Diff results for #97506

Assembly diffs

Assembly diffs for linux/arm64 ran on windows/x64

Diffs are based on 2,498,771 contexts (1,011,240 MinOpts, 1,487,531 FullOpts).

MISSED contexts: 6,580 (0.26%)

Overall (+0 bytes)
CollectionBase size (bytes)Diff size (bytes)
libraries_tests.run.linux.arm64.Release.mch383,838,152+0
FullOpts (+0 bytes)
CollectionBase size (bytes)Diff size (bytes)
libraries_tests.run.linux.arm64.Release.mch168,416,476+0

Details here


Throughput diffs

Throughput diffs for linux/arm ran on windows/x86

Overall (-0.00% to +0.01%)
CollectionPDIFF
coreclr_tests.run.linux.arm.checked.mch+0.01%
realworld.run.linux.arm.checked.mch+0.01%
FullOpts (-0.00% to +0.01%)
CollectionPDIFF
coreclr_tests.run.linux.arm.checked.mch+0.01%
realworld.run.linux.arm.checked.mch+0.01%

Throughput diffs for windows/x86 ran on windows/x86

FullOpts (-0.00% to +0.01%)
CollectionPDIFF
coreclr_tests.run.windows.x86.checked.mch+0.01%

Details here


@jakobbotsch

Copy link
Copy Markdown
MemberAuthor

cc @dotnet/jit-contrib PTAL @BruceForstall

No diffs.

@jakobbotsch
jakobbotsch marked this pull request as ready for review January 25, 2024 15:40
@ryujit-bot

Copy link
Copy Markdown
Diff results for #97506

Assembly diffs

Assembly diffs for linux/arm64 ran on windows/x64

Diffs are based on 2,498,771 contexts (1,011,240 MinOpts, 1,487,531 FullOpts).

MISSED contexts: 6,580 (0.26%)

Overall (+0 bytes)
CollectionBase size (bytes)Diff size (bytes)
libraries_tests.run.linux.arm64.Release.mch383,838,152+0
FullOpts (+0 bytes)
CollectionBase size (bytes)Diff size (bytes)
libraries_tests.run.linux.arm64.Release.mch168,416,476+0

Details here


Throughput diffs

Throughput diffs for linux/arm ran on windows/x86

Overall (-0.00% to +0.01%)
CollectionPDIFF
coreclr_tests.run.linux.arm.checked.mch+0.01%
realworld.run.linux.arm.checked.mch+0.01%
FullOpts (-0.00% to +0.01%)
CollectionPDIFF
coreclr_tests.run.linux.arm.checked.mch+0.01%
realworld.run.linux.arm.checked.mch+0.01%

Throughput diffs for windows/x86 ran on windows/x86

FullOpts (-0.00% to +0.01%)
CollectionPDIFF
coreclr_tests.run.windows.x86.checked.mch+0.01%

Details here


@ryujit-bot

Copy link
Copy Markdown
Diff results for #97506

Assembly diffs

Assembly diffs for linux/arm64 ran on windows/x64

Diffs are based on 2,498,771 contexts (1,011,240 MinOpts, 1,487,531 FullOpts).

MISSED contexts: 6,580 (0.26%)

Overall (+0 bytes)
CollectionBase size (bytes)Diff size (bytes)
libraries_tests.run.linux.arm64.Release.mch383,838,152+0
FullOpts (+0 bytes)
CollectionBase size (bytes)Diff size (bytes)
libraries_tests.run.linux.arm64.Release.mch168,416,476+0

Details here


Throughput diffs

Throughput diffs for linux/arm ran on windows/x86

Overall (-0.00% to +0.01%)
CollectionPDIFF
coreclr_tests.run.linux.arm.checked.mch+0.01%
realworld.run.linux.arm.checked.mch+0.01%
FullOpts (-0.00% to +0.01%)
CollectionPDIFF
coreclr_tests.run.linux.arm.checked.mch+0.01%
realworld.run.linux.arm.checked.mch+0.01%

Throughput diffs for windows/x86 ran on windows/x86

FullOpts (-0.00% to +0.01%)
CollectionPDIFF
coreclr_tests.run.windows.x86.checked.mch+0.01%

Details here


@jakobbotsch

Copy link
Copy Markdown
MemberAuthor

Hmm, there is actually a single diff in linux-arm64. Going to check what that is, but I expect it to just be something around block weighting that is subtly different...

@jakobbotsch

Copy link
Copy Markdown
MemberAuthor

Ah, the diff is because the PR removes this quirk in unrolling:

// TODO-Quirk: Skip empty blocks and go directly to their destination.
BasicBlock* targetBlk = block->Next();
if (targetBlk->KindIs(BBJ_ALWAYS) && targetBlk->isEmpty())
targetBlk = targetBlk->GetTarget();

Didn't realize it was still there, but given the single diff that doesn't seem necessary to do separately.

@jakobbotsch
jakobbotsch merged commit 1e8b750 into dotnet:mainJan 26, 2024
@jakobbotsch
jakobbotsch deleted the factor-loop-duplication branch January 26, 2024 09:03
@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.

4 participants

@jakobbotsch@ryujit-bot@BruceForstall@amanasifkhalid