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

Assertion failed '!foundDiff' when an HFA local var is passed on stack #49780

Closed
echesakov opened this issue Mar 17, 2021 · 0 comments · Fixed by #52802
Closed

Assertion failed '!foundDiff' when an HFA local var is passed on stack #49780

echesakov opened this issue Mar 17, 2021 · 0 comments · Fixed by #52802
Assignees
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI bug
Milestone

Comments

@echesakov
Copy link
Contributor

echesakov commented Mar 17, 2021

The following is a simple repro of an issue that a customer reported here - reproduces on both linux-arm64 and win-arm64 on 3.1, 5.0 and 6.0.

using System;
using System.Runtime.CompilerServices;
using System.Numerics;

namespace Runtime_49489
{
    public class Program
    {
        [MethodImpl(MethodImplOptions.NoInlining)]
        static void Callee(float fltReg0, float fltReg1, float fltReg2, float fltReg3, float fltReg4, float fltReg5, float fltReg6, float fltReg7, Vector2 simd8)
        {
        }

        [MethodImpl(MethodImplOptions.NoInlining)]
        static void Caller(int i)
        {
            Vector2 simd8 = new Vector2();

            if (i > 0)
            {
                Callee(0, 0, 0, 0, 0, 0, 0, 0, simd8);
            }
        }

        static void Main(string[] args)
        {
            Caller(1);
        }
    }
}

Running the program with checked runtime and COMPlus_TieredCompilation=0 would result in the following assertion

Assert failure(PID 4680 [0x00001248], Thread: 8804 [0x2264]): Assertion failed '!foundDiff' in 'Runtime_49489.Program:Caller(int)' during 'Linear scan register alloc' (IL size 59)

    File: F:\echesako\git\runtime4\src\coreclr\jit\lsra.cpp Line: 2260
    Image: F:\echesako\git\runtime4\artifacts\tests\coreclr\windows.arm64.Checked\Tests\Core_Root\CoreRun.exe

Note that if if (i > 0) is commented out or removed

            //if (i > 0)
            {
                Callee(0, 0, 0, 0, 0, 0, 0, 0, simd8);
            }

this will fail with a different assertion (on 5.0 and 6.0 but not 3.1)

Assert failure(PID 16692 [0x00004134], Thread: 18316 [0x478c]): Assertion failed '!fldVarDsc->lvIsInReg()' in 'Runtime_49489.Program:Caller(int)' during 'Generate code' (IL size 55)

    File: F:\echesako\git\runtime4\src\coreclr\jit\treelifeupdater.cpp Line: 337
    Image: F:\echesako\git\runtime4\artifacts\tests\coreclr\windows.arm64.Checked\Tests\Core_Root\CoreRun.exe

I attached two JIT dumps for the different failure modes.

jitDump.un-cond.txt
jitDump.if-cond.txt

cc @dotnet/jit-contrib

@echesakov echesakov added bug arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Mar 17, 2021
@echesakov echesakov added this to the 6.0.0 milestone Mar 17, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Mar 17, 2021
@echesakov echesakov removed the untriaged New issue has not been triaged by the area owner label Mar 17, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label May 27, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label May 27, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants