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 failure while crossgenning ImageSharp: '!op1->TypeIs(TYP_STRUCT) && (op1->TypeGet() == op2->TypeGet())' in 'SixLabors.ImageSharp.PixelFormats.Byte4:ToString():System.String:this' during 'Morph - Global' #70824

Closed
jakobbotsch opened this issue Jun 16, 2022 · 2 comments · Fixed by #70829
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone

Comments

@jakobbotsch
Copy link
Member

jakobbotsch commented Jun 16, 2022

When crossgenning ImageSharp on current main I hit the following assertion:

C:\dev\dotnet\runtime2\src\coreclr\jit\simd.cpp:1646
Assertion failed '!op1->TypeIs(TYP_STRUCT) && (op1->TypeGet() == op2->TypeGet())' in 'SixLabors.ImageSharp.PixelFormats.Byte4:ToString():System.String:this' during 'Morph - Global' (IL size 85; hash 0xaeeb505c; FullOpts)

Small x64 repro (does not require crossgen, requires opts enabled/TC disabled):

using System;
using System.Numerics;
using System.Runtime.CompilerServices;

public class Program
{
    public static void Main(string[] args)
    {
        Byte4 foo = default;
        Console.WriteLine(foo.ToString());
    }
}

public partial struct Byte4
{
    public uint PackedValue { get; set; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public readonly Vector4 ToVector4() => new(
            this.PackedValue & 0xFF,
            (this.PackedValue >> 0x8) & 0xFF,
            (this.PackedValue >> 0x10) & 0xFF,
            (this.PackedValue >> 0x18) & 0xFF);

    public override readonly string ToString()
    {
        var vector = this.ToVector4();
        return FormattableString.Invariant($"Byte4({vector.X:#0.##}, {vector.Y:#0.##}, {vector.Z:#0.##}, {vector.W:#0.##})");
    }
}
@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 Jun 16, 2022
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jun 16, 2022
@ghost
Copy link

ghost commented Jun 16, 2022

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

Issue Details

When crossgenning ImageSharp on current main I hit the following assertion:

C:\dev\dotnet\runtime2\src\coreclr\jit\simd.cpp:1646
Assertion failed '!op1->TypeIs(TYP_STRUCT) && (op1->TypeGet() == op2->TypeGet())' in 'SixLabors.ImageSharp.PixelFormats.Byte4:ToString():System.String:this' during 'Morph - Global' (IL size 85; hash 0xaeeb505c; FullOpts)

Small repro (does not require crossgen):

using System;
using System.Numerics;
using System.Runtime.CompilerServices;

public class Program
{
    public static void Main(string[] args)
    {
        Byte4 foo = default;
        Console.WriteLine(foo.ToString());
    }
}

public partial struct Byte4
{
    public uint PackedValue { get; set; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public readonly Vector4 ToVector4() => new(
            this.PackedValue & 0xFF,
            (this.PackedValue >> 0x8) & 0xFF,
            (this.PackedValue >> 0x10) & 0xFF,
            (this.PackedValue >> 0x18) & 0xFF);

    public override readonly string ToString()
    {
        var vector = this.ToVector4();
        return FormattableString.Invariant($"Byte4({vector.X:#0.##}, {vector.Y:#0.##}, {vector.Z:#0.##}, {vector.W:#0.##})");
    }
}
Author: jakobbotsch
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

@jakobbotsch jakobbotsch added this to the 7.0.0 milestone Jun 16, 2022
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jun 16, 2022
@SingleAccretion
Copy link
Contributor

Likely a regression from #69917.

Will take a look.

@SingleAccretion SingleAccretion self-assigned this Jun 16, 2022
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jun 16, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jun 16, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 17, 2022
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants