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

[RFC] Assertion failed 'OperIs(GT_NOP, GT_CALL, GT_FIELD_LIST, GT_COMMA) || OperIsCompare() || OperIsLong() || OperIsSIMD() || OperIsHWIntrinsic()' #760

Closed
xiangzhai opened this issue Dec 11, 2019 · 10 comments
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Milestone

Comments

@xiangzhai
Copy link
Contributor

xiangzhai commented Dec 11, 2019

Hi,

Base on this commit.

Testcase: Hello.dll

Build and run option:

./src/coreclr/build.sh skipcrossgen
cp artifacts/bin/coreclr/Linux.x64.Debug/IL/System.Private.CoreLib.dll artifacts/bin/coreclr/Linux.x64.Debug/
export CORE_LIBRARIES=/home/zhaixiang/runtime/.dotnet/shared/Microsoft.NETCore.App/3.0.0
export COMPlus_JitFunctionTrace=1
export COMPlus_JitDumpIR="*"
gdb --args ./artifacts/bin/coreclr/Linux.x64.Debug/corerun /home/zhaixiang/HelloWorld.dll

Assertion failed:

...
IR after PHASE_EMPTY_TRY (switch: EMPTYTRY)

Method System.AppContext::Setup, hash=fd42e87f

BB01:

                                 NOP                   
                              STMT00000
    t71                        = CNS_INT                HANDLE(0x7fff7bfd45e0)
    t72                        = IND                    t71
    t73                        = CNS_INT                0(0x0)
    t74                        = EQ                     t72, t73
                                 CALL:H                 HELPER.CORINFO_HELP_DBG_IS_JUST_MY_CODE
                                 NOP                   

Assert failure(PID 8411 [0x000020db], Thread: 8411 [0x20db]): Assertion failed 'OperIs(GT_NOP, GT_CALL, GT_COMMA) || OperIsCompare() || OperIsLong() || OperIsSIMD() || OperIsHWIntrinsic()' in 'System.AppContext:Setup(long,long,int)' (IL size 95)

    File: /home/zhaixiang/runtime/src/coreclr/src/jit/gentree.h Line: 964
    Image: /home/zhaixiang/runtime/artifacts/bin/coreclr/Linux.x64.Debug/corerun

And CoreCLR 3.x branch for ARM64 and MIPS64 are also able to reproduce the issue:

ARM64:

...
IR after PHASE_EMPTY_TRY (switch: EMPTYTRY)

Method System.AppContext::Setup, hsh=0xd8570543

BB01:

                                 NOP                   
                                 STMT                   t0

    t81                        = CNS_INT                HANDLE(0x7f3d1b4658)
    t82                        = IND                    t81
    t83                        = CNS_INT                0(0x0)
    t84                        = EQ                     t82, t83
                                 CALL:H                 HELPER.CORINFO_HELP_DBG_IS_JUST_MY_CODE
                                 NOP                   

Assert failure(PID 16360 [0x00003fe8], Thread: 16360 [0x3fe8]): Assertion failed 'OperIs(GT_NOP, GT_CALL, GT_FIELD_LIST, GT_COMMA) || OperIsCompare() || OperIsLong() || OperIsSIMD() || OperIsHWIntrinsic()' in 'System.AppContext:Setup(long,long,int)' (IL size 65)

    File: /home/loongson/zhaixiang/coreclr-mips64-dev/src/jit/gentree.h Line: 975
    Image: /home/loongson/zhaixiang/coreclr-mips64-dev/bin/Product/Linux.arm64.Debug/corerun

MIPS64:

...
IR after PHASE_EMPTY_TRY (switch: EMPTYTRY)

Method System.AppContext::Setup, hsh=0xd8570543

BB01:

                                 NOP                   
                                 STMT                   t0

    t81                        = CNS_INT                HANDLE(0xff7c750658)
    t82                        = IND                    t81
    t83                        = CNS_INT                0(0x0)
    t84                        = EQ                     t82, t83
                                 CALL:H                 HELPER.CORINFO_HELP_DBG_IS_JUST_MY_CODE
                                 NOP                   
                                 COLON                  t85, t86

Assert failure(PID 24271 [0x00005ecf], Thread: 24271 [0x5ecf]): Assertion failed 'OperIs(GT_NOP, GT_CALL, GT_FIELD_LIST, GT_COMMA) || OperIsCompare() || OperIsLong() || OperIsSIMD() || OperIsHWIntrinsic()' in 'System.AppContext:Setup(long,long,int)' (IL size 65)

    File: /home/loongson/zhaixiang/coreclr-mips64-dev/src/jit/gentree.h Line: 975
    Image: /home/loongson/zhaixiang/coreclr-mips64-dev/bin/Product/Linux.mips64.Debug/corerun

Workaround patch:

diff --git a/src/coreclr/src/jit/gentree.h b/src/coreclr/src/jit/gentree.h
index c88ba80..0487981 100644
--- a/src/coreclr/src/jit/gentree.h
+++ b/src/coreclr/src/jit/gentree.h
@@ -960,8 +960,8 @@ public:
         if (gtType == TYP_VOID)
         {
             // These are the only operators which can produce either VOID or non-VOID results.
-            assert(OperIs(GT_NOP, GT_CALL, GT_COMMA) || OperIsCompare() || OperIsLong() || OperIsSIMD() ||
-                   OperIsHWIntrinsic());
+            assert(OperIs(GT_NOP, GT_CALL, GT_COMMA, GT_COLON, GT_QMARK) ||
+                   OperIsCompare() || OperIsLong() || OperIsSIMD() || OperIsHWIntrinsic());
             return false;
         }
 

Request for comments.

Thanks,
Leslie Zhai

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added the untriaged New issue has not been triaged by the area owner label Dec 11, 2019
@xiangzhai
Copy link
Contributor Author

\cc @BruceForstall

@BruceForstall BruceForstall added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Dec 11, 2019
@sandreenko
Copy link
Contributor

I will take a look.

@sandreenko sandreenko self-assigned this Dec 11, 2019
@BruceForstall BruceForstall removed the untriaged New issue has not been triaged by the area owner label Dec 11, 2019
@sandreenko
Copy link
Contributor

The issue is specific to COMPlus_JitDumpIR, that complus is outdated and I don't think anybody on the team is using it.
The failure can be reproduced on Windows almost at any test, it happens because cNodeIR calls tree->IsValue() during early phases and IsValue is LIR specific.

I suggest you to use COMPLUS_JitDump variable instead and ask us if any parts of its output are not clear or difficult to read. We will happy to answer and improve its output.

With regard to COMPlus_JitDumpIR it is probably not worth fixing it now and it probably should be deleted, cc @CarolEidt @dotnet/jit-contrib .

@mikedn
Copy link
Contributor

mikedn commented Dec 11, 2019

With regard to COMPlus_JitDumpIR it is probably not worth fixing it now and it probably should be deleted

That would be good IMO as it's quite a bit of code. When it first appeared I thought it's great to have this kind of linear dump. And then never used it, not even once. And instead went on improving tree dumps :)

@BruceForstall
Copy link
Member

I agree with @mikedn. If anyone actually uses it, speak up. But I think only the original author ever used it.

@xiangzhai
Copy link
Contributor Author

Hi @sandreenko

Thanks for your kind response!

The issue is specific to COMPlus_JitDumpIR

Yes, I use it to dump the High IR. I mentioned it in the Build and run option above. @QiaoVanke asked me that there might be some issues when porting src/System.Private.CoreLib and CoreFX 3.1 branch for MIPS64. So I need to diff the IR with other architectures for checking my porting work.

I suggest you to use COMPLUS_JitDump variable instead

JitDump failed to work for the testcase JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128_r/ConvertToVector128_r.exe. Sorry for that! @QiaoVanke and I are fixing it for MIPS64. So I just use JitDumpIR temporarily.

With regard to COMPlus_JitDumpIR it is probably not worth fixing it now and it probably should be deleted

I also agree to deprecate JitDumpIR.

Cheers,
Leslie Zhai

@xiangzhai
Copy link
Contributor Author

I suggest you to use COMPLUS_JitDump variable instead

JitDump failed to work for the testcase JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128_r/ConvertToVector128_r.exe. Sorry for that! @QiaoVanke and I are fixing it for MIPS64. So I just use JitDumpIR temporarily.

How about ildasm?

$ ./bin/Product/Linux.mips64.Debug/ildasm bin/Product/Linux.mips64.Debug/System.Private.CoreLib.dll &> System.Private.CoreLib.il

Thanks,
Leslie Zhai

@sandreenko
Copy link
Contributor

JitDump failed to work for the testcase JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128_r/ConvertToVector128_r.exe

Does it fail with something MIPS specific?

How about ildasm?

Doesn't it work for that test? How does it fail?

@xiangzhai
Copy link
Contributor Author

xiangzhai commented Dec 12, 2019

JitDump failed to work for the testcase JIT/HardwareIntrinsics/X86/Sse41/ConvertToVector128_r/ConvertToVector128_r.exe

Does it fail with something MIPS specific?

Yes, we refactoried the IG for MIPS64, so such as emitter::emitDispIG failed to work at present.

How about ildasm?

Doesn't it work for that test? How does it fail?

ildasm works for MIPS64
System.Private.CoreLib.il.zip

Cheers,
Leslie Zhai

@sandreenko sandreenko added this to the 5.0 milestone Dec 12, 2019
@BruceForstall
Copy link
Member

This issue is resolved, so closing. I opened #818 to cover the suggestion to remove JitDumpIR.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2020
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

No branches or pull requests

5 participants