runtime icon indicating copy to clipboard operation
runtime copied to clipboard

[RyuJIT/arm32][JitStress=2] Assertion failed '(curArgTabEntry->numSlots == 1) || isDouble'

Open BruceForstall opened this issue 9 years ago • 12 comments

In Windows RyuJIT/arm32 test run with COMPlus_JitStress=2:

Assert failure(PID 1356 [0x0000054c], Thread: 8376 [0x20b8]): Assertion failed '(curArgTabEntry->numSlots == 1) || isDouble' in 'ArrayLastIndexOf4:PosTest5():bool:this' (IL size 22)

    File: e:\gh\coreclr2\src\jit\lsraarmarch.cpp Line: 493
    Image: c:\brucefo\core_root\Windows_NT.arm.Checked.2017-08-23\CoreRun.exe

Test:

CoreMangLib\cti\system\array\ArrayLastIndexOf4\ArrayLastIndexOf4.cmd (TEST_IDENTIFIER = Tests.lst=ArrayLastIndexOf4.cmd_8391)

BruceForstall avatar Sep 01 '17 15:09 BruceForstall

@dotnet/arm32-contrib

BruceForstall avatar Sep 01 '17 15:09 BruceForstall

This test is passed with recent commit cd6b92a94e1 on a following environment.

Device: Raspberry Pi3
OS: Ubuntu 16.04
CoreCLR configuration: Checked
COMPlus options:  COMPlus_JitStress=2 COMPlus_AltJit=*

hqueue avatar Sep 18 '17 04:09 hqueue

Interesting. It still fails for me on Windows.

BruceForstall avatar Sep 18 '17 18:09 BruceForstall

Is there any difference between Windows/ARM and Linux/ARM ABI when handling structure arguments ?

Assertion seems to be related to arguments.

https://github.com/dotnet/coreclr/blob/master/src/jit/lsraarmarch.cpp#L493

void LinearScan::TreeNodeInfoInitCall(GenTreeCall* call)
{   
...
                // We must not have a multi-reg struct; double uses 2 slots and isn't a multi-reg struct
                assert((curArgTabEntry->numSlots == 1) || isDouble);
...
}

hqueue avatar Sep 19 '17 07:09 hqueue

No, the ABI is the same. It will just need to be investigated.

BruceForstall avatar Sep 19 '17 14:09 BruceForstall

Fails a lot in JitStress=1, e.g.

JIT\jit64\hfa\main\testA\hfa_sf2A_d\hfa_sf2A_d.cmd
JIT\jit64\hfa\main\testG\hfa_sd0G_r\hfa_sd0G_r.cmd
JIT\jit64\hfa\main\testG\hfa_sd1G_r\hfa_sd1G_r.cmd

BruceForstall avatar Oct 25 '17 20:10 BruceForstall

I'm seeing this fail for x86_arm_altjit, with no stress modes, for

JIT\jit64\hfa\main\testG\hfa_sd0G_r\hfa_sd0G_r.exe

The assert is:

#ifdef _TARGET_ARM_
                // The `double` types have been transformed to `long` on arm, while the actual longs
                // have been decomposed.
                const bool isDouble = putArgChild->TypeGet() == TYP_LONG;
                if (isDouble)
                {
                    argNode->gtLsraInfo.srcCount = 2;
                }

                // We must not have a multi-reg struct; double uses 2 slots and isn't a multi-reg struct
                assert((curArgTabEntry->numSlots == 1) || isDouble);
#else  // !_TARGET_ARM_

but I'm seeing:

N221 (  3,  4) [003168] -------------     t3168 =    CNS_DBL   double -57168.000000000000 $c6
                                                  /--*  t3168  double
               [005717] -------------             *  PUTARG_STK [+0x18] void   (2 slots)

...

                                                  /--*  t3199  double arg0 f0-f5
                                                  +--*  t5710  float  arg1 in f6
                                                  +--*  t3205  double arg2 f8-f13
                                                  +--*  t5721  int    arg10 r2,r3
                                                  +--*  t5727  int    arg3 in r0
                                                  +--*  t5728  int    arg5 in r1
                                                  +--*  t5730  int    control expr
N251 (255,255) [000236] --CXG--------      t236 = *  CALL      double HFATest.TestMan.Add01_HFA03 $226

When processing the CALL, it sees the PUTARG_STK, and the t3168 node child, and asserts.

The comment above says, "The double types have been transformed to long on arm". Question: what code enforces this? Should this assert just be loosened to allow for double constants? Or are the doubles supposed to be type converted to LONG for some reason?

@CarolEidt @hqueue any ideas?

BruceForstall avatar Oct 26 '17 23:10 BruceForstall

@hqueue Did you test on an ARM_SOFTFP / armel environment?

BruceForstall avatar Oct 27 '17 23:10 BruceForstall

@BruceForstall

Did you test on an ARM_SOFTFP / armel environment?

To answer for @hqueue, we run only ubuntu(armhf) on RPi3 so it is not armel environment.

The comment above says, "The double types have been transformed to long on arm". Question: what code enforces this?

As far as I remember, none of stack args are transformed. We transform float/double type arg regs to int/long when armel calling convention. Not 100% sure though. https://github.com/dotnet/coreclr/blob/ffcb0127f247372b25e231470517cec272dca659/src/jit/lower.cpp#L1324-L1351

wateret avatar Oct 30 '17 08:10 wateret

@BRuceForstall Sorry, I was late for this issue. I've looked shortly on this and I don't have clue yet.

@hseok-oh Any idea for this ?

hqueue avatar Oct 30 '17 10:10 hqueue

@BruceForstall @hqueue @wateret I could reproduce same failure on my environment with Altjit, nostress.

CoreCLR build: checked
CoreFX native build: debug
CoreFX managed build: release
Test build: release

For example,

./corerun /home/nfs/test/test/Release/JIT/jit64/hfa/main/testA/hfa_sf2A_d/hfa_sf2A_d.exe
[Sum HFA 01]    PASSED
.......
[Sum19 HFA 01]  PASSED

Assert failure(PID 12707 [0x000031a3], Thread: 12707 [0x31a3]): Assertion failed '(curArgTabEntry->numSlots == 1) || isDouble' in 'DomainBoundILStubClass:IL_STUB_PInvoke(float,double,float,double,float,double,float,double,float,double,float,double,float,struct):float' (IL size 169)

    File: /home/nfs/git/coreclr/src/jit/lsraarmarch.cpp Line: 476
    Image: /home/nfs/test/coreoverlay_checked_arm/corerun

But no failure on release build. I'll check this on my environment.

Failed tests

JIT.jit64.hfa.main.testA.hfa_sd0A_r.hfa_sd0A_r
JIT.jit64.hfa.main.testA.hfa_sd1A_r.hfa_sd1A_r
JIT.jit64.hfa.main.testA.hfa_sd2A_r.hfa_sd2A_r
JIT.jit64.hfa.main.testA.hfa_sd2A_d.hfa_sd2A_d
JIT.jit64.hfa.main.testA.hfa_sf0A_r.hfa_sf0A_r
JIT.jit64.hfa.main.testA.hfa_sf1A_r.hfa_sf1A_r
JIT.jit64.hfa.main.testA.hfa_sf2A_r.hfa_sf2A_r
JIT.jit64.hfa.main.testA.hfa_sf2A_d.hfa_sf2A_d
JIT.jit64.hfa.main.testB.hfa_sd0B_d.hfa_sd0B_d
JIT.jit64.hfa.main.testB.hfa_sd0B_r.hfa_sd0B_r
JIT.jit64.hfa.main.testB.hfa_sd2B_d.hfa_sd2B_d
JIT.jit64.hfa.main.testB.hfa_sd2B_r.hfa_sd2B_r
JIT.jit64.hfa.main.testB.hfa_sf0B_d.hfa_sf0B_d
JIT.jit64.hfa.main.testB.hfa_sf0B_r.hfa_sf0B_r
JIT.jit64.hfa.main.testB.hfa_sf2B_d.hfa_sf2B_d
JIT.jit64.hfa.main.testB.hfa_sf2B_r.hfa_sf2B_r
JIT.jit64.hfa.main.testG.hfa_sd0G_r.hfa_sd0G_r
JIT.jit64.hfa.main.testG.hfa_sd1G_r.hfa_sd1G_r
JIT.jit64.hfa.main.testG.hfa_sd2G_r.hfa_sd2G_r
JIT.jit64.hfa.main.testG.hfa_sd2G_d.hfa_sd2G_d

hseok-oh avatar Oct 31 '17 02:10 hseok-oh

@BruceForstall As @wateret said, there is no tranfrom from double to long for arm hardfp PutArgStk.

hseok-oh avatar Oct 31 '17 05:10 hseok-oh