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 'link' during 'Optimize Valnum CSEs' #108600

Closed
amanasifkhalid opened this issue Oct 7, 2024 · 4 comments · Fixed by #106695
Closed

JIT: Assertion failed 'link' during 'Optimize Valnum CSEs' #108600

amanasifkhalid opened this issue Oct 7, 2024 · 4 comments · Fixed by #106695
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

@amanasifkhalid
Copy link
Member

// Generated by Fuzzlyn v2.4 on 2024-10-06 15:34:46
// Run on X64 Linux
// Seed: 18042304686511850099-vectort,vector128,vector256,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86avx512fx64,x86bmi1,x86bmi1x64,x86bmi2,x86bmi2x64,x86fma,x86lzcnt,x86lzcntx64,x86pclmulqdq,x86popcnt,x86popcntx64,x86sse,x86ssex64,x86sse2,x86sse2x64,x86sse3,x86sse41,x86sse41x64,x86sse42,x86sse42x64,x86ssse3,x86x86base
// Reduced from 61.8 KiB to 1.2 KiB in 00:00:40
// Hits JIT assert in Release:
// Assertion failed 'link' in 'Program:Main(Fuzzlyn.ExecutionServer.IRuntime)' during 'Optimize Valnum CSEs' (IL size 43; hash 0xade6b36b; FullOpts)
// 
//     File: /__w/1/s/src/coreclr/jit/optcse.cpp Line: 5295
// 
using System;
using System.Numerics;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

public class Program
{
    public static long[] s_2;
    public static float s_3;
    public static void Main()
    {
        CollectibleALC alc = new CollectibleALC();
        System.Reflection.Assembly asm = alc.LoadFromAssemblyPath(System.Reflection.Assembly.GetExecutingAssembly().Location);
        System.Reflection.MethodInfo mi = asm.GetType(typeof(Program).FullName).GetMethod(nameof(MainInner));
        System.Type runtimeTy = asm.GetType(typeof(Runtime).FullName);
        mi.Invoke(null, new object[] { System.Activator.CreateInstance(runtimeTy) });
    }

    public static void MainInner(IRuntime rt)
    {
        var vr1 = Vector128.Create<double>(0);
        s_3 = (float)(-(-(double)Avx512F.X64.ConvertToUInt64(vr1)));
        s_2[0] = (long)s_3;
    }
}

public interface IRuntime
{
    void WriteLine<T>(string site, T value);
}

public class Runtime : IRuntime
{
    public void WriteLine<T>(string site, T value) => System.Console.WriteLine(value);
}

public class CollectibleALC : System.Runtime.Loader.AssemblyLoadContext
{
    public CollectibleALC() : base(true)
    {
    }
}

cc @dotnet/jit-contrib

@amanasifkhalid amanasifkhalid added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Oct 7, 2024
@amanasifkhalid amanasifkhalid added this to the 9.0.0 milestone 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
Copy link
Member

@jakobbotsch PTAL.

@jakobbotsch
Copy link
Member

Don't think we need to fix this in .NET 9 -- the failure mode is handled "gracefully" (rejit in MinOpts) and seems hard to expose in normal code (requires (float)(double) IR during CSE, which would usually be eliminated earlier -- the example gets it via a double negation).

@jakobbotsch jakobbotsch modified the milestones: 9.0.0, 10.0.0 Oct 9, 2024
@jakobbotsch
Copy link
Member

This will be fixed by #106695

@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 14, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 15, 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.

3 participants