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 'isValidGeneralDatasize(size)' during 'Generate code' #68170

Closed
kunalspathak opened this issue Apr 18, 2022 · 5 comments · Fixed by #68198
Closed

Assertion failed 'isValidGeneralDatasize(size)' during 'Generate code' #68170

kunalspathak opened this issue Apr 18, 2022 · 5 comments · Fixed by #68198
Assignees
Labels
arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Comments

@kunalspathak
Copy link
Member

// Found by Antigen
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
public class TestClass
{
    public struct S2
    {
        public short short_1;
    }
    static byte s_byte_3 = 4;
    static int s_int_8 = -1;
    static float s_float_11 = -5f;
    static S2 s_s2_17 = new S2();
    int int_24 = 5;
    float float_27 = 5.1025643f;
    S2 s2_33 = new S2();
    static int s_loopInvariant = 0;
    public byte LeafMethod1()
    {
        unchecked
        {
            return 15%4;
        }
    }
    public float LeafMethod9()
    {
        unchecked
        {
            return float_27;
        }
    }
    public float Method1(ref float p_float_34, out S2 p_s2_35, byte p_byte_36, S2 p_s2_37, ref int p_int_38)
    {
        unchecked
        {
            uint uint_51 = 5;
            S2 s2_54 = new S2();
            S2 s2_55 = s2_54;
            p_s2_35 = s2_33;
            for (int __loopvar4 = s_loopInvariant; s_int_8 < s_int_8; __loopvar4 += 3, uint_51 &= 15/4)
{}                                                            Log("s2_55", s2_55);
            return float_27 /= 15+4;
        }
    }
    public void Method0()
    {
        unchecked
        {
            S2 s2_137 = new S2();
            do
            {
            }
            while (Method1(ref float_27, out s_s2_17, s_byte_3, s2_137, ref int_24) - LeafMethod9()== (s_float_11 *= 15+4)/ Method1(ref float_27, out s2_33, LeafMethod1(), s2_33, ref s_int_8)+ 21);
            return;
        }
    }
    public static void Main(string[] args)
    {
        new TestClass().Method0();
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public static void Log(string varName, object varValue)
    {
    }
}
/*
Environment:

set COMPlus_TieredCompilation=1
set COMPlus_TC_OnStackReplacement_InitialCounter=1
set COMPlus_OSR_HitLimit=2
set COMPlus_AltJitName=clrjit_universal_arm64_x64.dll
set COMPlus_AltJit=Method1

Assert failure(PID 32168 [0x00007da8], Thread: 33408 [0x8280]): Assertion failed 'isValidGeneralDatasize(size)' in 'TestClass:Method1(byref,byref,ubyte,S2,byref):float:this' during 'Generate code' (IL size 92; hash 0x0ec8894a; Tier1-OSR)
    File: D:\git\dotnet-runtime\src\coreclr\jit\emitarm64.cpp Line: 5432
    Image: d:\git\dotnet-runtime\artifacts\tests\coreclr\windows.x64.Checked\tests\Core_Root\CoreRun.exe
*/
@kunalspathak kunalspathak added arch-arm64 area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Apr 18, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Apr 18, 2022
@ghost
Copy link

ghost commented Apr 18, 2022

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

Issue Details
// Found by Antigen
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
public class TestClass
{
    public struct S2
    {
        public short short_1;
    }
    static byte s_byte_3 = 4;
    static int s_int_8 = -1;
    static float s_float_11 = -5f;
    static S2 s_s2_17 = new S2();
    int int_24 = 5;
    float float_27 = 5.1025643f;
    S2 s2_33 = new S2();
    static int s_loopInvariant = 0;
    public byte LeafMethod1()
    {
        unchecked
        {
            return 15%4;
        }
    }
    public float LeafMethod9()
    {
        unchecked
        {
            return float_27;
        }
    }
    public float Method1(ref float p_float_34, out S2 p_s2_35, byte p_byte_36, S2 p_s2_37, ref int p_int_38)
    {
        unchecked
        {
            uint uint_51 = 5;
            S2 s2_54 = new S2();
            S2 s2_55 = s2_54;
            p_s2_35 = s2_33;
            for (int __loopvar4 = s_loopInvariant; s_int_8 < s_int_8; __loopvar4 += 3, uint_51 &= 15/4)
{}                                                            Log("s2_55", s2_55);
            return float_27 /= 15+4;
        }
    }
    public void Method0()
    {
        unchecked
        {
            S2 s2_137 = new S2();
            do
            {
            }
            while (Method1(ref float_27, out s_s2_17, s_byte_3, s2_137, ref int_24) - LeafMethod9()== (s_float_11 *= 15+4)/ Method1(ref float_27, out s2_33, LeafMethod1(), s2_33, ref s_int_8)+ 21);
            return;
        }
    }
    public static void Main(string[] args)
    {
        new TestClass().Method0();
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public static void Log(string varName, object varValue)
    {
    }
}
/*
Environment:

set COMPlus_TieredCompilation=1
set COMPlus_TC_OnStackReplacement_InitialCounter=1
set COMPlus_OSR_HitLimit=2
set COMPlus_AltJitName=clrjit_universal_arm64_x64.dll
set COMPlus_AltJit=Method1

Assert failure(PID 32168 [0x00007da8], Thread: 33408 [0x8280]): Assertion failed 'isValidGeneralDatasize(size)' in 'TestClass:Method1(byref,byref,ubyte,S2,byref):float:this' during 'Generate code' (IL size 92; hash 0x0ec8894a; Tier1-OSR)
    File: D:\git\dotnet-runtime\src\coreclr\jit\emitarm64.cpp Line: 5432
    Image: d:\git\dotnet-runtime\artifacts\tests\coreclr\windows.x64.Checked\tests\Core_Root\CoreRun.exe
*/
Author: kunalspathak
Assignees: -
Labels:

arch-arm64, area-CodeGen-coreclr

Milestone: -

@kunalspathak
Copy link
Member Author

@dotnet/jit-contrib

@AndyAyersMS
Copy link
Member

This seems like it might be OSR related -- I'll take a look.

@AndyAyersMS AndyAyersMS self-assigned this Apr 18, 2022
@AndyAyersMS
Copy link
Member

Yes, it's an assert trying to enregister something in the OSR prolog.

@AndyAyersMS AndyAyersMS removed the untriaged New issue has not been triaged by the area owner label Apr 18, 2022
@AndyAyersMS
Copy link
Member

Also showed up in the weekend libraries-pgo run https://dev.azure.com/dnceng/public/_build/results?buildId=1722899&view=results for linux arm64 OSR stress:

  Discovering: System.Text.Json.Tests (method display = ClassAndMethod, method display options = None)
  Discovered:  System.Text.Json.Tests (found 4304 of 4368 test cases)
  Starting:    System.Text.Json.Tests (parallel test collections = on, max threads = 4)

Assert failure(PID 30 [0x0000001e], Thread: 60 [0x003c]): Assertion failed 'isValidGeneralDatasize(size)' in 'System.Text.Json.Tests.Utf8JsonReaderTests:TestMultiSegmentStringConversionToDateTimeOffset()' during 'Generate code' (IL size 159; hash 0x579fa03a; Tier1-OSR)

    File: /__w/1/s/src/coreclr/jit/emitarm64.cpp Line: 5432
    Image: /root/helix/work/correlation/dotnet

AndyAyersMS added a commit to AndyAyersMS/runtime that referenced this issue Apr 18, 2022
Need to use `emitActualTypeSize` for the operand size.

Fixes dotnet#68170.
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Apr 19, 2022
kunalspathak pushed a commit that referenced this issue Apr 19, 2022
Need to use `emitActualTypeSize` for the operand size.

Fixes #68170.
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Apr 19, 2022
directhex pushed a commit to directhex/runtime that referenced this issue Apr 21, 2022
…et#68198)

Need to use `emitActualTypeSize` for the operand size.

Fixes dotnet#68170.
@ghost ghost locked as resolved and limited conversation to collaborators May 19, 2022
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants