Skip to content

JIT: Likely incorrect side effect ordering with Avx512F.VL.TernaryLogic #114324

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

Closed
jakobbotsch opened this issue Apr 7, 2025 · 3 comments · Fixed by #114848
Closed

JIT: Likely incorrect side effect ordering with Avx512F.VL.TernaryLogic #114324

jakobbotsch opened this issue Apr 7, 2025 · 3 comments · Fixed by #114848
Assignees
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
Milestone

Comments

@jakobbotsch
Copy link
Member

// Generated by Fuzzlyn v2.5 on 2025-04-06 16:30:45
// Run on X64 Windows
// Seed: 13621799076737484256-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 20.1 KiB to 0.7 KiB in 00:01:13
// Debug: Runs successfully
// Release: Throws 'System.NullReferenceException'
using System;
using System.Numerics;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

public class Program
{
    public static ulong[] s_3;
    public static void Main()
    {
        var vr1 = Vector128.Create<int>(1);
        Vector128<int> vr2 = Avx512F.VL.TernaryLogic(vr1, Sse2.ShiftLeftLogical128BitLane(Vector128.Create<int>((int)Sse42.Crc32(M2(), 0)), 0), Avx512F.VL.ConvertToVector128Int32(Vector256.Create<ulong>(s_3[0])), 221);
        System.Console.WriteLine(vr2);
    }

    public static uint M2()
    {
        s_3 = new ulong[]
        {
            0
        };
        return M3();
    }

    public static byte M3()
    {
        return default(byte);
    }
}

cc @dotnet/jit-contrib

@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 7, 2025
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Apr 7, 2025
@jakobbotsch jakobbotsch removed the untriaged New issue has not been triaged by the area owner label Apr 7, 2025
@jakobbotsch jakobbotsch added this to the 10.0.0 milestone Apr 7, 2025
@jakobbotsch jakobbotsch added the blocking-clean-ci-optional Blocking optional rolling runs label Apr 7, 2025
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

CC @tannergooding and @anthonycanino.

@BruceForstall
Copy link
Contributor

I'll take this one.

BruceForstall added a commit to BruceForstall/runtime that referenced this issue Apr 20, 2025
There were a few cases of TernaryLogic with NOT/AND and NOT/OR that
swapped operands without considering side effects. Add some new logic to
hoist those side effects if necessary.

Fixes dotnet#114324
@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2025
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 blocking-clean-ci-optional Blocking optional rolling runs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants