Skip to content

JIT: Debug/Release generate different results #114572

Closed

Description

@BruceForstall
// Generated by Fuzzlyn v2.5 on 2025-04-11 19:29:41
// Run on X64 Windows
// Seed: 557319528607462789-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 41.1 KiB to 0.7 KiB in 00:01:23
// Debug: Outputs <0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1>
// Release: Outputs <0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1>
using System;
using System.Numerics;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

public class Program
{
    public static Vector256<ushort> s_2;
    public static ushort s_4;
    public static void Main()
    {
        var vr11 = Vector256.Create<ushort>(0);
        var vr12 = Vector256.Create<ushort>(1);
        var vr13 = (ushort)0;
        var vr14 = Vector256.CreateScalar(vr13);
        var vr15 = (ushort)1;
        var vr16 = Vector256.CreateScalar(vr15);
        var vr17 = Vector256.Create<ushort>(s_4);
        var vr18 = Avx2.Max(vr16, vr17);
        s_2 = Avx512F.VL.TernaryLogic(vr11, vr12, Avx512BW.VL.CompareGreaterThanOrEqual(vr14, vr18), 216);
        System.Console.WriteLine(s_2);
    }
}

https://dev.azure.com/dnceng-public/public/_build/results?buildId=1013771&view=ms.vss-build-web.run-extensions-tab

@dotnet/jit-contrib @dotnet/intel

Activity

  1. added
    area-CodeGen-coreclr
    on Apr 11, 2025
  2. added this to the 10.0.0 milestone on Apr 11, 2025
  3. dotnet-policy-service commented on Apr 11, 2025

    @dotnet-policy-service
    Contributor

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

  4. saucecontrol commented on Apr 13, 2025

    @saucecontrol
    Member

    Looks like this was a regression between 8.0 and 9.0.

    .NET 8.0.15 X64 Debug
    <0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1>
    
    .NET 8.0.15 X64 Release
    <0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1>
    
    
    .NET 9.0.4 X64 Debug
    <0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1>
    
    .NET 9.0.4 X64 Release
    <0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1>
    
  5. saucecontrol commented on Apr 14, 2025

    @saucecontrol
    Member

    The problem here is that we emit a dword-granularity mask blend with a word-granularity mask:

    Main:

           vpcmpuw  k1, ymm1, ymm2, 2
           vpblendmd ymm6 {k1}, ymm0, dword ptr [reloc @RWD32] {1to8}

    9.0 is same but without the embedded broadcast:

           vpcmpuw  k1, ymm1, ymmword ptr [rbp-0x90], 5
           vpblendmd ymm0 {k1}, ymm0, ymmword ptr [rbp-0x30]

    Debug preserves the vpternlog, so it gets the mask right.

           vpcmpuw  k1, ymm0, ymmword ptr [rbp-0x110], 5
           vpmovm2w ymm0, k1
           ...
           vpternlogd ymm0, ymm1, ymmword ptr [rbp-0x230], -40
  6. added
    blocking-clean-ci-optional
    on Apr 14, 2025
  7. added a commit that references this issue on Apr 20, 2025
    98c7dbe
  8. BruceForstall commented on Apr 20, 2025

    @BruceForstall
    ContributorAuthor

    @saucecontrol thanks for the analysis! I have a proposed fix in #114837

  9. added 3 commits that reference this issue on Apr 20, 2025
    3354bf9
    67a2f38
    83d0b08
  10. added a commit that references this issue on Apr 26, 2025
    9df77ee
  11. locked and limited conversation to collaborators on May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrblocking-clean-ci-optional

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions