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

win/x64: Assertion failed 'false && "found use of a node that is not in the LIR sequence"' during 'Lowering nodeinfo' #108613

Closed
kunalspathak opened this issue Oct 7, 2024 · 6 comments · Fixed by #108775
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI in-pr There is an active PR which will close this issue when it is merged
Milestone

Comments

@kunalspathak
Copy link
Member

// Found by Antigen
// Reduced from 55.21 KB to 2.77 KB.


using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
using System.Runtime.Intrinsics.X86;
using System.Numerics;
public class TestClass
{
    public struct S1
    {
    }
    public struct S2
    {
    }
    static ulong s_ulong_17 = 2;
    static Vector256<ulong> s_v256_ulong_36 = Vector256.CreateScalar((ulong)3);
    static Vector512<uint> s_v512_uint_44 = Vector512<uint>.Zero;
    static Vector<double> s_v_double_58 = Vector.Create(0.05357142857142857);
    static Vector2 s_v2_59 = Vector2.UnitX;
    static S1 s_s1_62 = new S1();
    static S2 s_s2_63 = new S2();
    ulong ulong_77 = 0;
    Vector128<int> v128_int_83 = Vector128.CreateScalar(2);
    Vector512<uint> v512_uint_104 = Vector512.Create((uint)2, 3, 3, 57, 57, 57, 5, 2, 0, 2, 57, 57, 57, 2, 5, 2);
    Vector<ulong> v_ulong_116 = Vector.Create((ulong)5);
    Vector2 v2_119 = Vector2.Zero;
    private static List<string> toPrint = new List<string>();
    public ulong Method1(sbyte p_sbyte_124, S2 p_s2_125, ref Vector<double> p_v_double_126, short p_short_127, Vector2 p_v2_128, ref Vector256<ulong> p_v256_ulong_129, Vector2 p_v2_130, Vector<ulong> p_v_ulong_131, out S1 p_s1_132)
    {
        unchecked
        {
            int int_139 = -1;
            while (15>=4)
            {
                switch (Vector128.GetElement(v128_int_83, 15&4))
                {
                    case 0:
                    {
                        break;
                    }
                    default:
                    {
                        v512_uint_104 *= v512_uint_104 += s_v512_uint_44 -= Vector512<uint>.Zero ^ s_v512_uint_44- (v512_uint_104 += v512_uint_104)& Vector512.AndNot(Vector512.Equals(v512_uint_104, v512_uint_104), Vector512.Equals(v512_uint_104, v512_uint_104)) ^ (v512_uint_104 += s_v512_uint_44 += s_v512_uint_44 ^ v512_uint_104)& (s_v512_uint_44 += Vector512.IsZero(v512_uint_104 - v512_uint_104| Vector512.ShiftLeft(s_v512_uint_44, int_139)));
                        break;
                    }
                }
            }
            return s_ulong_17 ^= ulong_77;
        }
    }
    public void Method0()
    {
        unchecked
        {
            short short_224 = -1;
            s_ulong_17 = Method1(15+4, s_s2_63, ref s_v_double_58, short_224 |= 15<<4, Vector2.Reflect(s_v2_59 - Vector2.UnitX- s_v2_59, s_v2_59 += s_v2_59 *= v2_119) + s_v2_59 - Vector2.UnitX- s_v2_59- (v2_119 *= 15-4)- s_v2_59, ref s_v256_ulong_36, Vector2.Multiply(15+4, s_v2_59), v_ulong_116, out s_s1_62);
            return;
        }
    }
    public static void Main(string[] args)
{}
    public static int Antigen()
    {
        new TestClass().Method0();
        return string.Join(Environment.NewLine, toPrint).GetHashCode();
    }
}
/*
Environment:

set DOTNET_JitELTHookEnabled=1
set DOTNET_TieredCompilation=0
set DOTNET_PreferredVectorBitWidth=512
set DOTNET_EnablePCLMULQDQ=1
set DOTNET_JitThrowOnAssertionFailure=1
set DOTNET_LegacyExceptionHandling=1

Debug: 0
Specified argument was out of the range of valid values.
Release: 0
JIT assert failed:
Assertion failed 'false && "found use of a node that is not in the LIR sequence"' in 'TestClass:Method1(byte,TestClass+S2,byref,short,System.Numerics.Vector2,byref,System.Numerics.Vector2,System.Numerics.Vector`1[ulong],byref):ulong:this' during 'Lowering nodeinfo' (IL size 280; hash 0xcd43e1bd; FullOpts)

    File: D:\a\_work\1\s\src\coreclr\jit\lir.cpp Line: 1687


*/
@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 Oct 7, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Oct 7, 2024
Copy link
Contributor

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

@JulieLeeMSFT JulieLeeMSFT removed the untriaged New issue has not been triaged by the area owner label Oct 7, 2024
@JulieLeeMSFT JulieLeeMSFT added this to the 9.0.0 milestone Oct 7, 2024
@BruceForstall
Copy link
Member

I can't repro this. I'm on this recent change:

commit 43295bb5378453d2ec4d9272cb44c6f50b4faa1f
Author: Matous Kozak <[email protected]>
Date:   Tue Oct 8 07:24:44 2024 +0200

I build the test with dotnet run -c Release and run with:

set DOTNET_JitELTHookEnabled=1
set DOTNET_TieredCompilation=0
set DOTNET_PreferredVectorBitWidth=512
set DOTNET_EnablePCLMULQDQ=1
set DOTNET_JitThrowOnAssertionFailure=1
set DOTNET_LegacyExceptionHandling=1
c:\gh\runtime\artifacts\tests\coreclr\windows.x64.Checked\Tests\Core_Root\corerun.exe C:\bugs\108613\bin\Release\net9.0\108613.dll

on an AVX-512 capable win/x64 machine.

@kunalspathak one thing I don't understand in the repro case is this:

Debug: 0
Specified argument was out of the range of valid values.
Release: 0

What are the "Debug: 0" and "Release: 0"?

Any suggestions for how to repro this failure?

@amanasifkhalid
Copy link
Member

@BruceForstall this might be a dumb question, but did you tweak the source code so the driver logic goes in Main() instead of Antigen()?

@kunalspathak
Copy link
Member Author

@BruceForstall this might be a dumb question, but did you tweak the source code so the driver logic goes in Main() instead of Antigen()?

yes, was going to say that. need to do this:

public static void Main(string[] args)
{ Antigen(); }

The repro basically returns the hashcode of accumulated value and when it fails, I just print 0.

@kunalspathak
Copy link
Member Author

Probably, I will do it next time i submit the Antigen repro.

@BruceForstall
Copy link
Member

yes, was going to say that. need to do this:

public static void Main(string[] args)
{ Antigen(); }

Ok, that is non-obvious. The repro case in the bug should be the code you actually need to run to repro.

With that, the assert hits with only set DOTNET_TieredCompilation=0.

(Maybe the reducer should try reducing the set of DOTNET variables, after reducing the size of the test case?)

BruceForstall added a commit to BruceForstall/runtime that referenced this issue Oct 11, 2024
@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Oct 11, 2024
carlossanlop pushed a commit that referenced this issue Oct 14, 2024
…otMask (#108803)

* Fix optimization of Vector512 And + Not to AndNot

Fixes #108613

* Fix test

---------

Co-authored-by: Bruce Forstall <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Nov 11, 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 in-pr There is an active PR which will close this issue when it is merged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants