Skip to content

[RyuJIT/xarch] Assertion failed 'child->isContained()' in src/jit/lsraxarch.cpp Line: 494 #9472

@4creators

Description

@4creators

CI in PR dotnet/coreclr#15585 was failing for some optimized tests only (#15618 was fixed in my PR with solution from dotnet/coreclr#15637) with the following errors:

Windows_NT x86 Checked Innerloop Build and Test

Assert failure(PID 7592 [0x00001da8], Thread: 11900 [0x2e7c]): Assertion failed 'child->isContained()' in 'IntelHardwareIntrinsicTest.Program:Main(ref):int' (IL size 1287)
             File: d:\j\workspace\x86_checked_w---b3a226f6\src\jit\lsraxarch.cpp Line: 494
             Image: D:\j\workspace\x86_checked_w---b3a226f6\bin\tests\Windows_NT.x86.Checked\Tests\Core_Root\CoreRun.exe

Identical asserts were hit for:
Windows_NT x86 Checked Innerloop Build and Test https://ci.dot.net/job/dotnet_coreclr/job/master/job/x86_checked_windows_nt_prtest/13677/
Ubuntu x64 Checked Innerloop Build and Test https://ci.dot.net/job/dotnet_coreclr/job/master/job/checked_ubuntu_flow_prtest/14336/
OSX10.12 x64 Checked Innerloop Build and Test https://ci.dot.net/job/dotnet_coreclr/job/master/job/checked_osx10.12_flow_prtest/10570/
CentOS7.1 x64 Checked Innerloop Build and Test https://ci.dot.net/job/dotnet_coreclr/job/master/job/checked_centos7.1_flow_prtest/2090/

It was possible to create minimum repro for the assertion:

using System;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

namespace IntelHardwareIntrinsicTest
{
    internal static partial class Program
    {
        static unsafe int Main(string[] args)
        {
            if (Sse2.IsSupported)
            {
                using (var doubleTable = TestTableVector128<double>.Create(testsCount))
                {
                    (Vector128<double>, Vector128<double>, Vector128<double>) value = doubleTable[i];
                    doubleTable.SetOutArray(Sse2.Add(value.Item1, value.Item2));                  // => this call triggers assert
                }
            }
            return 0;
        }
    }
}

The workaround for the issue is quite simple, it is enough to create local variable which will receive value from Sse2.Add(value.Item1, value.Item2) call before passing it to doubleTable.SetOutArray i.e..

                    var result = Sse2.Add(value.Item1, value.Item2);
                    doubleTable.SetOutArray(result);

The assert is hit for all Sse2 methods tested so far when built with optimization. TestTableVector128 codes used in test case can be found here:
https://github.com/dotnet/coreclr/pull/15585/files#diff-a673f392be079e241929d6095941fa16

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIbug

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions