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: don't clone loops where init or limit is a cast local #57602

Merged
merged 2 commits into from
Aug 18, 2021

Conversation

AndyAyersMS
Copy link
Member

The loop cloner assumes all computations it introduces are compatible
with TYP_INT, so don't allow cloning when the initial or final value
are variables with incompatible types.

Fixes #57535.

The loop cloner assumes all computations it introduces are compatible
with TYP_INT, so don't allow cloning when the initial or final value
are variables with incompatible types.

Fixes dotnet#57535.
@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 Aug 17, 2021
@ghost
Copy link

ghost commented Aug 17, 2021

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

Issue Details

The loop cloner assumes all computations it introduces are compatible
with TYP_INT, so don't allow cloning when the initial or final value
are variables with incompatible types.

Fixes #57535.

Author: AndyAyersMS
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@AndyAyersMS
Copy link
Member Author

cc @dotnet/jit-contrib @SingleAccretion

No SPMI diffs.

We will want to port this to .NET 6.

Copy link
Member

@kunalspathak kunalspathak left a comment

Choose a reason for hiding this comment

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

LGTM. I am surprised that none of our test had this scenario.

Copy link
Contributor

@SingleAccretion SingleAccretion left a comment

Choose a reason for hiding this comment

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

Question: do we think this is a cloning-exclusive issue? In relation to not setting the relevant loop flags in the first place (somewhere around optRecordLoop).

I suppose literally nothing but cloning uses this information today so it does not matter either way.

src/coreclr/jit/loopcloning.cpp Outdated Show resolved Hide resolved
src/coreclr/jit/loopcloning.cpp Outdated Show resolved Hide resolved
@AndyAyersMS
Copy link
Member Author

Question: do we think this is a cloning-exclusive issue? In relation to not setting the relevant loop flags in the first place (somewhere around optRecordLoop).

I suppose literally nothing but cloning uses this information today so it does not matter either way.

Probably best to keep the fix surgical for .NET 6.

But we should look and see if anything else might be tripped up.

@AndyAyersMS
Copy link
Member Author

Linux failures seems like some sort of test issue with crossgen2 testing:

;; crossgen2determinism.sh

Unhandled exception. System.AggregateException: One or more errors occurred. (Code generation failed for method '[crossgen2smoke]Program.TestSES_NestedU8(SingleElementStruct_NestedU8,object)') (Code generation failed for method '[crossgen2smoke]Program.TestSES_NestedR8(SingleElementStruct_NestedR8,object)')
---> ILCompiler.CodeGenerationFailedException: Code generation failed for method '[crossgen2smoke]Program.TestSES_NestedU8(SingleElementStruct_NestedU8,object)'
---> System.MissingMethodException: Method not found: 'Void System.Diagnostics.Debug.Assert(Boolean, AssertInterpolatedStringHandler)'.

@trylek seen anything like this recently?

@hoyosjs
Copy link
Member

hoyosjs commented Aug 18, 2021

@AndyAyersMS yes, it's been reported in a few cases. Issue: #57620

@AndyAyersMS
Copy link
Member Author

Mono interpreter failure looks real but is unrelated.

   Loader.classloader.XUnitWrapper: [Long Running Test] 'Loader/classloader/regressions/523654/test532654_b/test532654_b.sh', Elapsed: 00:08:08
Attempting to collect crash dump: /home/helixbot/dotnetbuild/dumps/crashdump_269.dmp
Invoking: sudo /root/helix/work/correlation/createdump --name "/home/helixbot/dotnetbuild/dumps/crashdump_269.dmp" 269 --withheap
createdump stdout:
Gathering state for process 269 corerun

createdump stderr:
CLRDataCreateInstance(ICLRDataEnumMemoryRegions) FAILED 80131c4f

Failed to collect crash dump
    Loader/classloader/regressions/523654/test532654_b/test532654_b.sh [FAIL]
      corrupted double-linked list

        Got a SIGABRT while executing native code. This usually indicates
        a fatal error in the mono runtime or one of the native libraries 
        used by your application

Does not seem to be a known issue? cc @BrzVlad

@AndyAyersMS AndyAyersMS merged commit a108d25 into dotnet:main Aug 18, 2021
@AndyAyersMS
Copy link
Member Author

/backport to release/6.0

@github-actions
Copy link
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1144484614

@AndyAyersMS
Copy link
Member Author

/backport to release/6.0-rc1

@github-actions
Copy link
Contributor

Started backporting to release/6.0-rc1: https://github.com/dotnet/runtime/actions/runs/1144633915

@ghost ghost locked as resolved and limited conversation to collaborators Sep 17, 2021
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.

JIT crash/assert while compiling Grpc.core codebase
4 participants