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: Assertion failed (consume == 0) || (ComputeAvailableSrcCount(tree) == consume) during 'Linear scan register alloc' #113832

Closed
jakobbotsch opened this issue Mar 24, 2025 · 1 comment · Fixed by #113845 · May be fixed by #113994
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI blocking-clean-ci-optional Blocking optional rolling runs in-pr There is an active PR which will close this issue when it is merged
Milestone

Comments

@jakobbotsch
Copy link
Member

// Generated by Fuzzlyn v2.5 on 2025-03-23 15:25:27
// Run on X86 Windows
// Seed: 916448399438567841-vectort,vector128,vector256,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86bmi1,x86bmi2,x86fma,x86lzcnt,x86pclmulqdq,x86popcnt,x86sse,x86sse2,x86sse3,x86sse41,x86sse42,x86ssse3,x86x86base
// Reduced from 63.4 KiB to 0.7 KiB in 00:02:21
// Hits JIT assert in Release:
// Assertion failed '(consume == 0) || (ComputeAvailableSrcCount(tree) == consume)' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Linear scan register alloc' (IL size 68; hash 0xade6b36b; FullOpts)
// 
//     File: D:\a\_work\1\s\src\coreclr\jit\lsrabuild.cpp Line: 1776
// 
using System;
using System.Numerics;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

public class Program
{
    public static byte s_4;
    public static void Main()
    {
        var vr9 = Vector128.Create<ulong>(0);
        var vr10 = (ulong)s_4;
        var vr11 = Vector128.CreateScalar(vr10);
        var vr12 = Avx2.BroadcastScalarToVector128(vr11);
        var vr13 = (byte)0;
        var vr14 = Vector256.CreateScalar(vr13);
        var vr15 = (ulong)Avx2.MoveMask(vr14);
        var vr16 = Vector128.Create<ulong>(vr15);
        var vr17 = Avx512F.VL.TernaryLogic(vr9, vr12, vr16, 1);
        System.Console.WriteLine(vr17);
    }
}

Note that when I try this locally with AltJit (since I don't have an AVX512 CPU) I get a different assert:

Assert failure(PID 34784 [0x000087e0], Thread: 20004 [0x4e24]): Assertion failed 'unreached' in 'Program:Main()' during 'Generate code' (IL size 61; hash 0xcb019401; FullOpts)

    File: C:\dev\dotnet\runtime4\src\coreclr\jit\instr.cpp:1049
    Image: D:\dev\core_roots\16236fdcd417dcfc700e55dd7ae76365ceb7ff87\corerun.exe

I've bisected this to #112728, so I assume the original assert seen by Fuzzlyn is also related to that PR. cc @saucecontrol

cc @dotnet/jit-contrib

@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 Mar 24, 2025
@jakobbotsch jakobbotsch added this to the 10.0.0 milestone Mar 24, 2025
@jakobbotsch jakobbotsch added the blocking-clean-ci-optional Blocking optional rolling runs label Mar 24, 2025
@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 Mar 24, 2025
@saucecontrol
Copy link
Member

Likely related failure seen on #113864

// Generated by Fuzzlyn v2.5 on 2025-03-27 16:58:00
// Run on X86 Windows
// Seed: 10696738320409793384-vectort,vector128,vector256,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86bmi1,x86bmi2,x86fma,x86lzcnt,x86pclmulqdq,x86popcnt,x86sse,x86sse2,x86sse3,x86sse41,x86sse42,x86ssse3,x86x86base
// Reduced from 151.7 KiB to 0.8 KiB in 00:02:43
// Hits JIT assert in Release:
// Assertion failed 'hwintrinsicChild->isContained()' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Generate code' (IL size 94; hash 0xade6b36b; FullOpts)
// 
//     File: D:\a\_work\1\s\src\coreclr\jit\instr.cpp Line: 903
// 
using System;
using System.Numerics;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

public class Program
{
    public static ulong s_26;
    public static void Main()
    {
        Vector256<short> vr14 = default(Vector256<short>);
        var vr15 = s_26++;
        var vr16 = Vector128.CreateScalar(vr15);
        var vr17 = Avx2.BroadcastScalarToVector128(vr16);
        var vr18 = Vector128.Create<ulong>(0);
        var vr19 = Vector128.Create<ulong>(0);
        var vr20 = Sse2.ShiftRightLogical128BitLane(vr19, 0);
        var vr21 = Avx512F.VL.PermuteVar2x64x2(vr17, vr18, vr20);
        var vr22 = Vector128.Create<ulong>(0);
        if (Sse41.TestZ(vr21, vr22))
        {
            System.Console.WriteLine(vr14);
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI blocking-clean-ci-optional Blocking optional rolling runs in-pr There is an active PR which will close this issue when it is merged
Projects
None yet
2 participants