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 '(constIndexOffset % elemSize) == 0' #67870

Closed
BruceForstall opened this issue Apr 11, 2022 · 11 comments
Closed

Assertion failed '(constIndexOffset % elemSize) == 0' #67870

BruceForstall opened this issue Apr 11, 2022 · 11 comments
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI disabled-test The test is disabled in source code against the issue
Milestone

Comments

@BruceForstall
Copy link
Member

BruceForstall commented Apr 11, 2022

Test: JIT\Regression\JitBlue\Runtime_56953\Runtime_56953\Runtime_56953.cmd

coreclr windows arm Checked @ Windows.10.Arm64v8.Open

https://dev.azure.com/dnceng/public/_build/results?buildId=1710403&view=ms.vss-test-web.build-test-results-tab&runId=46520194&paneView=debug

    JIT\Regression\JitBlue\Runtime_56953\Runtime_56953\Runtime_56953.cmd [FAIL]
      
      Assert failure(PID 12276 [0x00002ff4], Thread: 15268 [0x3ba4]): Assertion failed '(constIndexOffset % elemSize) == 0' in 'System.Collections.Generic.Dictionary`2[__Canon,__Canon][System.__Canon,System.__Canon]:TryInsert(System.__Canon,System.__Canon,ubyte):bool:this' during 'Do value numbering' (IL size 739; hash 0x0b956994; Tier1)
      
          File: D:\a\_work\1\s\src\coreclr\jit\gentree.cpp Line: 17355
          Image: D:\h\w\A48D0941\p\corerun.exe
      
      
      Return code:      1
      Raw output file:      D:\h\w\A48D0941\w\AB94092C\uploads\Reports\JIT.Regression\JitBlue\Runtime_56953\Runtime_56953\Runtime_56953.output.txt
      Raw output:
      BEGIN EXECUTION
       "D:\h\w\A48D0941\p\corerun.exe" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false"  Runtime_56953.dll 
      Expected: 100
      Actual: -1073740286
      END EXECUTION - FAILED
      FAILED

@dotnet/jit-contrib

category:correctness
theme:value-numbering
skill-level:intermediate
cost:small
impact:small

@BruceForstall BruceForstall added arch-arm32 os-windows area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Apr 11, 2022
@BruceForstall BruceForstall added this to the 7.0.0 milestone Apr 11, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Apr 11, 2022
@ghost
Copy link

ghost commented Apr 11, 2022

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

Issue Details

Test: JIT\Regression\JitBlue\Runtime_56953\Runtime_56953\Runtime_56953.cmd

coreclr windows arm Checked @ Windows.10.Arm64v8.Open

https://dev.azure.com/dnceng/public/_build/results?buildId=1710403&view=ms.vss-test-web.build-test-results-tab&runId=46520194&paneView=debug

    JIT\Regression\JitBlue\Runtime_56953\Runtime_56953\Runtime_56953.cmd [FAIL]
      
      Assert failure(PID 12276 [0x00002ff4], Thread: 15268 [0x3ba4]): Assertion failed '(constIndexOffset % elemSize) == 0' in 'System.Collections.Generic.Dictionary`2[__Canon,__Canon][System.__Canon,System.__Canon]:TryInsert(System.__Canon,System.__Canon,ubyte):bool:this' during 'Do value numbering' (IL size 739; hash 0x0b956994; Tier1)
      
          File: D:\a\_work\1\s\src\coreclr\jit\gentree.cpp Line: 17355
          Image: D:\h\w\A48D0941\p\corerun.exe
      
      
      Return code:      1
      Raw output file:      D:\h\w\A48D0941\w\AB94092C\uploads\Reports\JIT.Regression\JitBlue\Runtime_56953\Runtime_56953\Runtime_56953.output.txt
      Raw output:
      BEGIN EXECUTION
       "D:\h\w\A48D0941\p\corerun.exe" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false"  Runtime_56953.dll 
      Expected: 100
      Actual: -1073740286
      END EXECUTION - FAILED
      FAILED

@dotnet/jit-contrib

Author: BruceForstall
Assignees: -
Labels:

arch-arm32, os-windows, area-CodeGen-coreclr

Milestone: 7.0.0

@BruceForstall BruceForstall added blocking-outerloop Blocking the 'runtime-coreclr outerloop' and 'runtime-libraries-coreclr outerloop' runs and removed untriaged New issue has not been triaged by the area owner labels Apr 11, 2022
@kunalspathak
Copy link
Member

Hit this on Antigen run as well.

// Found by Antigen
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
public class TestClass
{
    public struct S1
    {
    }
    public struct S2
    {
        public struct S2_D1_F1
        {
            public uint uint_1;
        }
    }
    static short s_short_8 = -2;
    static int s_int_9 = 2;
    static sbyte s_sbyte_11 = 5;
    static string s_string_13 = "1DW3N";
    static ushort s_ushort_14 = 5;
    static uint s_uint_15 = 83;
    static S2.S2_D1_F1 s_s2_s2_d1_f1_18 = new S2.S2_D1_F1();
    int int_26 = 2147483647;
    sbyte sbyte_28 = -2;
    ulong ulong_33 = 2;
    S1 s1_34 = new S1();
    [MethodImpl(MethodImplOptions.NoInlining)]
    public int LeafMethod6()
    {
        unchecked
        {
            return 15^4+ (s_int_9 += int_26 %= int_26+ 43* (int_26 -= s_int_9));
        }
    }
    [MethodImpl(MethodImplOptions.NoInlining)]
    public sbyte LeafMethod8()
    {
        unchecked
        {
            return sbyte_28 <<= (s_int_9 /= 15+4)- (s_sbyte_11 >>= 15^4^ s_int_9 - LeafMethod6());
        }
    }
    public sbyte Method2(out S1 p_s1_60, out S1 p_s1_61, out ulong p_ulong_62, ulong p_ulong_63, sbyte p_sbyte_64, ushort p_ushort_65, out uint p_uint_66)
    {
        unchecked
        {
            p_ulong_62 = ulong_33;
            p_uint_66 = s_s2_s2_d1_f1_18.uint_1 <<= (s_int_9 ^= LeafMethod6())| 15*4;
            return (sbyte)(LeafMethod8() | 15+4);
        }
    }
    public short Method3(ushort p_ushort_84, ref string p_string_85, float p_float_86)
    {
        unchecked
        {
            sbyte sbyte_95 = 6;
            ulong ulong_100 = 5;
            if (15<4)
            {
            }
            else
            {
                s_sbyte_11 &= (sbyte)(Method2(out s1_34, out s1_34, out ulong_100, 15+4, (sbyte)(LeafMethod8() - sbyte_95), 15+4, out s_uint_15) | 15+4);
            }
            return 15+4;
        }
    }
    public void Method0()
    {
        unchecked
        {
            s_short_8 = Method3(s_ushort_14, ref s_string_13, 15%4);
            return;
        }
    }
    public static void Main(string[] args)
    {
        new TestClass().Method0();
    }
}
/*
--------- Test ---------  

Environment:

set COMPlus_JitOptRepeat=*
set COMPlus_AltJitName=clrjit_universal_arm64_x64.dll
set COMPlus_AltJit=CalculateMetadataLocation

Unhandled exception. 
Assert failure(PID 366276 [0x000596c4], Thread: 36932 [0x9044]): Assertion failed '(constIndexOffset % elemSize) == 0' in 'System.Reflection.PortableExecutable.PEHeaders:CalculateMetadataLocation(long,byref,byref):this' during 'Do value numbering' (IL size 249; hash 0x5b6a880a; FullOpts)
    File: D:\git\runtime\src\coreclr\jit\gentree.cpp Line: 17355
    Image: D:\git\runtime\artifacts\tests\coreclr\windows.x64.Checked\tests\Core_Root\CoreRun.exe
*/

@JulieLeeMSFT
Copy link
Member

@SingleAccretion did you have a chance to look at this issue yet?
@jakobbotsch please disable this test until it is resolved.

@jakobbotsch
Copy link
Member

@JulieLeeMSFT Looks like it already was disabled by #67978.

@jakobbotsch jakobbotsch added disabled-test The test is disabled in source code against the issue and removed blocking-outerloop Blocking the 'runtime-coreclr outerloop' and 'runtime-libraries-coreclr outerloop' runs labels May 2, 2022
@SingleAccretion
Copy link
Contributor

SingleAccretion commented May 2, 2022

did you have a chance to look at this issue yet?

Not yet.

For some context, we have had an identical issue for quite some time: #57856, and the root cause is that we try to deconstruct the IR to get to the index, which tends to break down when OptRepeat (aka CSE) gets involved, or some less common IR shapes (which I suspect is the case here) are involved. The fix is to deconstruct VNs instead.

Edit: this is a JitOptRepeat-only bug; moving to 8.0.

@SingleAccretion SingleAccretion modified the milestones: 7.0.0, 8.0.0 Jun 4, 2022
@BruceForstall BruceForstall removed arch-arm32 disabled-test The test is disabled in source code against the issue os-windows labels Jun 5, 2022
@BruceForstall BruceForstall modified the milestones: 8.0.0, 7.0.0 Jun 5, 2022
@BruceForstall
Copy link
Member Author

@SingleAccretion You re-enabled this test with #70237

Now it is failing in jitstress on arm64: https://dev.azure.com/dnceng/public/_build/results?buildId=1807505&view=ms.vss-test-web.build-test-results-tab

@BruceForstall BruceForstall added the blocking-clean-ci-optional Blocking optional rolling runs label Jun 5, 2022
BruceForstall added a commit to BruceForstall/runtime that referenced this issue Jun 5, 2022
@JulieLeeMSFT
Copy link
Member

@AndyAyersMS PTAL if we need to enable this test in .NET 8.

@AndyAyersMS AndyAyersMS modified the milestones: 9.0.0, 8.0.0 Aug 3, 2023
@AndyAyersMS
Copy link
Member

Moving this back to 8.0 for now so I don't forget about it.

@AndyAyersMS
Copy link
Member

Ah, this is windows arm and JitOptRepeat, so will move it back out of 8.0.

@AndyAyersMS AndyAyersMS modified the milestones: 8.0.0, Future Aug 4, 2023
@BruceForstall
Copy link
Member Author

I'll take this one.

@amanasifkhalid
Copy link
Member

This test was re-enabled by #100717. Looks like Bruce's JitOptRepeat work fixed this failure.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 8, 2024
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 disabled-test The test is disabled in source code against the issue
Projects
None yet
Development

No branches or pull requests

7 participants